emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] startup hook: How do I detect if the current buffer has been ope


From: Ihor Radchenko
Subject: Re: [Q] startup hook: How do I detect if the current buffer has been opened programmatically?
Date: Tue, 09 Apr 2024 14:24:37 +0000

Rudi C <rudiwillalwaysloveyou@gmail.com> writes:

> Org-mode occasionally opens files automatically, for instance, when
> inserting or opening ID links, or during certain searches. I need to
> determine if a buffer was opened programmatically or manually by the user
> within the startup hooks. This distinction is important because, e.g., I
> want to automatically preview all LaTeX fragments if the buffer was opened
> by the user, but not if it was opened programmatically.

AFAIK, there is no reliable way to do this.
You may play around with `find-file-hook'. See `org-with-file-buffer'
macro in org-macs.el (on main).

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]