As you grow accustomed to fine-tuning your Emacs experience, it’s not unusual to
start using local variables in your files. These are specified as comment lines
at the end of the file, and are extremely practical in a number of scenarios. Here’s
a very simple org file.
The only problem is that org-mode thinks that everything after a headline is
part of its contents, which is clearly not the case here. One example where this
is bad is when you want to shuffle the headlines around with M-↓ or M-↑, and
you end up with something like this.
I asked about that on Emacs.StackExchange and got a very simple solution: just
add a “dummy” level-1 headline before the local variable specification.
Now you can move, archive, and refile all your headlines as you wish, without
fear of destroying your precious variables. You can even fine-tune the
visibility to folded, so that the footer is always folded, and you won’t have
to see those variables at all.
But this wouldn’t be our weekly Endless Parentheses if I didn’t give you some
code to practice your elisp. The following command is just like end-of-buffer,
except it places point before the footer. If invoked again, it will move to the
real end of buffer.
Org-mode subtrees and file-local variables
01 Sep 2015, by Artur Malabarba.As you grow accustomed to fine-tuning your Emacs experience, it’s not unusual to start using local variables in your files. These are specified as comment lines at the end of the file, and are extremely practical in a number of scenarios. Here’s a very simple org file.
The only problem is that
org-mode
thinks that everything after a headline is part of its contents, which is clearly not the case here. One example where this is bad is when you want to shuffle the headlines around with M-↓ or M-↑, and you end up with something like this.I asked about that on Emacs.StackExchange and got a very simple solution: just add a “dummy” level-1 headline before the local variable specification.
Now you can move, archive, and refile all your headlines as you wish, without fear of destroying your precious variables. You can even fine-tune the visibility to
folded
, so that the footer is always folded, and you won’t have to see those variables at all.But this wouldn’t be our weekly Endless Parentheses if I didn’t give you some code to practice your elisp. The following command is just like
end-of-buffer
, except it places point before the footer. If invoked again, it will move to the real end of buffer.Tags: org-mode, init.el, emacs,
Nameless, less is more »
« Making Ispell work with org-mode
Related Posts
Define context-aware keys in Emacs in org-mode
Changing the org-mode ellipsis in org-mode
Better time-stamps in org-export in org-mode
Content © 2019, All rights reserved. Icons under CC3.0.