[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: include clause in interactive command
From: |
Tassilo Horn |
Subject: |
Re: include clause in interactive command |
Date: |
Mon, 02 Dec 2024 08:07:23 +0100 |
User-agent: |
mu4e 1.12.7; emacs 31.0.50 |
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