Similar to org mode, for taking colorful notes in Emacs, I would like to define some special characters (used in the beginning of the lines) to tell Emacs which colors (foreground/background) should be used for highlighting the entire current line. Is there any script for this purpose? If yes, please let me know how I can use it.

An example of the notes :

# list of operating systems : << highlighted with red
@    Unix              << highlighted with blue
@    Linux             << highlighted with blue
@    Minix             << highlighted with blue
  • Why not Org mode? It does this out of the box. – Gilles Apr 19 '16 at 21:53
  • For some unknown reasons, my Emacs does not apply changes in the settings. As I only need to highlight simple lines, I thought it would be better to run a simple script or command instead. – askman Apr 20 '16 at 0:55

You can use highlight-lines-matching-regexp and save settings within the same file (with hi-lock-write-interactive-patterns and hi-lock-find-patterns as described here).

Or you can define your own syntax highlighting if it's worth the trouble.

  • the command highlights text just for the first time calling. I mean after adding some lines, not only the new lines are not highlighted but also running the command again has no effect anymore! Do you have any idea how to fix it? – askman Apr 20 '16 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.