[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] Prompted to submit (unsure what happened) [9.5.2 (9.5.2-g07252
From: |
Ihor Radchenko |
Subject: |
Re: [BUG] Prompted to submit (unsure what happened) [9.5.2 (9.5.2-g072523 @ /Users/apc/.emacs.d/straight/build/org/)] |
Date: |
Sat, 26 Feb 2022 15:23:55 +0800 |
Alejandro Pérez Carballo <apcarballo@gmail.com> writes:
> One more question: wouldn't replacing `org-in-src-block-p' with a function
> that calls `org-in-src-block-p' only when in org-mode and returns `nil'
> elsewhere suffice to make something that's like `org-in-src-block-p' but that
> will work outside org-mode? E.g.:
>
> (defun my/org-in-src-block-p (&optional arg)
> (if (derived-mode-p 'org-mode)
> (org-in-src-block-p)
> nil))
>From the docstring of electric-quote-inhibit-functions, a function
returning nil will have no effect. So, you should be safe to use your
function.
A slightly more concise version would be using when instead of if.
Also, unused function arguments are defined as "_" by convention.
Adding a docstring to all your function is a good habit to cultivate.
(defun my/org-in-src-block-p (&optional _)
"Call `org-in-src-block-p' when in `org-mode' and return nil otherwise."
(when (derived-mode-p 'org-mode)
(org-in-src-block-p)))
Best,
Ihor