[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: debugging "Lisp nesting exceeds max-lisp-eval-dept" error??
From: |
Stefan Monnier |
Subject: |
Re: debugging "Lisp nesting exceeds max-lisp-eval-dept" error?? |
Date: |
Thu, 01 Sep 2005 09:29:57 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> lazy-lock works OK. The OP's problem has to do with some details of
> how he turns it on.
> So, can we fix the mechanism for turning it on, so that customary ways
> of doing so will once again work ok?
Sure. The infinite-lopping is the following:
-> (font-lock-mode 1)
-> (when (or noninteractive (eq (aref (buffer-name) 0) ?\ ))
(setq font-lock-mode nil))
...
(run-hooks 'font-lock-mode 'font-lock-mode-off)
-> (turn-on-lazy-lock)
-> (lazy-lock-mode 1)
-> (if (not font-lock-mode) (font-lock-mode 1))
-> (font-lock-mode 1)
-> (when (or noninteractive (eq (aref (buffer-name) 0) ?\ ))
(setq font-lock-mode nil))
...
(run-hooks 'font-lock-mode 'font-lock-mode-off)
-> (turn-on-lazy-lock)
-> ...
So we can either change font-lock-mode so that calling (font-lock-mode 1)
always sets font-lock-mode to a non-nil value, as it should.
Or we can change lazy-lock-mode so it doesn't call font-lock-mode.
I think we should make both changes.
As mentioned, I'd also happily remove turn-on-lazy-lock.
All the above also applies to fast-lock.el.
Stefan
--- orig/lisp/font-core.el
+++ mod/lisp/font-core.el
@@ -150,11 +150,12 @@
your own function which is called when `font-lock-mode' is toggled via
`font-lock-function'. "
:group 'font-lock
- ;; Don't turn on Font Lock mode if we don't have a display (we're running a
- ;; batch job) or if the buffer is invisible (the name starts with a space).
- (when (or noninteractive (eq (aref (buffer-name) 0) ?\ ))
- (setq font-lock-mode nil))
- (funcall font-lock-function font-lock-mode)
+ (funcall font-lock-function
+ ;; Don't turn on Font Lock mode if we don't have a display (we're
+ ;; running a batch job) or if the buffer is invisible (the name
+ ;; starts with a space).
+ (and (not (or noninteractive (eq (aref (buffer-name) 0) ?\ )))
+ font-lock-mode))
;; Arrange to unfontify this buffer if we change major mode later.
(if font-lock-mode
(add-hook 'change-major-mode-hook 'font-lock-change-mode nil t)
--- lazy-lock.el 22 aoĆ» 2005 10:23:23 -0400 1.4
+++ lazy-lock.el 01 sep 2005 09:26:26 -0400
@@ -522,8 +526,8 @@
(if arg (> (prefix-numeric-value arg) 0) (not was-on)))))
(cond ((and now-on (not font-lock-mode))
;; Turned on `lazy-lock-mode' rather than `font-lock-mode'.
- (let ((font-lock-support-mode 'lazy-lock-mode))
- (font-lock-mode t)))
+ (message "Use font-lock-support-mode rather than calling
lazy-lock-mode")
+ (sit-for 2))
(now-on
;; Turn ourselves on.
(set (make-local-variable 'lazy-lock-mode) t)