comparison lisp/font-lock.el @ 664:6e99cc8c6ca5

[xemacs-hg @ 2001-09-18 05:04:26 by ben] fileio.c: Fix various C++ compile errors in Andy's recent code. callint.c, editfns.c, emacs.c, lread.c, redisplay-x.c: Fix sign-compare warnings. scrollbar-msw.c: Fix crash under MS Windows. See comment around line 223 for explanation. font-lock.el: fix problem when you insert a comment on the line before a line of code: if we use the following char, then when you hit backspace, the following line of code turns the comment color. configure.in: Don't use -Wshadow when compiling with g++ or you get buried in silly warnings. This patch was already applied but somehow got unapplied. Stephen?
author ben
date Tue, 18 Sep 2001 05:06:57 +0000
parents e62e90435c57
children 12095b04a9b6
comparison
equal deleted inserted replaced
663:ebdebdbf3f84 664:6e99cc8c6ca5
1201 ;;; This function could easily be adapted to other after-change-functions. 1201 ;;; This function could easily be adapted to other after-change-functions.
1202 1202
1203 (defun font-lock-after-change-function (beg end old-len) 1203 (defun font-lock-after-change-function (beg end old-len)
1204 (when font-lock-mode 1204 (when font-lock-mode
1205 ;; treat deletions as if the following character (or previous, if 1205 ;; treat deletions as if the following character (or previous, if
1206 ;; there is no following) were inserted. this is a bit of a hack 1206 ;; there is no following) were inserted. (also use the previous
1207 ;; character at end of line. this avoids a problem when you
1208 ;; insert a comment on the line before a line of code: if we use
1209 ;; the following char, then when you hit backspace, the following
1210 ;; line of code turns the comment color.) this is a bit of a hack
1207 ;; but allows us to use text properties for everything. 1211 ;; but allows us to use text properties for everything.
1208 (if (= beg end) 1212 (if (= beg end)
1209 (cond ((/= end (point-max)) (setq end (1+ end))) 1213 (cond ((not (eolp)) (setq end (1+ end)))
1210 ((/= beg (point-min)) (setq beg (1- beg))) 1214 ((/= beg (point-min)) (setq beg (1- beg)))
1211 (t nil))) 1215 (t nil)))
1212 (put-text-property beg end 'font-lock-pending t) 1216 (put-text-property beg end 'font-lock-pending t)
1213 (puthash (current-buffer) t font-lock-pending-buffer-table) 1217 (puthash (current-buffer) t font-lock-pending-buffer-table)
1214 (if font-lock-always-fontify-immediately 1218 (if font-lock-always-fontify-immediately