File: fast-lock.el.html

Fast Lock mode is a Font Lock support mode.

It makes visiting a file in Font Lock mode faster by restoring its face text properties from automatically saved associated Font Lock cache files.

See caveats and feedback below. See also the lazy-lock package. (But don't use the two at the same time!)

Installation:

Put in your ~/.emacs:

(setq font-lock-support-mode 'fast-lock-mode)

Start up a new Emacs and use font-lock as usual (except that you can use the so-called "gaudier" fontification regexps on big files without frustration).

When you visit a file (which has font-lock-mode(var)/font-lock-mode(fun) enabled) that has a corresponding Font Lock cache file associated with it, the Font Lock cache will be loaded from that file instead of being generated by Font Lock code.

Caveats:

A cache will be saved when visiting a compressed file using crypt++, but not be read. This is a "feature"/"consequence"/"bug" of crypt++.

Version control packages are likely to stamp all over file modification times. Therefore the act of checking out may invalidate a cache.

History:

0.02--1.00:
- Changed name from turbo-prop to fast-lock. Automagic for font-lock only
- Made fast-lock-mode(var)/fast-lock-mode(fun) a minor mode, like G. Dinesh Dutt's fss-mode
1.00--1.01:
- Turn on fast-lock-mode(var)/fast-lock-mode(fun) only if buffer-file-name(var)/buffer-file-name(fun) or interactive-p
- Made fast-lock-file-name use buffer-name if buffer-file-name(var)/buffer-file-name(fun) is nil
- Moved save-all conditions to fast-lock-save-cache
- Added fast-lock-save-text-properties to kill-buffer-hook
1.01--2.00: complete rewrite---not worth the space to document
- Changed structure of text properties cache and threw out file mod checks
2.00--2.01:
- Made condition-case forms understand quit.
- Made fast-lock require font-lock
- Made fast-lock-cache-name chase links (from Ben Liblit)
2.01--3.00:
- Changed structure of cache to include font-lock-keywords (from rms)
- Changed fast-lock-cache-mechanisms to fast-lock-cache-directories
- Removed fast-lock-read-others
- Made fast-lock-read-cache ignore cache owner
- Made fast-lock-save-cache-external create cache directory
- Made fast-lock-save-cache-external save font-lock-keywords
- Made fast-lock-cache-data check font-lock-keywords
3.00--3.01: incorporated port of 2.00 to Lucid, made by Barry Warsaw
- Package now provides itself
- Lucid: Use font-lock-any-extents-p for font-lock-any-properties-p
- Lucid: Use list-faces for face-list
- Lucid: Added set-text-properties
- Lucid: Made turn-on-fast-lock pass 1 not t to fast-lock-mode(var)/fast-lock-mode(fun)
- Removed test for fast-lock-mode(var)/fast-lock-mode(fun) from fast-lock-read-cache
- Lucid: Added Lucid-specific fast-lock-get-face-properties
3.01--3.02: now works with Lucid Emacs, thanks to Barry Warsaw
- Made fast-lock-cache-name map ":" to ";" for OS/2 (from Serganova Vera)
- Made fast-lock-cache-name use abbreviated file name (from Barry Warsaw)
- Lucid: Separated handlers for error and quit for condition-case
3.02--3.03:
- Changed fast-lock-save-cache-external to fast-lock-save-cache-data
- Lucid: Added Lucid-specific fast-lock-set-face-properties
3.03--3.04:
- Corrected subrp test of Lucid code
- Replaced font-lock-any-properties-p with text-property-not-all
- Lucid: Made fast-lock-set-face-properties put text-prop on extents
- Made fast-lock-cache-directories a regexp alist (from Colin Rafferty)
- Made fast-lock-cache-directory to return a usable cache file directory
3.04--3.05:
- Lucid: Fix for XEmacs 19.11 text-property-not-all
- Replaced subrp test of Lucid code with emacs-version(var)/emacs-version(fun) string-match
- Made byte-compile-warnings omit unresolved on compilation
- Made fast-lock-save-cache-data use a buffer (from Rick Sladkey)
- Reverted to old fast-lock-get-face-properties (from Rick Sladkey)
3.05--3.06: incorporated hack of 3.03, made by Jonathan Stigelman (Stig)
- Reverted to 3.04 version of fast-lock-get-face-properties
- XEmacs: Removed list-faces defalias
- Made fast-lock-mode(var)/fast-lock-mode(fun) and turn-on-fast-lock succeed autoload cookies
- Added fast-lock-submit-bug-report
- Renamed fast-lock-save-size to fast-lock-minimum-size
- Made fast-lock-save-cache output a message if no save ever attempted
- Made fast-lock-save-cache-data output a message if save attempted
- Made fast-lock-cache-data output a message if load attempted
- Made fast-lock-save-cache-data do condition-case not unwind-protect
- Made fast-lock-save-cache and fast-lock-read-cache return nothing
- Made fast-lock-save-cache check buffer-modified-p (Stig)
- Added fast-lock-save-events
- Added fast-lock-after-save-hook to after-save-hook (Stig)
- Added fast-lock-kill-buffer-hook to kill-buffer-hook
- Changed fast-lock-save-caches to fast-lock-kill-emacs-hook
- Added fast-lock-kill-emacs-hook to kill-emacs-hook
- Made fast-lock-save-cache check verify-visited-file-modtime (Stig)
- Made visited-file-modtime be the basis of the timestamp (Stig)
- Made fast-lock-save-cache-1 and fast-lock-cache-data use/reformat it
- Added fast-lock-cache-filename to keep track of the cache file name
- Added fast-lock-after-fontify-buffer
- Added fast-lock-save-faces list of faces to save (idea from Stig/Tibor)
- Made fast-lock-get-face-properties functions use it
- XEmacs: Made fast-lock-set-face-properties do extents the Font Lock way
- XEmacs: Removed fix for text-property-not-all (19.11 support dropped)
- Made fast-lock-mode(var)/fast-lock-mode(fun) ensure font-lock-mode(var)/font-lock-mode(fun) is on
- Made fast-lock-save-cache do cdr-safe not cdr (from Dave Foster)
- Made fast-lock-save-cache do set-buffer first (from Dave Foster)
- Made fast-lock-save-cache loop until saved or quit (from Georg Nikodym)
- Made fast-lock-cache-data check buffer-modified-p
- Made fast-lock-cache-data do font-lock-compile-keywords if necessary
- XEmacs: Made font-lock-compile-keywords defalias
3.06--3.07:
- 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(var)/fast-lock-mode(fun) use buffer-file-truename not buffer-file-name(var)/buffer-file-name(fun)
3.07--3.08:
- Made fast-lock-read-cache set fast-lock-cache-filename
3.08--3.09:
- Made fast-lock-save-cache cope if fast-lock-minimum-size is a list
- Made fast-lock-mode(var)/fast-lock-mode(fun) respect the value of font-lock-inhibit-thing-lock
- Added fast-lock-after-unfontify-buffer
3.09--3.10:
- Rewrite for Common Lisp macros
- Made fast-lock.el barf on a crap 8+3 pseudo-OS (Eli Zaretskii help)
- XEmacs: Made add-minor-mode succeed autoload cookie
- XEmacs: Made fast-lock-save-faces default to font-lock-face-list
- Made fast-lock-save-cache use font-lock-value-in-major-mode
- Wrap with save-buffer-state (Ray Van Tassle report)
- Made fast-lock-mode(var)/fast-lock-mode(fun) wrap font-lock-support-mode
3.10--3.11:
- Made fast-lock-get-face-properties cope with face lists
- Added fast-lock-verbose
- XEmacs: Add font-lock-value-in-major-mode if necessary
- Removed fast-lock-submit-bug-report and bade farewell
3.11--3.12:
- Added Custom support (Hrvoje Nikšić help)
- Made save-buffer-state wrap inhibit-point-motion-hooks
- Made fast-lock-cache-data simplify calls of font-lock-compile-keywords
3.12--3.13:
- Removed byte-* variables from eval-when-compile (Erik Naggum hint)
- Changed structure of cache to include font-lock-syntactic-keywords
- Made fast-lock-save-cache-1 save syntactic fontification data
- Made fast-lock-cache-data take syntactic fontification data
- Added fast-lock-get-syntactic-properties
- Renamed fast-lock-set-face-properties to fast-lock-add-properties
- Made fast-lock-add-properties add syntactic and face fontification data
3.13--3.14:
- Made fast-lock-cache-name cope with windowsnt (Geoff Voelker fix)
- Made fast-lock-verbose use other widget (Andreas Schwab fix)
- Used with-temp-message where possible to make messages temporary.

Defined variables (6)

fast-lock-cache-directoriesDirectories in which Font Lock cache files are saved and read.
fast-lock-minimum-sizeMinimum size of a buffer for cached fontification.
fast-lock-save-eventsEvents under which caches will be saved.
fast-lock-save-facesFaces that will be saved in a Font Lock cache file.
fast-lock-save-othersIf non-nil, save Font Lock cache files irrespective of file owner.
fast-lock-verboseIf non-nil, means show status messages for cache processing.

Defined functions (12)

fast-lock-add-properties(SYNTACTIC-PROPERTIES FACE-PROPERTIES)
fast-lock-after-unfontify-buffer(&rest ARGUMENTS)
fast-lock-cache-data(VERSION TIMESTAMP SYNTACTIC-KEYWORDS SYNTACTIC-PROPERTIES KEYWORDS FACE-PROPERTIES &rest IGNORED)
fast-lock-cache-directory(DIRECTORY CREATE)
fast-lock-cache-name(DIRECTORY)
fast-lock-get-face-properties()
fast-lock-get-syntactic-properties()
fast-lock-mode(&optional ARG)
fast-lock-read-cache()
fast-lock-save-cache(&optional BUFFER)
fast-lock-save-cache-1(FILE TIMESTAMP)
turn-on-fast-lock()

Defined faces (0)