0

Have written a minor mode that resets outline-regexp, and outline-heading-alist and adds additional keybindings for showing and hiding outline levels.

To get the corresponding major mode -map variables I include the corresponding features where the map variables are defined.

The difficulty in whether to use

(add-hook 'outline-minor-mode-hook 'tika-minor-mode nil t)

or enable outline-minor-mode within define-minor-mode

or perform both.

But I am getting an annoying error, namely

Debugger entered--Lisp error: (excessive-lisp-nesting)
  (cons 'tika-minor-mode local-minor-modes)
  (setq local-minor-modes (cons 'tika-minor-mode local-minor-modes))

I want that when an elisp file is loaded, tika-minor-mode and outline-minor-mode are enabled by default.

Where should such a call be placed in my minor made ?

Here is my implementation

(require 'emacs-lisp)  ; for emacs-lisp-mode-map

(defun tika-tools ()
   (add-hook 'outline-minor-mode-hook 'tika-minor-mode nil t))

;;;###autoload
(define-minor-mode tika-minor-mode
  (if tika-minor-mode
      (progn (outline-minor-mode 0)
             (tika-tools)
             (outline-minor-mode 1))
    (outline-minor-mode 0)) )

(defun tika-addhook ()
  "Activate minor-mode' automatically for specific major-modes."
  (add-hook 'emacs-lisp-mode-hook #'tika-minor-mode))

(provide 'tika)
5
  • Does this answer your question? Encountering void-variable sh-mode-map for define-key
    – Drew
    Commented Jun 25, 2023 at 19:34
  • This is already answered. You only need to require the library explicitly if you want both (1) the bindings it defines and (2) additional bindings that you provide. To add to existing bindings, those bindings need to exist!
    – Drew
    Commented Jun 25, 2023 at 19:35
  • 1. Get rid of all extraneous code from the question. Include nothing that's not used and nothing that's not needed to repro the error. 2. Define everything needed to repro the error. This includes getting the names right - e.g., change tematika to tika everywhere. 3. Show more of the backtrace.
    – Drew
    Commented Jun 25, 2023 at 22:51
  • A current hesitation is where to put the call to (add-hook 'outline-minor-mode-hook 'tika-minor-mode nil t) if at all needed.
    – Dilna
    Commented Jun 26, 2023 at 13:36
  • Hi @Dilna, it's unclear what problem you're trying to solve, here. You ask about hooks, minor modes, an elisp error, and making sure that two minor modes are enabled when you open an elisp file. Are any of these four questions the one you want an answer to here? Or can you reframe all of this into a single question that encompasses your needs?
    – Trevoke
    Commented Jul 15, 2023 at 1:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.