From: Tassilo Horn <tsdh@gnu.org>
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:07:23 +0100 [thread overview]
Message-ID: <878qsypnpw.fsf@gnu.org> (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")
Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes:
> A mistake. I am referring to require.
>
> For instance, this will call require everytime the function is called
> interactively. Should one call the require only once and avoid an
> interactive function from calling a require command each time?
>
> (defun feruler ()
> (interactive)
>
> (require 'ruler-mode)
> (set-face-attribute 'ruler-mode-current-column nil
> :background "#ff4500" :foreground "#ffffff"))
That's no problem, nothing will happen if it's already loaded (as
indicated by the `require' docs). It can be suitable in cases where
your program/mode usually doesn't use ruler-mode but only this or some
interactive commands like feruler use it. In that case, ruler-mode is
only loaded when it's actually used/needed.
Bye,
Tassilo
next prev parent reply other threads:[~2024-12-02 7:07 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 [this message]
2024-12-02 7:50 ` mbork
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=878qsypnpw.fsf@gnu.org \
--to=tsdh@gnu.org \
--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.
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.