Alejandro Pérez Carballo <apcarba...@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