unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: mbork@mbork.pl
To: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Cc: Zhengyi Fu <i@fuzy.me>,  Heime <heimeborgia@protonmail.com>
Subject: Re: include clause in interactive command
Date: Mon, 02 Dec 2024 08:50:56 +0100	[thread overview]
Message-ID: <878qsyed5r.fsf@mbork.pl> (raw)
In-Reply-To: <APJcA5Axt2EU80eeCdWSkJGz6kraC1Ah3fj-rlShYFmQ6w7N0e6jMVoQIkxEzlx-ugL8tGqpwsXrJvOZbD1QrQfJdLGz_C3hO2M9FihTmNc=@protonmail.com> (Heime via Users list for the's message of "Sun, 01 Dec 2024 12:00:16 +0000")

On 2024-12-01, at 12:00, Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Sent with Proton Mail secure email.
>
> On Sunday, December 1st, 2024 at 4:42 PM, Zhengyi Fu <i@fuzy.me> wrote:
>
>> On 2024-11-30 19:38, Heime via Users list for the GNU Emacs text editor
>> wrote:
>> 
>> > I have an interactive function that changes some buffer settings.
>> > But it also has an include clause (include 'orellana).
>> > 
>> > Would one usually recommend calling it only once, or calling it
>> > everytime a user uses the function is ok?
>> 
>> 
>> What is an “include clause”?
>
> A mistake.  I am referring to require.

Per the manual:

--8<---------------cut here---------------start------------->8---
This function checks whether FEATURE is present in the current
Emacs session (using ‘(featurep FEATURE)’; see below).  The
argument FEATURE must be a symbol.
--8<---------------cut here---------------end--------------->8---

(https://www.gnu.org/software/emacs/manual/html_node/elisp/Named-Features.html)

So, there should be very little penalty to calling `require' in your
command (especially that it is coded in C, not Elisp).

OTOH, it might be not necessary.  If what you need from the required
library has the `autoload' cookie
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Autoload.html),
the library will be loaded automatically the first time you use the
autoloaded function.

Hth,

-- 
Marcin Borkowski
https://mbork.pl
https://crimsonelevendelightpetrichor.net/



      parent reply	other threads:[~2024-12-02  7:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-30 11:38 include clause in interactive command Heime via Users list for the GNU Emacs text editor
2024-12-01  4:42 ` Zhengyi Fu
2024-12-01 12:00   ` Heime via Users list for the GNU Emacs text editor
2024-12-02  7:07     ` Tassilo Horn
2024-12-02  7:50     ` mbork [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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=878qsyed5r.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=i@fuzy.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.
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).