all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Debugger entered--Lisp error: (excessive-lisp-nesting)
@ 2023-06-08  7:07 uzibalqa
  2023-06-08  8:50 ` Platon Pronko
  0 siblings, 1 reply; 4+ messages in thread
From: uzibalqa @ 2023-06-08  7:07 UTC (permalink / raw)
  To: uzibalqa via Users list for the GNU Emacs text editor

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)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugger entered--Lisp error: (excessive-lisp-nesting)
  2023-06-08  7:07 Debugger entered--Lisp error: (excessive-lisp-nesting) uzibalqa
@ 2023-06-08  8:50 ` Platon Pronko
  2023-06-08 11:51   ` uzibalqa
  0 siblings, 1 reply; 4+ messages in thread
From: Platon Pronko @ 2023-06-08  8:50 UTC (permalink / raw)
  To: uzibalqa, uzibalqa via Users list for the GNU Emacs text editor

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-messag
 e (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-messag
 e (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.

-- 
Best regards,
Platon Pronko
PGP 2A62D77A7A2CB94E




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugger entered--Lisp error: (excessive-lisp-nesting)
  2023-06-08  8:50 ` Platon Pronko
@ 2023-06-08 11:51   ` uzibalqa
  2023-06-09  6:38     ` Platon Pronko
  0 siblings, 1 reply; 4+ messages in thread
From: uzibalqa @ 2023-06-08 11:51 UTC (permalink / raw)
  To: Platon Pronko; +Cc: uzibalqa via Users list for the GNU Emacs text editor


------- 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")) )









^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debugger entered--Lisp error: (excessive-lisp-nesting)
  2023-06-08 11:51   ` uzibalqa
@ 2023-06-09  6:38     ` Platon Pronko
  0 siblings, 0 replies; 4+ messages in thread
From: Platon Pronko @ 2023-06-09  6:38 UTC (permalink / raw)
  To: uzibalqa; +Cc: uzibalqa via Users list for the GNU Emacs text editor

On 2023-06-08 19:51, uzibalqa wrote:
> 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.

Here's a way to do it using hooks:

(define-minor-mode tematika-minor-mode "activates outline-minor-mode" :lighter " Tematika")

(defun tematika--toggle-outline-mode ()
   (if tematika-minor-mode
       (outline-minor-mode)
     (outline-minor-mode -1)))
(add-hook 'tematika-minor-mode-hook 'tematika--toggle-outline-mode)

-- 
Best regards,
Platon Pronko
PGP 2A62D77A7A2CB94E




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-09  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-08  7:07 Debugger entered--Lisp error: (excessive-lisp-nesting) uzibalqa
2023-06-08  8:50 ` Platon Pronko
2023-06-08 11:51   ` uzibalqa
2023-06-09  6:38     ` Platon Pronko

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.