comparison lisp/packages/fast-lock.el @ 22:8fc7fe29b841 r19-15b94

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents ac2d302a0011
children 4103f0995bd7
comparison
equal deleted inserted replaced
21:b88636d63495 22:8fc7fe29b841
2 2
3 ;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. 3 ;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
4 4
5 ;; Author: Simon Marshall <simon@gnu.ai.mit.edu> 5 ;; Author: Simon Marshall <simon@gnu.ai.mit.edu>
6 ;; Keywords: faces files 6 ;; Keywords: faces files
7 ;; Version: 3.10.01 7 ;; Version: 3.10.02
8 8
9 ;; This file is part of XEmacs. 9 ;;; This file is part of GNU Emacs.
10 ;; 10
11 ;; XEmacs is free software; you can redistribute it and/or modify 11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by 12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2 of the License, or 13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; (at your option) any later version. 14 ;; any later version.
15 ;; 15
16 ;; XEmacs is distributed in the hope that it will be useful, 16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details. 19 ;; GNU General Public License for more details.
20 ;; 20
21 ;; You should have received a copy of the GNU General Public License 21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING. If not, write to the 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA. 24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Synched up with: FSF 19.34.
27 25
28 ;;; Commentary: 26 ;;; Commentary:
29 27
30 ;; Purpose: 28 ;; Purpose:
31 ;; 29 ;;
53 ;; A cache will be saved when visiting a compressed file using crypt++, but not 51 ;; A cache will be saved when visiting a compressed file using crypt++, but not
54 ;; be read. This is a "feature"/"consequence"/"bug" of crypt++. 52 ;; be read. This is a "feature"/"consequence"/"bug" of crypt++.
55 ;; 53 ;;
56 ;; Version control packages are likely to stamp all over file modification 54 ;; Version control packages are likely to stamp all over file modification
57 ;; times. Therefore the act of checking out may invalidate a cache. 55 ;; times. Therefore the act of checking out may invalidate a cache.
58 56 ;;;;;^L
59 ;; Feedback:
60 ;;
61 ;; Feedback is welcome.
62 ;; To submit a bug report (or make comments) please use the mechanism provided:
63 ;;
64 ;; M-x fast-lock-submit-bug-report RET
65
66 ;; History: 57 ;; History:
67 ;; 58 ;;
68 ;; 0.02--1.00: 59 ;; 0.02--1.00:
69 ;; - Changed name from turbo-prop to fast-lock. Automagic for font-lock only 60 ;; - Changed name from turbo-prop to fast-lock. Automagic for font-lock only
70 ;; - Made `fast-lock-mode' a minor mode, like G. Dinesh Dutt's fss-mode 61 ;; - Made `fast-lock-mode' a minor mode, like G. Dinesh Dutt's fss-mode
164 ;; - XEmacs: Made `fast-lock-save-faces' default to `font-lock-face-list' 155 ;; - XEmacs: Made `fast-lock-save-faces' default to `font-lock-face-list'
165 ;; - Made `fast-lock-save-cache' use `font-lock-value-in-major-mode' 156 ;; - Made `fast-lock-save-cache' use `font-lock-value-in-major-mode'
166 ;; - Wrap with `save-buffer-state' (Ray Van Tassle report) 157 ;; - Wrap with `save-buffer-state' (Ray Van Tassle report)
167 ;; - Made `fast-lock-mode' wrap `font-lock-support-mode' 158 ;; - Made `fast-lock-mode' wrap `font-lock-support-mode'
168 ;; 3.10--3.11: 159 ;; 3.10--3.11:
169 160 ;; - Made `fast-lock-get-face-properties' cope with face lists
161 ;; - Added `fast-lock-verbose'
162 ;; - XEmacs: Add `font-lock-value-in-major-mode' if necessary
163 ;;;;;^L
170 (require 'font-lock) 164 (require 'font-lock)
171 165
172 ;; Make sure fast-lock.el is supported. 166 ;; Make sure fast-lock.el is supported.
173 (if (and (eq system-type 'ms-dos) (not (msdos-long-file-names))) 167 (if (and (eq system-type 'ms-dos) (not (msdos-long-file-names)))
174 (error "`fast-lock' was written for long file name systems")) 168 (error "`fast-lock' was written for long file name systems"))
192 before-change-functions after-change-functions 186 before-change-functions after-change-functions
193 deactivate-mark buffer-file-name buffer-file-truename)))) 187 deactivate-mark buffer-file-name buffer-file-truename))))
194 (,@ body) 188 (,@ body)
195 (when (and (not modified) (buffer-modified-p)) 189 (when (and (not modified) (buffer-modified-p))
196 (set-buffer-modified-p nil))))) 190 (set-buffer-modified-p nil)))))
197 (put 'save-buffer-state 'lisp-indent-function 1)) 191 (put 'save-buffer-state 'lisp-indent-function 1)
192 ;;
193 ;; We use this to verify that a face should be saved.
194 (defmacro fast-lock-save-facep (face)
195 "Return non-nil if FACE matches `fast-lock-save-faces'."
196 (` (or (null fast-lock-save-faces)
197 (if (symbolp (, face))
198 (memq (, face) fast-lock-save-faces)
199 (let ((list (, face)) found)
200 (while list
201 (if (memq (car list) fast-lock-save-faces)
202 (setq list nil found t)
203 (setq list (cdr list))))
204 found))))))
198 205
199 (defun fast-lock-submit-bug-report () 206 (defun fast-lock-submit-bug-report ()
200 "Submit via mail a bug report on fast-lock.el." 207 "Submit via mail a bug report on fast-lock.el."
201 (interactive) 208 (interactive)
202 (let ((reporter-prompt-for-summary-p t)) 209 (let ((reporter-prompt-for-summary-p t))
203 (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "fast-lock 3.10.01" 210 (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "fast-lock 3.10.02"
204 '(fast-lock-cache-directories fast-lock-minimum-size 211 '(fast-lock-cache-directories fast-lock-minimum-size
205 fast-lock-save-others fast-lock-save-events fast-lock-save-faces) 212 fast-lock-save-others fast-lock-save-events fast-lock-save-faces
213 fast-lock-verbose)
206 nil nil 214 nil nil
207 (concat "Hi Si., 215 (concat "Hi Si.,
208 216
209 I want to report a bug. I've read the `Bugs' section of `Info' on Emacs, so I 217 I want to report a bug. I've read the `Bugs' section of `Info' on Emacs, so I
210 know how to make a clear and unambiguous report. To reproduce the bug: 218 know how to make a clear and unambiguous report. To reproduce the bug:
214 222
215 ;;;###autoload 223 ;;;###autoload
216 (defvar fast-lock-mode nil) 224 (defvar fast-lock-mode nil)
217 (defvar fast-lock-cache-timestamp nil) ; for saving/reading 225 (defvar fast-lock-cache-timestamp nil) ; for saving/reading
218 (defvar fast-lock-cache-filename nil) ; for deleting 226 (defvar fast-lock-cache-filename nil) ; for deleting
219 227 ;;;;;^L
220 ;; User Variables: 228 ;; User Variables:
221 229
222 (defvar fast-lock-cache-directories '("." "~/.emacs-flc") 230 (defvar fast-lock-cache-directories '("." "~/.emacs-flc")
223 ; - `internal', keep each file's Font Lock cache file in the same file. 231 ; - `internal', keep each file's Font Lock cache file in the same file.
224 ; - `external', keep each file's Font Lock cache file in the same directory. 232 ; - `external', keep each file's Font Lock cache file in the same directory.
264 (when (save-match-data (string-match "XEmacs" (emacs-version))) 272 (when (save-match-data (string-match "XEmacs" (emacs-version)))
265 ;; XEmacs uses extents for everything, so we have to pick the right ones. 273 ;; XEmacs uses extents for everything, so we have to pick the right ones.
266 font-lock-face-list) 274 font-lock-face-list)
267 "Faces that will be saved in a Font Lock cache file. 275 "Faces that will be saved in a Font Lock cache file.
268 If nil, means information for all faces will be saved.") 276 If nil, means information for all faces will be saved.")
269 277
278 (defvar fast-lock-verbose font-lock-verbose
279 "*If non-nil, means show status messages for cache processing.
280 If a number, only buffers greater than this size have processing messages.")
281 ;;;;;^L
270 ;; User Functions: 282 ;; User Functions:
271 283
272 ;;;###autoload 284 ;;;###autoload
273 (defun fast-lock-mode (&optional arg) 285 (defun fast-lock-mode (&optional arg)
274 "Toggle Fast Lock mode. 286 "Toggle Fast Lock mode.
291 Use \\[font-lock-fontify-buffer] to fontify the buffer if the cache is bad. 303 Use \\[font-lock-fontify-buffer] to fontify the buffer if the cache is bad.
292 304
293 Various methods of control are provided for the Font Lock cache. In general, 305 Various methods of control are provided for the Font Lock cache. In general,
294 see variable `fast-lock-cache-directories' and function `fast-lock-cache-name'. 306 see variable `fast-lock-cache-directories' and function `fast-lock-cache-name'.
295 For saving, see variables `fast-lock-minimum-size', `fast-lock-save-events', 307 For saving, see variables `fast-lock-minimum-size', `fast-lock-save-events',
296 `fast-lock-save-others' and `fast-lock-save-faces'. 308 `fast-lock-save-others' and `fast-lock-save-faces'."
297
298 Use \\[fast-lock-submit-bug-report] to send bug reports or feedback."
299 (interactive "P") 309 (interactive "P")
300 ;; Only turn on if we are visiting a file. We could use `buffer-file-name', 310 ;; Only turn on if we are visiting a file. We could use `buffer-file-name',
301 ;; but many packages temporarily wrap that to nil when doing their own thing. 311 ;; but many packages temporarily wrap that to nil when doing their own thing.
302 (set (make-local-variable 'fast-lock-mode) 312 (set (make-local-variable 'fast-lock-mode)
303 (and buffer-file-truename 313 (and buffer-file-truename
401 411
402 ;;;###autoload 412 ;;;###autoload
403 (defun turn-on-fast-lock () 413 (defun turn-on-fast-lock ()
404 "Unconditionally turn on Fast Lock mode." 414 "Unconditionally turn on Fast Lock mode."
405 (fast-lock-mode t)) 415 (fast-lock-mode t))
406 416 ;;;;;^L
407 ;;; API Functions: 417 ;;; API Functions:
408 418
409 (defun fast-lock-after-fontify-buffer () 419 (defun fast-lock-after-fontify-buffer ()
410 ;; Delete the Font Lock cache file used to restore fontification, if any. 420 ;; Delete the Font Lock cache file used to restore fontification, if any.
411 (when fast-lock-cache-filename 421 (when fast-lock-cache-filename
415 ;; Flag so that a cache will be saved later even if the file is never saved. 425 ;; Flag so that a cache will be saved later even if the file is never saved.
416 (setq fast-lock-cache-timestamp nil)) 426 (setq fast-lock-cache-timestamp nil))
417 427
418 (defalias 'fast-lock-after-unfontify-buffer 428 (defalias 'fast-lock-after-unfontify-buffer
419 'ignore) 429 'ignore)
420 430 ;;;;;^L
421 ;; Miscellaneous Functions: 431 ;; Miscellaneous Functions:
422 432
423 (defun fast-lock-save-cache-after-save-file () 433 (defun fast-lock-save-cache-after-save-file ()
424 ;; Do `fast-lock-save-cache' if `save-buffer' is on `fast-lock-save-events'. 434 ;; Do `fast-lock-save-cache' if `save-buffer' is on `fast-lock-save-events'.
425 (when (memq 'save-buffer fast-lock-save-events) 435 (when (memq 'save-buffer fast-lock-save-events)
494 (function (lambda (c) (or (cdr (assq c chars-alist)) (list c)))))) 504 (function (lambda (c) (or (cdr (assq c chars-alist)) (list c))))))
495 (concat 505 (concat
496 (file-name-as-directory (expand-file-name directory)) 506 (file-name-as-directory (expand-file-name directory))
497 (mapconcat 'char-to-string (apply 'append (mapcar mapchars bufile)) "") 507 (mapconcat 'char-to-string (apply 'append (mapcar mapchars bufile)) "")
498 ".flc")))) 508 ".flc"))))
499 509 ;;;;;^L
500 ;; Font Lock Cache Processing Functions: 510 ;; Font Lock Cache Processing Functions:
501 511
502 (defun fast-lock-save-cache-1 (file timestamp) 512 (defun fast-lock-save-cache-1 (file timestamp)
503 ;; Save the FILE with the TIMESTAMP as: 513 ;; Save the FILE with the TIMESTAMP as:
504 ;; (fast-lock-cache-data Version=2 TIMESTAMP font-lock-keywords PROPERTIES). 514 ;; (fast-lock-cache-data Version=2 TIMESTAMP font-lock-keywords PROPERTIES).
505 ;; Returns non-nil if a save was attempted to a writable cache file. 515 ;; Returns non-nil if a save was attempted to a writable cache file.
506 (let ((tpbuf (generate-new-buffer " *fast-lock*")) 516 (let ((tpbuf (generate-new-buffer " *fast-lock*"))
507 (buname (buffer-name)) (saved t)) 517 (verbose (if (numberp fast-lock-verbose)
508 (message "Saving %s font lock cache..." buname) 518 (> (buffer-size) fast-lock-verbose)
519 fast-lock-verbose))
520 (saved t))
521 (if verbose (message "Saving %s font lock cache..." (buffer-name)))
509 (condition-case nil 522 (condition-case nil
510 (save-excursion 523 (save-excursion
511 (print (list 'fast-lock-cache-data 2 524 (print (list 'fast-lock-cache-data 2
512 (list 'quote timestamp) 525 (list 'quote timestamp)
513 (list 'quote font-lock-keywords) 526 (list 'quote font-lock-keywords)
517 (write-region (point-min) (point-max) file nil 'quietly) 530 (write-region (point-min) (point-max) file nil 'quietly)
518 (setq fast-lock-cache-timestamp timestamp 531 (setq fast-lock-cache-timestamp timestamp
519 fast-lock-cache-filename file)) 532 fast-lock-cache-filename file))
520 (error (setq saved 'error)) (quit (setq saved 'quit))) 533 (error (setq saved 'error)) (quit (setq saved 'quit)))
521 (kill-buffer tpbuf) 534 (kill-buffer tpbuf)
522 (message "Saving %s font lock cache...%s" buname 535 (if verbose (message "Saving %s font lock cache...%s" (buffer-name)
523 (cond ((eq saved 'error) "failed") 536 (cond ((eq saved 'error) "failed")
524 ((eq saved 'quit) "aborted") 537 ((eq saved 'quit) "aborted")
525 (t "done"))) 538 (t "done"))))
526 ;; We return non-nil regardless of whether a failure occurred. 539 ;; We return non-nil regardless of whether a failure occurred.
527 saved)) 540 saved))
528 541
529 (defun fast-lock-cache-data (version timestamp keywords properties 542 (defun fast-lock-cache-data (version timestamp keywords properties
530 &rest ignored) 543 &rest ignored)
537 font-lock-keywords (font-lock-compile-keywords current))) 550 font-lock-keywords (font-lock-compile-keywords current)))
538 ;; Use the Font Lock cache PROPERTIES if we're using cache VERSION format 2, 551 ;; Use the Font Lock cache PROPERTIES if we're using cache VERSION format 2,
539 ;; the current buffer's file timestamp matches the TIMESTAMP, and the current 552 ;; the current buffer's file timestamp matches the TIMESTAMP, and the current
540 ;; buffer's font-lock-keywords are the same as KEYWORDS. 553 ;; buffer's font-lock-keywords are the same as KEYWORDS.
541 (let ((buf-timestamp (visited-file-modtime)) 554 (let ((buf-timestamp (visited-file-modtime))
542 (buname (buffer-name)) (loaded t)) 555 (verbose (if (numberp fast-lock-verbose)
556 (> (buffer-size) fast-lock-verbose)
557 fast-lock-verbose))
558 (loaded t))
543 (if (or (/= version 2) 559 (if (or (/= version 2)
544 (buffer-modified-p) 560 (buffer-modified-p)
545 (not (equal timestamp buf-timestamp)) 561 (not (equal timestamp buf-timestamp))
546 (not (equal keywords font-lock-keywords))) 562 (not (equal keywords font-lock-keywords)))
547 (setq loaded nil) 563 (setq loaded nil)
548 (message "Loading %s font lock cache..." buname) 564 (if verbose (message "Loading %s font lock cache..." (buffer-name)))
549 (condition-case nil 565 (condition-case nil
550 (fast-lock-set-face-properties properties) 566 (fast-lock-set-face-properties properties)
551 (error (setq loaded 'error)) (quit (setq loaded 'quit))) 567 (error (setq loaded 'error)) (quit (setq loaded 'quit)))
552 (message "Loading %s font lock cache...%s" buname 568 (if verbose (message "Loading %s font lock cache...%s" (buffer-name)
553 (cond ((eq loaded 'error) "failed") 569 (cond ((eq loaded 'error) "failed")
554 ((eq loaded 'quit) "aborted") 570 ((eq loaded 'quit) "aborted")
555 (t "done")))) 571 (t "done")))))
556 (setq font-lock-fontified (eq loaded t) 572 (setq font-lock-fontified (eq loaded t)
557 fast-lock-cache-timestamp (and (eq loaded t) timestamp)))) 573 fast-lock-cache-timestamp (and (eq loaded t) timestamp))))
558 574 ;;;;;^L
559 ;; Text Properties Processing Functions: 575 ;; Text Properties Processing Functions:
560 576
561 ;; This is faster, but fails if adjacent characters have different `face' text 577 ;; This is faster, but fails if adjacent characters have different `face' text
562 ;; properties. Maybe that's why I dropped it in the first place? 578 ;; properties. Maybe that's why I dropped it in the first place?
563 ;(defun fast-lock-get-face-properties () 579 ;(defun fast-lock-get-face-properties ()
576 ; (setcdr cell (cons start (cons end (cdr cell)))) 592 ; (setcdr cell (cons start (cons end (cdr cell))))
577 ; (setq properties (cons (list value start end) properties))) 593 ; (setq properties (cons (list value start end) properties)))
578 ; (setq start (next-single-property-change end 'face))) 594 ; (setq start (next-single-property-change end 'face)))
579 ; properties))) 595 ; properties)))
580 596
597 ;; This copes if adjacent characters have different `face' text properties, but
598 ;; fails if they are lists.
599 ;(defun fast-lock-get-face-properties ()
600 ; "Return a list of all `face' text properties in the current buffer.
601 ;Each element of the list is of the form (VALUE START1 END1 START2 END2 ...)
602 ;where VALUE is a `face' property value and STARTx and ENDx are positions.
603 ;Only those `face' VALUEs in `fast-lock-save-faces' are returned."
604 ; (save-restriction
605 ; (widen)
606 ; (let ((faces (or fast-lock-save-faces (face-list))) (limit (point-max))
607 ; properties regions face start end)
608 ; (while faces
609 ; (setq face (car faces) faces (cdr faces) regions () end (point-min))
610 ; ;; Make a list of start/end regions with `face' property face.
611 ; (while (setq start (text-property-any end limit 'face face))
612 ; (setq end (or (text-property-not-all start limit 'face face) limit)
613 ; regions (cons start (cons end regions))))
614 ; ;; Add `face' face's regions, if any, to properties.
615 ; (when regions
616 ; (push (cons face regions) properties)))
617 ; properties)))
618
581 (defun fast-lock-get-face-properties () 619 (defun fast-lock-get-face-properties ()
582 "Return a list of all `face' text properties in the current buffer. 620 "Return a list of all `face' text properties in the current buffer.
583 Each element of the list is of the form (VALUE START1 END1 START2 END2 ...) 621 Each element of the list is of the form (VALUE START1 END1 START2 END2 ...)
584 where VALUE is a `face' property value and STARTx and ENDx are positions. 622 where VALUE is a `face' property value and STARTx and ENDx are positions."
585 Only those `face' VALUEs in `fast-lock-save-faces' are returned."
586 (save-restriction 623 (save-restriction
587 (widen) 624 (widen)
588 (let ((faces (or fast-lock-save-faces (face-list))) (limit (point-max)) 625 (let ((start (text-property-not-all (point-min) (point-max) 'face nil))
589 properties regions face start end) 626 (limit (point-max)) end properties value cell)
590 (while faces 627 (while start
591 (setq face (car faces) faces (cdr faces) regions () end (point-min)) 628 (setq end (next-single-property-change start 'face nil limit)
592 ;; Make a list of start/end regions with `face' property face. 629 value (get-text-property start 'face))
593 (while (setq start (text-property-any end limit 'face face)) 630 ;; Make, or add to existing, list of regions with same `face'.
594 (setq end (or (text-property-not-all start limit 'face face) limit) 631 (cond ((setq cell (assoc value properties))
595 regions (cons start (cons end regions)))) 632 (setcdr cell (cons start (cons end (cdr cell)))))
596 ;; Add `face' face's regions, if any, to properties. 633 ((fast-lock-save-facep value)
597 (when regions 634 (push (list value start end) properties)))
598 (push (cons face regions) properties))) 635 (setq start (if (get-text-property end 'face)
636 end
637 (next-single-property-change end 'face))))
599 properties))) 638 properties)))
600 639
601 (defun fast-lock-set-face-properties (properties) 640 (defun fast-lock-set-face-properties (properties)
602 "Set all `face' text properties to PROPERTIES in the current buffer. 641 "Set all `face' text properties to PROPERTIES in the current buffer.
603 Any existing `face' text properties are removed first. 642 Any existing `face' text properties are removed first.
612 properties (cdr properties)) 651 properties (cdr properties))
613 ;; Set the `face' property for each start/end region. 652 ;; Set the `face' property for each start/end region.
614 (while regions 653 (while regions
615 (set-text-properties (nth 0 regions) (nth 1 regions) plist) 654 (set-text-properties (nth 0 regions) (nth 1 regions) plist)
616 (setq regions (nthcdr 2 regions))))))) 655 (setq regions (nthcdr 2 regions)))))))
617 656 ;;;;;^L
618 ;; Functions for XEmacs: 657 ;; Functions for XEmacs:
619 658
620 (when (save-match-data (string-match "XEmacs" (emacs-version))) 659 (when (save-match-data (string-match "XEmacs" (emacs-version)))
621 ;; 660 ;;
622 ;; It would be better to use XEmacs' `map-extents' over extents with a 661 ;; It would be better to use XEmacs' `map-extents' over extents with a
631 (let ((properties ()) cell) 670 (let ((properties ()) cell)
632 (map-extents 671 (map-extents
633 (function (lambda (extent ignore) 672 (function (lambda (extent ignore)
634 (let ((value (extent-face extent))) 673 (let ((value (extent-face extent)))
635 ;; We're only interested if it's one of `fast-lock-save-faces'. 674 ;; We're only interested if it's one of `fast-lock-save-faces'.
636 (when (and value (or (null fast-lock-save-faces) 675 (when (and value (fast-lock-save-facep value))
637 (memq value fast-lock-save-faces)))
638 (let ((start (extent-start-position extent)) 676 (let ((start (extent-start-position extent))
639 (end (extent-end-position extent))) 677 (end (extent-end-position extent)))
640 ;; Make or add to existing list of regions with the same 678 ;; Make or add to existing list of regions with the same
641 ;; `face' property value. 679 ;; `face' property value.
642 (if (setq cell (assq value properties)) 680 (if (setq cell (assoc value properties))
643 (setcdr cell (cons start (cons end (cdr cell)))) 681 (setcdr cell (cons start (cons end (cdr cell))))
644 (push (list value start end) properties)))) 682 (push (list value start end) properties))))
645 ;; Return nil to keep `map-extents' going. 683 ;; Return nil to keep `map-extents' going.
646 nil)))) 684 nil))))
647 properties))) 685 properties)))
678 (cdr (or (assq major-mode alist) (assq t alist))) 716 (cdr (or (assq major-mode alist) (assq t alist)))
679 alist))) 717 alist)))
680 718
681 (unless (fboundp 'font-lock-compile-keywords) 719 (unless (fboundp 'font-lock-compile-keywords)
682 (defalias 'font-lock-compile-keywords 'identity)) 720 (defalias 'font-lock-compile-keywords 'identity))
683 721 ;;;;;^L
684 ;; Install ourselves: 722 ;; Install ourselves:
685 723
686 (add-hook 'after-save-hook 'fast-lock-save-cache-after-save-file) 724 (add-hook 'after-save-hook 'fast-lock-save-cache-after-save-file)
687 (add-hook 'kill-buffer-hook 'fast-lock-save-cache-before-kill-buffer) 725 (add-hook 'kill-buffer-hook 'fast-lock-save-cache-before-kill-buffer)
688 (add-hook 'kill-emacs-hook 'fast-lock-save-caches-before-kill-emacs) 726 (add-hook 'kill-emacs-hook 'fast-lock-save-caches-before-kill-emacs)