Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make inline comments in Org-mode?

In Org-mode there are several ways to make comments. But I do not know of any way to make inline comments. According to the manual

regions surrounded by ‘#+BEGIN_COMMENT’ ... ‘#+END_COMMENT’ will not be exported.

But this is only true if the said region starts a line.

In the following

#+TITLE: Test

text #+BEGIN_COMMENT comment 1 #+END_COMMENT text

text
#+BEGIN_COMMENT comment 2 #+END_COMMENT text

only comment 2 is treated as a comment. It exports (e.g. C-e A) as

text #+BEGIN_COMMENT comment 1 #+END_COMMENT text

text

Also, org-toggle-comment does not work for making inline comments by using it on regions and comment-region does not even create a comment.

So, how can I make inline comments in Org-mode?

like image 720
N.N. Avatar asked Feb 09 '12 14:02

N.N.


1 Answers

Jonathan Leech-Pepin's comment on your question on \printbibliography gave me an idea. You can use a macro for inline comments. Note that you need trailing space after the comment definition.

#+macro: comment  

...

{{{comment(here is a comment)}}}

EDIT: Since this is supposed to be a macro odd input may screw things up. I'm a little surprised that

{{{comment(here is a)}} comment)}}}

works for me, although

{{{comment(here is a comment) more}}}

does not. I would assume that anything other than fairly simple text would be fairly fragile if they decide to change the way they parse macros in the future.

like image 66
Ivan Andrus Avatar answered Oct 07 '22 00:10

Ivan Andrus