X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/6eabc4c2f76441f11cc344891d3849ad3631ab15..845fc5e555e73449596ba475060fd2674f3b51e9:/lisp/obsolete/fast-lock.el?ds=sidebyside diff --git a/lisp/obsolete/fast-lock.el b/lisp/obsolete/fast-lock.el index 744b5a53be..a59e787145 100644 --- a/lisp/obsolete/fast-lock.el +++ b/lisp/obsolete/fast-lock.el @@ -1,7 +1,6 @@ ;;; fast-lock.el --- automagic text properties caching for fast Font Lock mode -;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007 Free Software Foundation, Inc. +;; Copyright (C) 1994-1998, 2001-2011 Free Software Foundation, Inc. ;; Author: Simon Marshall ;; Maintainer: FSF @@ -10,10 +9,10 @@ ;; This file is part of GNU Emacs. -;; GNU Emacs is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,12 +20,12 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: +;; This file has been obsolete since Emacs 22.1. + ;; 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. @@ -183,6 +182,8 @@ (require 'font-lock) +(declare-function msdos-long-file-names "msdos.c") + ;; Make sure fast-lock.el is supported. (if (and (eq system-type 'ms-dos) (not (msdos-long-file-names))) (error "`fast-lock' was written for long file name systems")) @@ -216,25 +217,7 @@ (let ((faces ,face)) (while (unless (memq (car faces) fast-lock-save-faces) (setq faces (cdr faces)))) - faces)))) - ;; - ;; We use this for compatibility with a future Emacs. - (or (fboundp 'with-temp-message) - (defmacro with-temp-message (message &rest body) - `(let ((temp-message ,message) current-message) - (unwind-protect - (progn - (when temp-message - (setq current-message (current-message)) - (message "%s" temp-message)) - ,@body) - (when temp-message - (message "%s" current-message)))))) - ;; - ;; We use this for compatibility with a future Emacs. - (or (fboundp 'defcustom) - (defmacro defcustom (symbol value doc &rest args) - `(defvar ,symbol ,value ,doc)))) + faces))))) ;;(defun fast-lock-submit-bug-report () ;; "Submit via mail a bug report on fast-lock.el." @@ -286,7 +269,7 @@ for buffers in Rmail mode, and size is irrelevant otherwise." (integer :tag "size"))))) :group 'fast-lock) -(defcustom fast-lock-cache-directories '("." "~/.emacs-flc") +(defcustom fast-lock-cache-directories '("~/.emacs-flc") ; - `internal', keep each file's Font Lock cache file in the same file. ; - `external', keep each file's Font Lock cache file in the same directory. "*Directories in which Font Lock cache files are saved and read. @@ -304,12 +287,15 @@ For example: ((\"^/your/true/home/directory/\" . \".\") \"~/.emacs-flc\") would cause a file's current directory to be used if the file is under your -home directory hierarchy, or otherwise the absolute directory `~/.emacs-flc'." +home directory hierarchy, or otherwise the absolute directory `~/.emacs-flc'. +For security reasons, it is not advisable to use the file's current directory +to avoid the possibility of using the cache of another user." :type '(repeat (radio (directory :tag "directory") (cons :tag "Matching" (regexp :tag "regexp") (directory :tag "directory")))) :group 'fast-lock) +(put 'fast-lock-cache-directories 'risky-local-variable t) (defcustom fast-lock-save-events '(kill-buffer kill-emacs) "*Events under which caches will be saved. @@ -337,7 +323,7 @@ If a number, only buffers greater than this size have processing messages." :group 'fast-lock) (defvar fast-lock-save-faces - (when (save-match-data (string-match "XEmacs" (emacs-version))) + (when (featurep 'xemacs) ;; XEmacs uses extents for everything, so we have to pick the right ones. font-lock-face-list) "Faces that will be saved in a Font Lock cache file. @@ -523,7 +509,7 @@ See `fast-lock-cache-directories'." ;; Just a directory. directory) (t - ;; A directory iff the file name matches the regexp. + ;; A directory if the file name matches the regexp. (let ((bufile (expand-file-name buffer-file-truename)) (case-fold-search nil)) (when (save-match-data (string-match (car directory) bufile)) @@ -562,7 +548,7 @@ See `fast-lock-cache-directory'." (concat buffer-file-name ".flc") (let* ((bufile (expand-file-name buffer-file-truename)) (chars-alist - (if (memq system-type '(emx windows-nt cygwin)) + (if (memq system-type '(windows-nt cygwin)) '((?/ . (?#)) (?# . (?# ?#)) (?: . (?\;)) (?\; . (?\; ?\;))) '((?/ . (?#)) (?# . (?# ?#))))) (mapchars @@ -768,7 +754,7 @@ See `fast-lock-get-face-properties'." ;; Functions for XEmacs: -(when (save-match-data (string-match "XEmacs" (emacs-version))) +(when (featurep 'xemacs) ;; ;; It would be better to use XEmacs' `map-extents' over extents with a ;; `font-lock' property, but `face' properties are on different extents. @@ -854,7 +840,8 @@ See `fast-lock-get-face-properties'." (add-hook 'after-save-hook 'fast-lock-save-cache-after-save-file) (add-hook 'kill-buffer-hook 'fast-lock-save-cache-before-kill-buffer) -(add-hook 'kill-emacs-hook 'fast-lock-save-caches-before-kill-emacs) +(unless noninteractive + (add-hook 'kill-emacs-hook 'fast-lock-save-caches-before-kill-emacs)) ;;;###autoload (when (fboundp 'add-minor-mode) @@ -868,5 +855,4 @@ See `fast-lock-get-face-properties'." (provide 'fast-lock) -;; arch-tag: 638c431e-8cae-4538-80a1-963ff97d233e ;;; fast-lock.el ends here