changeset 13301:0cbf58edd87f

Updated to 3.08; don't use `let' var from caller.
author Simon Marshall <simon@gnu.org>
date Thu, 26 Oct 1995 13:34:28 +0000
parents 73b7a6396cbe
children 662aed026c4b
files lisp/fast-lock.el
diffstat 1 files changed, 20 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/fast-lock.el	Thu Oct 26 13:31:26 1995 +0000
+++ b/lisp/fast-lock.el	Thu Oct 26 13:34:28 1995 +0000
@@ -4,7 +4,7 @@
 
 ;; Author: Simon Marshall <simon@gnu.ai.mit.edu>
 ;; Keywords: faces files
-;; Version: 3.07
+;; Version: 3.08
 
 ;;; This file is part of GNU Emacs.
 
@@ -148,6 +148,8 @@
 ;; - XEmacs: Add `fast-lock-after-fontify-buffer' to the Font Lock hook.
 ;; - Made `fast-lock-cache-name' explain the use of `directory-abbrev-alist'.
 ;; - Made `fast-lock-mode' use `buffer-file-truename' not `buffer-file-name'.
+;; 3.07--3.08:
+;; - Made `fast-lock-read-cache' set `fast-lock-cache-filename'.
 
 (require 'font-lock)
 
@@ -159,7 +161,7 @@
   "Submit via mail a bug report on fast-lock.el."
   (interactive)
   (let ((reporter-prompt-for-summary-p t))
-    (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "fast-lock 3.07"
+    (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "fast-lock 3.08"
      '(fast-lock-cache-directories fast-lock-minimum-size
        fast-lock-save-others fast-lock-save-events fast-lock-save-faces)
      nil nil
@@ -256,6 +258,8 @@
 
 Use \\[fast-lock-submit-bug-report] to send bug reports or feedback."
   (interactive "P")
+  ;; Only turn on if we are visiting a file.  We could use `buffer-file-name',
+  ;; but many packages temporarily wrap that to nil when doing their own thing.
   (set (make-local-variable 'fast-lock-mode)
        (and buffer-file-truename
 	    (if arg (> (prefix-numeric-value arg) 0) (not fast-lock-mode))))
@@ -285,18 +289,24 @@
   (let ((directories fast-lock-cache-directories)
 	(modified (buffer-modified-p)) (inhibit-read-only t)
 	(fontified font-lock-fontified))
-    (setq fast-lock-cache-filename nil)
     (set (make-local-variable 'font-lock-fontified) nil)
     ;; Keep trying directories until fontification is turned off.
     (while (and directories (not font-lock-fontified))
-      (let* ((directory (fast-lock-cache-directory (car directories) nil))
-	     (file (and directory (fast-lock-cache-name directory))))
-	(condition-case nil
-	    (and file (file-readable-p file) (load file t t t))
-	  (error nil) (quit nil))
+      (let ((directory (fast-lock-cache-directory (car directories) nil)))
+	(if (not directory)
+	    nil
+	  (setq fast-lock-cache-filename (fast-lock-cache-name directory))
+	  (condition-case nil
+	      (if (file-readable-p fast-lock-cache-filename)
+		  (load fast-lock-cache-filename t t t))
+	    (error nil) (quit nil)))
 	(setq directories (cdr directories))))
+    ;; Unset `fast-lock-cache-filename', and restore `font-lock-fontified', if
+    ;; we don't use a cache.  (Note that `fast-lock-cache-data' sets the value
+    ;; of `fast-lock-cache-timestamp'.)
     (set-buffer-modified-p modified)
-    (or font-lock-fontified (setq font-lock-fontified fontified))))
+    (if (not font-lock-fontified)
+	(setq fast-lock-cache-filename nil font-lock-fontified fontified))))
 
 (defun fast-lock-save-cache (&optional buffer)
   "Save the Font Lock cache of BUFFER or the current buffer.
@@ -499,11 +509,8 @@
 	       (cond ((eq loaded 'error) "failed")
 		     ((eq loaded 'quit) "aborted")
 		     (t "done"))))
-    ;; If we used the text properties, stop fontification and keep timestamp.
-    ;; Kludge warning: `file' comes from sole caller `fast-lock-read-cache'.
     (setq font-lock-fontified (eq loaded t)
-	  fast-lock-cache-timestamp (and (eq loaded t) timestamp)
-	  fast-lock-cache-filename (and (eq loaded t) file))))
+	  fast-lock-cache-timestamp (and (eq loaded t) timestamp))))
 
 ;; Text Properties Processing Functions: