emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Farblos" <AKFKQU.9DF7RP@vodafonemail.de>
To: emacs-orgmode@gnu.org
Subject: [ENHANCEMENT] Make `org-babel-do-in-edit-buffer' environment detectable
Date: Tue, 07 Mar 2023 13:48:39 +0100	[thread overview]
Message-ID: <9eaf7099554d488d921e64c4b2852a0d@vodafonemail.de> (raw)

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/)




             reply	other threads:[~2023-03-07 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 12:48 Farblos [this message]
2023-03-10 11:01 ` [ENHANCEMENT] Make `org-babel-do-in-edit-buffer' environment detectable Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9eaf7099554d488d921e64c4b2852a0d@vodafonemail.de \
    --to=akfkqu.9df7rp@vodafonemail.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).