all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: uzibalqa <uzibalqa@proton.me>
Cc: uzibalqa via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Using called-interactively-p
Date: Wed, 05 Jul 2023 17:25:18 +0200	[thread overview]
Message-ID: <87edlmjs81.fsf@mbork.pl> (raw)
In-Reply-To: <29YK7UN09CUBpmLBkjgZA21rkeTkTHa4vOBXFHEVZY-ehxjVNH0arkYgYEMNnng_ymDzv0bRr7O5u415Vgm4LT4cIbURmyxMXstXuiVPzo8=@proton.me>


On 2023-07-05, at 15:35, uzibalqa <uzibalqa@proton.me> wrote:

> I have the following function that executes the command (do-this) when
> the function skatpad is called interactively by the user, but executes 
> (do-that) if the function is called from elisp code.
>
> The documentation suggests to use "called-interactively-p" instead of
> (interactive-p).
>
> Looking at the documentation, it is not quite clear whether KIND should be
> a symbol or a string.  This problem of distinguishing between a symbol and
> a string, is something that occurs frequently in the documentation.  A source
> of constant deliberation for me.

I would definitely bet on symbol.  Using strings for things like this
seems highly unusual for me (in Elisp, as opposed to e.g. JavaScript).

OTOH, you can check if you want to (do-this) or (do-that) using a simple
trick with an optional parameter -- see
https://www.gnu.org/software/emacs/manual/html_node/elisp/Distinguish-Interactive.html

Hth,

-- 
Marcin Borkowski
http://mbork.pl



  reply	other threads:[~2023-07-05 15:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 13:35 Using called-interactively-p uzibalqa
2023-07-05 15:25 ` Marcin Borkowski [this message]
2023-07-05 15:40   ` uzibalqa
2023-07-05 20:26     ` Emanuel Berg
2023-07-06 18:55     ` Marcin Borkowski
2023-07-06 21:36       ` Emanuel Berg
2023-07-05 17:52   ` Emanuel Berg

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

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

  git send-email \
    --in-reply-to=87edlmjs81.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=help-gnu-emacs@gnu.org \
    --cc=uzibalqa@proton.me \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.