I wan't to be able to programmatically open a file in org mode and scroll to a specific header. the file is quite big, so opening the file at a certain place is qhat I am looking for.
Any idea how to do that from the terminal via Bash?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityPerhaps something along the following lines:
emacs -Q --eval='(progn (find-file "/path/to/file") (goto-char (org-find-exact-headline-in-buffer "org-headline")))'
-Q
though: it depends on whether one wants to do something quick and exit, in which case the -Q
is useful, since it avoids the potentially long user initialization; or whether one wants to continue working in that emacs session, in which case the user initialization, although long, is useful and amortized over the life of the session. If there is an emacs server running, the emacsclient
invocation of the above might be even more useful.
If you have an ID associated with the headline that you are looking for, you could go directly to that headline using org-protocol, as described here: