2

I use emacs org-mode and find feature of source code blocks extremely useful. However, If I want to say highlight a couple of lines in my source code block, is it possible to achieve? e.g.

#+BEGIN_SRC java
int i = 0;
m() //this is new call
#+END_SRC

Here when I export my org-mode to HTML or some other format, I want

m() //this is new call

to stand out. The intention is convey your message as clearly as possible.

1
  • 1
    Just for completeness, you forgot to add the programming language
    – Dox
    Jan 26, 2017 at 15:31

1 Answer 1

1

One option for highlighting (not specific to org-mode) would be the built in hi-lock commands. You can use commands interactively to highlight a line or phrase matching a pattern, then save those patterns in the file for future use.

For example:

  • M-s h l this is a new call to highlight the line

  • M-s h w to write the current hi-lock patterns to the file

If you close and then re-open the file, you can run M-x hi-lock-mode and have the option to read the patterns from the file and re-apply them. If you always want this you can set up an org-mode hook to enable hi-lock.

See Highlight Interactively in the Emacs manual for details.

2
  • I am not sure if I do an org-export, it will display the highlighting there also. Jan 26, 2017 at 15:55
  • Ah - no, this approach is only useful in Emacs. If you need to export the highlight then you will need some org-specific approach, not sure what is possible there.
    – glucas
    Jan 26, 2017 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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