I apologize for the long delay. I came home from vacation only to get
buried under a huge pile of stuff to do. I'm finally surfacing for a
little air and bit of XEmacs fun....
And sorry for not adding "CC Mode" to the subject. I thought this was
purely a lazy-lock problem. It might turn out to be just that
yet.....
On Sun, Aug 24, 2014 at 8:25 AM, Alan Mackenzie <acm(a)muc.de> wrote:
If you have just typed a '}', why is it correct that the BEG
and END
arguments are equal? Surely they should differ by 1, or even more if
you've got auto-newline enabled for '}'.
I don't know the answer to this question. Perhaps that is not correct.
I think the bug here may be rather that font-lock-mode-hook is not
being
invoked when lazy-lock is active. CC Mode installs
c-after-font-lock-init on font-lock-mode-hook; that function ensures that
c-after-change comes first in after-change-functions.
If I add a (message) call to c-after-font-lock-init, I see it being
called when I visit a new C file. But then the functions on
after-change-functions are in the wrong order, so somehow the
lazy-lock code is running too late, I guess.
Incidentally, I've had problems setting up my XEmacs to use
lazy-lock -
it's not well documented. In my init.el I've got
(require 'font-lock)
, which automatically sets font-lock-auto-fontify, and
(setq font-lock-support-mode 'lazy-lock-mode)
, which ought to cause lazy-lock to be enabled when a file is loaded into
a buffer. It doesn't - after-change-functions contains
font-lock-after-change-function, not the lazy one. What am I doing
wrong, here?
Try removing both of those, and adding (turn-on-font-lock). That's
what I've got.
Incidentally2, when I reinitialise C Mode (with M-x c-mode), font
lock
gets turned off for that buffer. I think it's XEmacs doing this, not CC
Mode. Is this intentional? It feels wrong.
That doesn't happen for me, but then again, I've got the
(turn-on-font-lock) form in my init.el.
This patch fixes the issue for me.
diff -r e24f8c81c991 xemacs-packages/edit-utils/ChangeLog
--- a/xemacs-packages/edit-utils/ChangeLog Fri May 30 14:33:15 2014 +0200
+++ b/xemacs-packages/edit-utils/ChangeLog Tue Sep 23 21:46:59 2014 -0600
@@ -1,3 +1,12 @@
+2014-09-23 Jerry James <james(a)xemacs.org>
+
+ * lazy-lock.el (lazy-lock-install-hooks): Append, rather than
+ prepend, lazy-lock-after-change to after-change-functions.
+ (lazy-lock-unstall): Ditto for font-lock-after-change-function.
+ * lazy-shot.el (lazy-shot-install): Ditto for
+ lazy-shot-after-change-function.
+ (lazy-shot-unstall): Ditto for font-lock-after-change-function.
+
2014-05-26 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 2.55 released.
diff -r e24f8c81c991 xemacs-packages/edit-utils/lazy-lock.el
--- a/xemacs-packages/edit-utils/lazy-lock.el Fri May 30 14:33:15 2014 +0200
+++ b/xemacs-packages/edit-utils/lazy-lock.el Tue Sep 23 21:46:59 2014 -0600
@@ -571,7 +571,7 @@
;; Replace Font Lock mode hook.
(make-local-hook 'after-change-functions)
(remove-hook 'after-change-functions 'font-lock-after-change-function t)
- (add-hook 'after-change-functions 'lazy-lock-after-change nil t)
+ (add-hook 'after-change-functions 'lazy-lock-after-change t t)
;; FSF 21.2: Lots and lots of hooks here. Hooks for `outline', hooks for
;; `hideshow', hooks for redisplay-end-triggers, window-size-changed, and
@@ -616,7 +616,7 @@
(save-restriction
(widen)
(lazy-lock-fontify-region (point-min) (point-max))))))
- (add-hook 'after-change-functions 'font-lock-after-change-function nil t))
+ (add-hook 'after-change-functions 'font-lock-after-change-function t t))
;;
;; Remove the text properties.
(lazy-lock-after-unfontify-buffer)
diff -r e24f8c81c991 xemacs-packages/edit-utils/lazy-shot.el
--- a/xemacs-packages/edit-utils/lazy-shot.el Fri May 30 14:33:15 2014 +0200
+++ b/xemacs-packages/edit-utils/lazy-shot.el Tue Sep 23 21:46:59 2014 -0600
@@ -298,7 +298,7 @@
;; entire changed area.
(remove-hook 'after-change-functions 'font-lock-after-change-function t)
(make-local-hook 'after-change-functions)
- (add-hook 'after-change-functions 'lazy-shot-after-change-function nil t))
+ (add-hook 'after-change-functions 'lazy-shot-after-change-function t t))
;; Kludge needed untill lazy-lock-fontify-region is more intelligent
(defun lazy-shot-unstall-after-fontify ()
@@ -319,8 +319,7 @@
(lazy-shot-fontify-region (point-min) (point-max))))
(remove-hook 'after-change-functions 'lazy-shot-after-change-function t)
(if font-lock-mode
- (add-hook 'after-change-functions 'font-lock-after-change-function
- nil t)))
+ (add-hook 'after-change-functions 'font-lock-after-change-function t t)))
(provide 'lazy-shot)
--
Jerry James
http://www.jamezone.org/
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta