Highlight selected text in emacs (org-mode)

I'm looking for a way to highlight selected text in Emacs forever, just like you do with marker in a PDF file. I am using org-mode.

I tried a search on Google, but was very surprised that I did not find anything.

+6
source share
2 answers

In org-mode, you can use *word* to get the word in bold, /word/ to get the word in italics and _word_ to emphasize the word.

You can override the characters to highlight with Options->Customize Emacs->Specific Option , then enter org-emphasis-alist .

This is constant in the sense that if you save and destroy the buffer and reload the file in emacs, you will again get the same high lighting.

Another way is to use rich mode. Enter Mx enriched-mode . If font-lock-mode not active, you can use material like Edit->Text Properties->Face->Bold , and formatting is constant in the text file. It is clear that this leaves traces in a text file. You can see these traces if you upload the file via Mx find-file-literally .

Please note that to simplify formatting in the X11 port (I think also in the win32 port), you can disconnect the menu by clicking on the broken line at the top (see the right side of the following image for two such separate menus).

font-lock-mode automatically redraws the text with rules from parameters such as font-lock-keywords , and deletes all other fonts (these parameters are most often set by the main mode). Therefore, the text properties do not work if font-lock-mode activated. org-mode uses font-lock-mode , and text properties from Edit->Text Properties->Face->Bold cannot be used with org-mode (the corresponding menu items are deactivated). You can check if font-lock-mode active with Ch m . It is active if Font-Lock is specified. Alternatively, you can request Ch v font-lock-mode , which is t if font-lock-mode active. Fontified text in enriched-mode

+12
source

You can use some commands from hi-lock-mode :

  • highlight-regexp prompt you to highlight the regular expression and color (there are several combinations of background and foreground).
  • highlight-lines-matching-regexp does what it means
  • you can enable or disable it using hi-lock-mode

and you can permanently save them with hi-lock-write-interactive-patterns ( Ms hw ). Emacs will write a little lisp in the comments in your buffer.

See more tricks here: https://www.gnu.org/software/emacs/manual/html_node/emacs/Highlight-Interactively.html

http://www.masteringemacs.org/articles/2010/10/13/highlighting-by-word-line-regexp/

Enjoy it!

+3
source

Source: https://habr.com/ru/post/958190/


All Articles