help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Minor Mode hooks


From: Heime
Subject: Minor Mode hooks
Date: Sat, 10 Aug 2024 09:59:56 +0000

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)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]