diff options
| author | Simon Marshall | 1995-10-26 13:34:28 +0000 |
|---|---|---|
| committer | Simon Marshall | 1995-10-26 13:34:28 +0000 |
| commit | 9ebfa5ef88eabb21ae1435e761d804bdb9d44460 (patch) | |
| tree | f9767856d12ed5608e748a3b80d310ce37af7273 | |
| parent | f408b02745a855076ef7266ccffca858f63441c6 (diff) | |
| download | emacs-9ebfa5ef88eabb21ae1435e761d804bdb9d44460.tar.gz emacs-9ebfa5ef88eabb21ae1435e761d804bdb9d44460.zip | |
Updated to 3.08; don't use `let' var from caller.
| -rw-r--r-- | lisp/fast-lock.el | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/lisp/fast-lock.el b/lisp/fast-lock.el index 92cae9ecedb..1059dbb4fc4 100644 --- a/lisp/fast-lock.el +++ b/lisp/fast-lock.el | |||
| @@ -4,7 +4,7 @@ | |||
| 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.07 | 7 | ;; Version: 3.08 |
| 8 | 8 | ||
| 9 | ;;; This file is part of GNU Emacs. | 9 | ;;; This file is part of GNU Emacs. |
| 10 | 10 | ||
| @@ -148,6 +148,8 @@ | |||
| 148 | ;; - XEmacs: Add `fast-lock-after-fontify-buffer' to the Font Lock hook. | 148 | ;; - XEmacs: Add `fast-lock-after-fontify-buffer' to the Font Lock hook. |
| 149 | ;; - Made `fast-lock-cache-name' explain the use of `directory-abbrev-alist'. | 149 | ;; - Made `fast-lock-cache-name' explain the use of `directory-abbrev-alist'. |
| 150 | ;; - Made `fast-lock-mode' use `buffer-file-truename' not `buffer-file-name'. | 150 | ;; - Made `fast-lock-mode' use `buffer-file-truename' not `buffer-file-name'. |
| 151 | ;; 3.07--3.08: | ||
| 152 | ;; - Made `fast-lock-read-cache' set `fast-lock-cache-filename'. | ||
| 151 | 153 | ||
| 152 | (require 'font-lock) | 154 | (require 'font-lock) |
| 153 | 155 | ||
| @@ -159,7 +161,7 @@ | |||
| 159 | "Submit via mail a bug report on fast-lock.el." | 161 | "Submit via mail a bug report on fast-lock.el." |
| 160 | (interactive) | 162 | (interactive) |
| 161 | (let ((reporter-prompt-for-summary-p t)) | 163 | (let ((reporter-prompt-for-summary-p t)) |
| 162 | (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "fast-lock 3.07" | 164 | (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "fast-lock 3.08" |
| 163 | '(fast-lock-cache-directories fast-lock-minimum-size | 165 | '(fast-lock-cache-directories fast-lock-minimum-size |
| 164 | fast-lock-save-others fast-lock-save-events fast-lock-save-faces) | 166 | fast-lock-save-others fast-lock-save-events fast-lock-save-faces) |
| 165 | nil nil | 167 | nil nil |
| @@ -256,6 +258,8 @@ For saving, see variables `fast-lock-minimum-size', `fast-lock-save-events', | |||
| 256 | 258 | ||
| 257 | Use \\[fast-lock-submit-bug-report] to send bug reports or feedback." | 259 | Use \\[fast-lock-submit-bug-report] to send bug reports or feedback." |
| 258 | (interactive "P") | 260 | (interactive "P") |
| 261 | ;; Only turn on if we are visiting a file. We could use `buffer-file-name', | ||
| 262 | ;; but many packages temporarily wrap that to nil when doing their own thing. | ||
| 259 | (set (make-local-variable 'fast-lock-mode) | 263 | (set (make-local-variable 'fast-lock-mode) |
| 260 | (and buffer-file-truename | 264 | (and buffer-file-truename |
| 261 | (if arg (> (prefix-numeric-value arg) 0) (not fast-lock-mode)))) | 265 | (if arg (> (prefix-numeric-value arg) 0) (not fast-lock-mode)))) |
| @@ -285,18 +289,24 @@ See `fast-lock-mode'." | |||
| 285 | (let ((directories fast-lock-cache-directories) | 289 | (let ((directories fast-lock-cache-directories) |
| 286 | (modified (buffer-modified-p)) (inhibit-read-only t) | 290 | (modified (buffer-modified-p)) (inhibit-read-only t) |
| 287 | (fontified font-lock-fontified)) | 291 | (fontified font-lock-fontified)) |
| 288 | (setq fast-lock-cache-filename nil) | ||
| 289 | (set (make-local-variable 'font-lock-fontified) nil) | 292 | (set (make-local-variable 'font-lock-fontified) nil) |
| 290 | ;; Keep trying directories until fontification is turned off. | 293 | ;; Keep trying directories until fontification is turned off. |
| 291 | (while (and directories (not font-lock-fontified)) | 294 | (while (and directories (not font-lock-fontified)) |
| 292 | (let* ((directory (fast-lock-cache-directory (car directories) nil)) | 295 | (let ((directory (fast-lock-cache-directory (car directories) nil))) |
| 293 | (file (and directory (fast-lock-cache-name directory)))) | 296 | (if (not directory) |
| 294 | (condition-case nil | 297 | nil |
| 295 | (and file (file-readable-p file) (load file t t t)) | 298 | (setq fast-lock-cache-filename (fast-lock-cache-name directory)) |
| 296 | (error nil) (quit nil)) | 299 | (condition-case nil |
| 300 | (if (file-readable-p fast-lock-cache-filename) | ||
| 301 | (load fast-lock-cache-filename t t t)) | ||
| 302 | (error nil) (quit nil))) | ||
| 297 | (setq directories (cdr directories)))) | 303 | (setq directories (cdr directories)))) |
| 304 | ;; Unset `fast-lock-cache-filename', and restore `font-lock-fontified', if | ||
| 305 | ;; we don't use a cache. (Note that `fast-lock-cache-data' sets the value | ||
| 306 | ;; of `fast-lock-cache-timestamp'.) | ||
| 298 | (set-buffer-modified-p modified) | 307 | (set-buffer-modified-p modified) |
| 299 | (or font-lock-fontified (setq font-lock-fontified fontified)))) | 308 | (if (not font-lock-fontified) |
| 309 | (setq fast-lock-cache-filename nil font-lock-fontified fontified)))) | ||
| 300 | 310 | ||
| 301 | (defun fast-lock-save-cache (&optional buffer) | 311 | (defun fast-lock-save-cache (&optional buffer) |
| 302 | "Save the Font Lock cache of BUFFER or the current buffer. | 312 | "Save the Font Lock cache of BUFFER or the current buffer. |
| @@ -499,11 +509,8 @@ See `fast-lock-cache-directory'." | |||
| 499 | (cond ((eq loaded 'error) "failed") | 509 | (cond ((eq loaded 'error) "failed") |
| 500 | ((eq loaded 'quit) "aborted") | 510 | ((eq loaded 'quit) "aborted") |
| 501 | (t "done")))) | 511 | (t "done")))) |
| 502 | ;; If we used the text properties, stop fontification and keep timestamp. | ||
| 503 | ;; Kludge warning: `file' comes from sole caller `fast-lock-read-cache'. | ||
| 504 | (setq font-lock-fontified (eq loaded t) | 512 | (setq font-lock-fontified (eq loaded t) |
| 505 | fast-lock-cache-timestamp (and (eq loaded t) timestamp) | 513 | fast-lock-cache-timestamp (and (eq loaded t) timestamp)))) |
| 506 | fast-lock-cache-filename (and (eq loaded t) file)))) | ||
| 507 | 514 | ||
| 508 | ;; Text Properties Processing Functions: | 515 | ;; Text Properties Processing Functions: |
| 509 | 516 | ||