emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [ENHANCEMENT] Make `org-babel-do-in-edit-buffer' environment detectable
@ 2023-03-07 12:48 Farblos
  2023-03-10 11:01 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Farblos @ 2023-03-07 12:48 UTC (permalink / raw)
  To: emacs-orgmode

Concrete use case: I got fed up by sh-mode notifying me about "Indentation setup for shell type bla" when editing shell source blocks in an Org buffer.  (To reproduce, start "emacs -Q", open an empty org file, create a shell source block with contents "  echo foo", and press TAB on that line.)

So I wanted to advice `sh-set-shell' to surpress all messages, *but only* when called from macro `org-babel-do-in-edit-buffer'. To detect that, I resorted to variable `org-inhibit-startup', but that is not really intended for that purpose.

For this and similar use cases (run/do not run some major mode hook only in Org source environment), it would be helpful to have a documented dynamic variable (`org-in-babel-environment'?) set by `org-babel-do-in-edit-buffer' or the like that one could query as 

  (when (and (boundp 'org-in-babel-environment) org-in-babel-environment)
    ;; do org-specific stuff)

Emacs  : GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)
 of 2023-01-18, modified by Debian
Package: Org mode version 9.5.2 (9.5.2 @ /usr/share/emacs/site-lisp/elpa/org-9.5.2/)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-10 11:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07 12:48 [ENHANCEMENT] Make `org-babel-do-in-edit-buffer' environment detectable Farblos
2023-03-10 11:01 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).