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.
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.
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.
You can use some commands from hi-lock-mode
:
highlight-regexp
will ask you for a regexp to highlight and a color (there are some combinations of background and foreground)highlight-lines-matching-regexp
does what it meanshi-lock-mode
and you can permanently save them with hi-lock-write-interactive-patterns
(M-s h w
). Emacs will write a bit of lisp in a commented line 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 !
in the end its about providing information, itsn't it? and i think this question and especially the answers are useful to the community :) – user2664856 Nov 16 '13 at 09:27