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

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

Re: Debugger entered--Lisp error: (excessive-lisp-nesting)


From: uzibalqa
Subject: Re: Debugger entered--Lisp error: (excessive-lisp-nesting)
Date: Thu, 08 Jun 2023 11:51:30 +0000

------- Original Message -------
On Thursday, June 8th, 2023 at 8:50 PM, Platon Pronko <platon7pronko@gmail.com> 
wrote:


> On 2023-06-08 15:07, uzibalqa wrote:
> 
> > I am getting the following debugger information but have been unable to 
> > locate the problem.
> > 
> > What can I do ?
> > 
> > Debugger entered--Lisp error: (excessive-lisp-nesting)
> > (cond ((eq arg 'toggle) (not tematika-minor-mode)) ((and (numberp arg) (< 
> > arg 1)) nil) (t t))
> > (setq tematika-minor-mode (cond ((eq arg 'toggle) (not 
> > tematika-minor-mode)) ((and (numberp arg) (< arg 1)) nil) (t t)))
> > (let ((last-message (current-message))) (setq tematika-minor-mode (cond 
> > ((eq arg 'toggle) (not tematika-minor-mode)) ((and (numberp arg) (< arg 1)) 
> > nil) (t t))) (if (boundp 'local-minor-modes) (progn (setq local-minor-modes 
> > (delq 'tematika-minor-mode local-minor-modes)) (if tematika-minor-mode 
> > (progn (setq local-minor-modes (cons 'tematika-minor-mode 
> > local-minor-modes)))))) (if tematika-minor-mode (progn (tematika-tools) 
> > (tematika-addhooks-woutline) (tematika-activate-woutline) (message 
> > "Tematika Activated")) (tematika-activate-woutline) (message "Tematika 
> > Deactivated")) (run-hooks 'tematika-minor-mode-hook (if tematika-minor-mode 
> > 'tematika-minor-mode-on-hook 'tematika-minor-mode-off-hook)) (if 
> > (called-interactively-p 'any) (progn nil (if (and (current-message) (not 
> > (equal last-message (current-message)))) nil (let ((local " in current 
> > buffer")) (message "Tematika minor mode %sabled%s" (if tematika-minor-mode 
> > "en" "dis") local))))))
> > tematika-minor-mode(0)
> > tematika-activate-woutline()
> > (if tematika-minor-mode (progn (tematika-tools) 
> > (tematika-addhooks-woutline) (tematika-activate-woutline) (message 
> > "Tematika Activated")) (tematika-activate-woutline) (message "Tematika 
> > Deactivated"))
> > (let ((last-message (current-message))) (setq tematika-minor-mode (cond 
> > ((eq arg 'toggle) (not tematika-minor-mode)) ((and (numberp arg) (< arg 1)) 
> > nil) (t t))) (if (boundp 'local-minor-modes) (progn (setq local-minor-modes 
> > (delq 'tematika-minor-mode local-minor-modes)) (if tematika-minor-mode 
> > (progn (setq local-minor-modes (cons 'tematika-minor-mode 
> > local-minor-modes)))))) (if tematika-minor-mode (progn (tematika-tools) 
> > (tematika-addhooks-woutline) (tematika-activate-woutline) (message 
> > "Tematika Activated")) (tematika-activate-woutline) (message "Tematika 
> > Deactivated")) (run-hooks 'tematika-minor-mode-hook (if tematika-minor-mode 
> > 'tematika-minor-mode-on-hook 'tematika-minor-mode-off-hook)) (if 
> > (called-interactively-p 'any) (progn nil (if (and (current-message) (not 
> > (equal last-message (current-message)))) nil (let ((local " in current 
> > buffer")) (message "Tematika minor mode %sabled%s" (if tematika-minor-mode 
> > "en" "dis") local))))))
> > tematika-minor-mode(0)
> 
> 
> Looks like you are reaching the recursion limit. Looking at the debugger 
> trace it seems that (tematika-minor-mode) invokes (tematika-minor-mode), 
> which causes infinite recursion. - Platon Pronko


Absolutely right.  Have written a minor mode that provides some customisations 
to outline-minor-mode.
Would like that when tematika-minor-mode is activated, outline-minor-mode gets 
enabled automatically. 

I have the following.  The problem happened because I was calling 
(tematika-activation) within the
definition of tematika-minor-mode, as soon as tematika-minor-mode gets 
activated.

Would you be so kind to show me how I can enable outline-minor-mode when the 
user enables
tematika-minor-mode so as to avoid the infinite recursion problem ?

I also need a way to disable outline-minor-mode when tematika-minor-mode is 
disabled.

(defun tematika-activation ()
  "Activate `tematika-minor-mode' with `outline-minor-mode' in a
buffer-local way."
  (tematika-minor-mode (if outline-minor-mode 1 0)))

;;;###autoload
(define-minor-mode tematika-minor-mode
  "Enhances visibility of heading levels and text emphasis."
  :init-value nil
  :lighter " Tematika"

  (if tematika-minor-mode

      ;; Enable minor mode capability
      (progn (tematika-tools)
             (tematika-hooks-outl)
             ;; (tematika-activation)
             (message "Tematika Activated"))

    ;; [ELSE] Revert the functionality provided by minor mode
    ;; (tematika-activate-woutline)
    (message "Tematika Deactivated")) )









reply via email to

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