[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Functions which are mode dependent
From: |
Heime |
Subject: |
Functions which are mode dependent |
Date: |
Sun, 18 Aug 2024 21:14:51 +0000 |
I need some help understanding how to automatically enable some functionality
when loading a file with some major mode.
For instance I have a function that sets
(defun expr-elisp ()
(setq imenu-generic-expression
`( ("defun" ,(concat "^\\s-*"
"(\\(defun\\|define-minor-mode\\)\\s-+"
"\\(\\(\\sw\\|\\s_\\)+\\)") 2) )) )
(defun expr-selector ()
(cond
((eq major-mode 'emacs-lisp-mode) (expr-elisp))
(t (expr-generic)) ))
I have put the code above in a minor mode.
;;;###autoload
(define-minor-mode tema-minor-mode
(if tema-minor-mode
(expr-selector)
(message "Tema Deactivated")))
with hooks to load the minor mode automatically for specific major modes.
(add-hook emacs-lisp-mode-hook #'tema-minor-mode)
- Functions which are mode dependent,
Heime <=