emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: "Alejandro Pérez Carballo" <apcarballo@gmail.com>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87o82u2ir8.fsf@localhost> (raw)
In-Reply-To: <B2087B46-0ACD-48FA-9F47-D05820AA2A0B@gmail.com>

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


      reply	other threads:[~2022-02-26  7:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 20:55 [BUG] Prompted to submit (unsure what happened) [9.5.2 (9.5.2-g072523 @ /Users/apc/.emacs.d/straight/build/org/)] Alejandro Pérez Carballo
2022-02-23  5:06 ` Ihor Radchenko
2022-02-24  1:52   ` Alejandro Pérez Carballo
2022-02-24 13:39     ` Ihor Radchenko
2022-02-24 19:27       ` Alejandro Pérez Carballo
2022-02-24 22:48         ` Alejandro Pérez Carballo
2022-02-26  7:23           ` Ihor Radchenko [this message]

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=87o82u2ir8.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=apcarballo@gmail.com \
    --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).