Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

highlight selected text in emacs (org-mode)

Tags:

emacs

org-mode

I am searching for a way to highlight selected text in Emacs permanently, just like you do with a marker in a PDF for example. I am using org-mode.

I tried searching on Google but was quite surprised that I didn't find anything.

like image 631
user2664856 Avatar asked Nov 16 '13 09:11

user2664856


People also ask

How do I highlight a region in Emacs?

With Emacs 25, simply press Ctrl + Space and then move your cursor wherever you want to highlight/select the region of text which interests you.

How do I change the highlight color in Emacs?

To change the foreground or background color in Emacs through the windowing interface, you can use the menu commands Foreground Color->Other and Background Color->Other in the Edit->Text Properties menu.

How do I enter Org Mode in Emacs?

Emacs does not actually understand you are editing an Org document, yet. To enable Org mode on your current document, type M-x org-mode which will enable the Org mode on the current document.


1 Answers

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

You can re-define the characters for emphasizing via Options->Customize Emacs->Specific Option then input org-emphasis-alist.

That is permanent in the sense that if you save and kill the buffer and reload the file into emacs you have the same high-lighting again.

Another way is to use enriched-mode. Input M-x enriched-mode. If font-lock-mode is not activated you can use stuff like Edit->Text Properties->Face->Bold and the formatting is permanent in the text-file. It is clear that this leaves traces in the text file. You can see these traces if you load the file via M-x find-file-literally.

Note, that for easier formatting in the X11-port (I think also in the win32-port) you can detach the menus by clicking on the broken line on top (see the right side of the following image for two of such detached menus).

font-lock-mode re-fontifies text with rules from parameters like font-lock-keywords automatically and removes all other fontification (these parameters are most often set by the major-mode). Therefore, text properties do not work if font-lock-mode is 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 whether font-lock-mode is active with C-h m. It is active if Font-Lock is listed. Alternatively, you can query C-h v font-lock-mode which is t if font-lock-mode is active. Fontified text in enriched-mode

like image 149
Tobias Avatar answered Sep 21 '22 05:09

Tobias