Given: Linux Mint 20.2, Emacs 27.2
Q: E.g. "Hello, how are you?" Suppose whole sentence has foreground color = white.
And I want to change color (e.g to red) of only word "Hello".
A: There is a general way of highlighting a word or regular expression using any face you want.
Try M-x highlight-regexp (bound to M-s h r). It prompts you for the text to highlight and
then it gives you the option to pick any face you want to use. To get a list of all faces,
use M-x list-faces-display. Once you have highlighted all occurrences of a word,
you can remove the highlights with M-x unhighlight-regexp (bound to M-s h u).
Here result:
Q: Yes, but M-x highlight-regexp is highlighting word "Hello" in the whole text. E.g. if word "Hello" occur 3 times in the whole buffer it will be highlighting. But I need to highlighting only one word "Hello" exact on the sentence "Hello, how are you?" after Here result:. Is it possible on org mode?
P.S. The ideal scenario is to select some region and highlighting only it
query-replace
: a). Mark region, b). M-% to callquery-replace
, c) Choose/write "Query replacing Hello with Hello" <RET>, d) See Hello highlighted in the region (with the replacement artifacts of course :)