emacseshell

How to highlight some words in Eshell?


I use Eshell in Emacs to run a program and I could check the output in the Shell , but I want to highlight some words like ‘errors’ ‘info’,or other words like that. How could I do that ?


Solution

  • (defun font-lock-comment-annotations ()
      (font-lock-add-keywords
       nil
       '(("\\<\\(error\\)" 1 font-lock-warning-face t)
         ("\\<\\(info\\)" 1 'org-todo t)
       ))
    (add-hook 'eshell-mode-hook 'font-lock-comment-annotations)
    
    

    Give it a try :)