* Minor Mode hooks
@ 2024-08-10 9:59 Heime
2024-08-11 11:52 ` Joel Reicher
0 siblings, 1 reply; 2+ messages in thread
From: Heime @ 2024-08-10 9:59 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
Have added a hook to a minor-mode
(defvar tema-minor-mode-hook nil
"Hook that runs when `tema-minor-mode' is enabled.")
(defun tema-activated-message ()
"Function to run when `tema-minor-mode' is enabled."
(message "tema-minor-mode Activated."))
(add-hook 'tema-minor-mode-hook #'tema-activated-message)
(add-hook 'tema-minor-mode-hook #'outline-minor-mode)
(define-minor-mode tema-minor-mode
"Enhances visibility of heading levels and text emphasis."
(if tema-minor-mode
(progn
(run-hooks 'tema-minor-mode-hook)
(outline-minor-mode 1))
(outline-minor-mode 0)))
I want to have outline-minor-mode activated when tema-minor-mode is activated.
Should one do this using tema-minor-mode-hook or using (outline-minor-mode 1)
and (outline-minor-mode 1) by testing the variable tema-minor-mode ?
Where should the add hooks be defined, just anywhere within the file ?
(add-hook 'tema-minor-mode-hook #'tema-activated-message)
(add-hook 'tema-minor-mode-hook #'outline-minor-mode)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Minor Mode hooks
2024-08-10 9:59 Minor Mode hooks Heime
@ 2024-08-11 11:52 ` Joel Reicher
0 siblings, 0 replies; 2+ messages in thread
From: Joel Reicher @ 2024-08-11 11:52 UTC (permalink / raw)
To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor
Heime <heimeborgia@protonmail.com> writes:
> I want to have outline-minor-mode activated when tema-minor-mode
> is activated. Should one do this using tema-minor-mode-hook or
> using (outline-minor-mode 1) and (outline-minor-mode 1) by
> testing the variable tema-minor-mode ?
>
> Where should the add hooks be defined, just anywhere within the
> file ?
Your question doesn't make sense to me, but I might not have
understood it.
Hooks are for users of a mode to do customisations. None of the
mode's own (non-customisable) functionality goes in a hook;
i.e. the author of a mode does not put anything in the hook except
for a default value that users may very well override (including
clearing the hook entirely).
Cheers,
- Joel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-11 11:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-10 9:59 Minor Mode hooks Heime
2024-08-11 11:52 ` Joel Reicher
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.