From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Hooks in minor modes
Date: Fri, 30 Apr 2021 01:17:21 -0400 [thread overview]
Message-ID: <jwvmttgbbj1.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: trinity-19c03ca0-3e44-4cc1-b3f1-d2206dc8354c-1619755939523@3c-app-mailcom-bs05
> That would mean that simply calling
>
> (require 'my-minor-mode)
>
> would not automatically activate the functionality provided by
> 'my-minor-mode',
Of course not.
> unless the user specifically calls another function called
> 'activate-my-minor-mode'.
Don't `require`, just call the function *instead*.
BTW, the activation function is the minor mode function, so to
activate a global minor mode, just add the following in your .emacs:
(my-minor-mode 1)
or alternatively activate it via Custom.
No need for a separate `activate-my-minor-mode`.
> Quite suitable for new users because they can simply call just
> the following two commands.
>
> (require 'my-minor-mode)
> (activate-my-minor-mode)
No, just
(my-minor-mode 1)
If the package is properly installed (e.g. via `M-x package-install`),
the function should be marked as autoloaded (if not, send a bug report
to the package maintainer), so you don't need to `require` before
calling the function.
Stefan
next prev parent reply other threads:[~2021-04-30 5:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 23:33 Hooks in minor modes steve-humphreys
2021-04-29 23:43 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 3:31 ` Stefan Monnier
2021-04-30 4:12 ` steve-humphreys
2021-04-30 4:33 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 4:43 ` require (was: Re: Hooks in minor modes) Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 5:03 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 5:44 ` Jean Louis
2021-04-30 21:53 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 23:16 ` Jean Louis
2021-05-01 0:26 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01 5:49 ` Jean Louis
2021-05-01 6:09 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01 9:23 ` Jean Louis
2021-05-04 2:29 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-04 5:40 ` Yuri Khan
2021-05-04 6:02 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 17:27 ` FW: [External] : " Drew Adams
2021-04-30 22:17 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-01 0:36 ` FW: " Drew Adams
2021-05-01 0:51 ` Drew Adams
2021-05-01 0:49 ` FW: " Drew Adams
2021-05-01 0:53 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-30 5:17 ` Stefan Monnier [this message]
2021-04-30 5:32 ` Hooks in minor modes Emanuel Berg via Users list for the GNU Emacs text editor
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=jwvmttgbbj1.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=help-gnu-emacs@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 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.