HCoop
/
bpt
/
emacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(goto-address-url-face): Change default value from `bold' to `link'.
[bpt/emacs.git]
/
lisp
/
font-lock.el
diff --git
a/lisp/font-lock.el
b/lisp/font-lock.el
index
80c9f62
..
9c1775b
100644
(file)
--- a/
lisp/font-lock.el
+++ b/
lisp/font-lock.el
@@
-1,19
+1,21
@@
;;; font-lock.el --- Electric font lock mode
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
;;; font-lock.el --- Electric font lock mode
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
, 2009
;; Free Software Foundation, Inc.
;; Free Software Foundation, Inc.
-;; Author: jwz, then rms, then sm
+;; Author: Jamie Zawinski
+;; Richard Stallman
+;; Stefan Monnier
;; Maintainer: FSF
;; Keywords: languages, faces
;; This file is part of GNU Emacs.
;; Maintainer: FSF
;; Keywords: languages, faces
;; 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
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation
; either version 3, 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
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-21,9
+23,7
@@
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Commentary:
@@
-111,7
+111,7
@@
;; the pattern definitions.) Font Lock mode chooses which variable to use for
;; fontification based on `font-lock-maximum-decoration'.
;;
;; the pattern definitions.) Font Lock mode chooses which variable to use for
;; fontification based on `font-lock-maximum-decoration'.
;;
-;; Font Lock mode fontification behavio
u
r can be modified in a number of ways.
+;; Font Lock mode fontification behavior can be modified in a number of ways.
;; See the below comments and the comments distributed throughout this file.
;;; Constructing patterns:
;; See the below comments and the comments distributed throughout this file.
;;; Constructing patterns:
@@
-197,8
+197,8
@@
;; i.e., (b) above, all modes that have items that can be thought of as, say,
;; keywords, should be highlighted with the same face, etc.
;; - Make the face attributes fit the concept as far as possible.
;; i.e., (b) above, all modes that have items that can be thought of as, say,
;; keywords, should be highlighted with the same face, etc.
;; - Make the face attributes fit the concept as far as possible.
-;; i.e., function names might be a bold colo
u
r such as blue, comments might
-;; be a bright colo
u
r such as red, character strings might be brown, because,
+;; i.e., function names might be a bold color such as blue, comments might
+;; be a bright color such as red, character strings might be brown, because,
;; err, strings are brown (that was not the reason, please believe me).
;; - Don't use a non-nil OVERRIDE unless you have a good reason.
;; Only use OVERRIDE for special things that are easy to define, such as the
;; err, strings are brown (that was not the reason, please believe me).
;; - Don't use a non-nil OVERRIDE unless you have a good reason.
;; Only use OVERRIDE for special things that are easy to define, such as the
@@
-229,7
+229,7
@@
;; User variables.
(defcustom font-lock-maximum-size 256000
;; User variables.
(defcustom font-lock-maximum-size 256000
- "
*
Maximum size of a buffer for buffer fontification.
+ "Maximum size of a buffer for buffer fontification.
Only buffers less than this can be fontified when Font Lock mode is turned on.
If nil, means size is irrelevant.
If a list, each element should be a cons pair of the form (MAJOR-MODE . SIZE),
Only buffers less than this can be fontified when Font Lock mode is turned on.
If nil, means size is irrelevant.
If a list, each element should be a cons pair of the form (MAJOR-MODE . SIZE),
@@
-251,7
+251,7
@@
for buffers in Rmail mode, and size is irrelevant otherwise."
:group 'font-lock)
(defcustom font-lock-maximum-decoration t
:group 'font-lock)
(defcustom font-lock-maximum-decoration t
- "
*
Maximum decoration level for fontification.
+ "Maximum decoration level for fontification.
If nil, use the default decoration (typically the minimum available).
If t, use the maximum decoration available.
If a number, use that level of decoration (or if not available the maximum).
If nil, use the default decoration (typically the minimum available).
If t, use the maximum decoration available.
If a number, use that level of decoration (or if not available the maximum).
@@
-276,7
+276,7
@@
decoration for buffers in C++ mode, and level 1 decoration otherwise."
:group 'font-lock)
(defcustom font-lock-verbose 0
:group 'font-lock)
(defcustom font-lock-verbose 0
- "
*
If non-nil, means show status messages for buffer fontification.
+ "If non-nil, means show status messages for buffer fontification.
If a number, only buffers greater than this size have fontification messages."
:type '(choice (const :tag "never" nil)
(other :tag "always" t)
If a number, only buffers greater than this size have fontification messages."
:type '(choice (const :tag "never" nil)
(other :tag "always" t)
@@
-290,6
+290,11
@@
If a number, only buffers greater than this size have fontification messages."
;; We now allow a FACENAME in `font-lock-keywords' to be any expression that
;; returns a face. So the easiest thing is to continue using these variables,
;; rather than sometimes evaling FACENAME and sometimes not. sm.
;; We now allow a FACENAME in `font-lock-keywords' to be any expression that
;; returns a face. So the easiest thing is to continue using these variables,
;; rather than sometimes evaling FACENAME and sometimes not. sm.
+
+;; Note that in new code, in the vast majority of cases there is no
+;; need to create variables that specify face names. Simply using
+;; faces directly is enough. Font-lock is not a template to be
+;; followed in this area.
(defvar font-lock-comment-face 'font-lock-comment-face
"Face name to use for comments.")
(defvar font-lock-comment-face 'font-lock-comment-face
"Face name to use for comments.")
@@
-487,7
+492,8
@@
This is normally set via `font-lock-defaults'.")
(defvar font-lock-keywords-case-fold-search nil
"*Non-nil means the patterns in `font-lock-keywords' are case-insensitive.
(defvar font-lock-keywords-case-fold-search nil
"*Non-nil means the patterns in `font-lock-keywords' are case-insensitive.
-This is normally set via `font-lock-defaults'.")
+This is set via the function `font-lock-set-defaults', based on
+the CASE-FOLD argument of `font-lock-defaults'.")
(make-variable-buffer-local 'font-lock-keywords-case-fold-search)
(defvar font-lock-syntactically-fontified 0
(make-variable-buffer-local 'font-lock-keywords-case-fold-search)
(defvar font-lock-syntactically-fontified 0
@@
-847,7
+853,7
@@
happens, so the major mode can be corrected."
;; themselves.
(defcustom font-lock-support-mode 'jit-lock-mode
;; themselves.
(defcustom font-lock-support-mode 'jit-lock-mode
- "
*
Support mode for Font Lock mode.
+ "Support mode for Font Lock mode.
Support modes speed up Font Lock mode by being choosy about when fontification
occurs. The default support mode, Just-in-time Lock mode (symbol
`jit-lock-mode'), is recommended.
Support modes speed up Font Lock mode by being choosy about when fontification
occurs. The default support mode, Just-in-time Lock mode (symbol
`jit-lock-mode'), is recommended.
@@
-918,26
+924,26
@@
The value of this variable is used when Font Lock mode is turned on."
nil t)))))
(defun font-lock-turn-off-thing-lock ()
nil t)))))
(defun font-lock-turn-off-thing-lock ()
- (cond ((
and (boundp 'fast-lock-mode)
fast-lock-mode)
+ (cond ((
bound-and-true-p
fast-lock-mode)
(fast-lock-mode -1))
(fast-lock-mode -1))
- ((
and (boundp 'jit-lock-mode)
jit-lock-mode)
+ ((
bound-and-true-p
jit-lock-mode)
(jit-lock-unregister 'font-lock-fontify-region)
;; Reset local vars to the non-jit-lock case.
(kill-local-variable 'font-lock-fontify-buffer-function))
(jit-lock-unregister 'font-lock-fontify-region)
;; Reset local vars to the non-jit-lock case.
(kill-local-variable 'font-lock-fontify-buffer-function))
- ((
and (boundp 'lazy-lock-mode)
lazy-lock-mode)
+ ((
bound-and-true-p
lazy-lock-mode)
(lazy-lock-mode -1))))
(defun font-lock-after-fontify-buffer ()
(lazy-lock-mode -1))))
(defun font-lock-after-fontify-buffer ()
- (cond ((
and (boundp 'fast-lock-mode)
fast-lock-mode)
+ (cond ((
bound-and-true-p
fast-lock-mode)
(fast-lock-after-fontify-buffer))
;; Useless now that jit-lock intercepts font-lock-fontify-buffer. -sm
;; (jit-lock-mode
;; (jit-lock-after-fontify-buffer))
(fast-lock-after-fontify-buffer))
;; Useless now that jit-lock intercepts font-lock-fontify-buffer. -sm
;; (jit-lock-mode
;; (jit-lock-after-fontify-buffer))
- ((
and (boundp 'lazy-lock-mode)
lazy-lock-mode)
+ ((
bound-and-true-p
lazy-lock-mode)
(lazy-lock-after-fontify-buffer))))
(defun font-lock-after-unfontify-buffer ()
(lazy-lock-after-fontify-buffer))))
(defun font-lock-after-unfontify-buffer ()
- (cond ((
and (boundp 'fast-lock-mode)
fast-lock-mode)
+ (cond ((
bound-and-true-p
fast-lock-mode)
(fast-lock-after-unfontify-buffer))
;; Useless as well. It's only called when:
;; - turning off font-lock: it does not matter if we leave spurious
(fast-lock-after-unfontify-buffer))
;; Useless as well. It's only called when:
;; - turning off font-lock: it does not matter if we leave spurious
@@
-947,7
+953,7
@@
The value of this variable is used when Font Lock mode is turned on."
;;
;; (jit-lock-mode
;; (jit-lock-after-unfontify-buffer))
;;
;; (jit-lock-mode
;; (jit-lock-after-unfontify-buffer))
- ((
and (boundp 'lazy-lock-mode)
lazy-lock-mode)
+ ((
bound-and-true-p
lazy-lock-mode)
(lazy-lock-after-unfontify-buffer))))
;;; End of Font Lock Support mode.
(lazy-lock-after-unfontify-buffer))))
;;; End of Font Lock Support mode.
@@
-1826,7
+1832,7
@@
Sets various variables using `font-lock-defaults' (or, if nil, using
(setq font-lock-keywords
(font-lock-compile-keywords font-lock-keywords))))))
\f
(setq font-lock-keywords
(font-lock-compile-keywords font-lock-keywords))))))
\f
-;;; Colo
u
r etc. support.
+;;; Color etc. support.
;; Note that `defface' will not overwrite any faces declared above via
;; `custom-declare-face'.
;; Note that `defface' will not overwrite any faces declared above via
;; `custom-declare-face'.
@@
-1983,7
+1989,7
@@
Sets various variables using `font-lock-defaults' (or, if nil, using
"Font Lock mode face used to highlight grouping constructs in Lisp regexps."
:group 'font-lock-faces)
"Font Lock mode face used to highlight grouping constructs in Lisp regexps."
:group 'font-lock-faces)
-;;; End of Colo
u
r etc. support.
+;;; End of Color etc. support.
\f
;;; Menu support.
\f
;;; Menu support.
@@
-2156,7
+2162,7
@@
This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
;;
(defconst cpp-font-lock-keywords-source-directives
"define\\|e\\(?:l\\(?:if\\|se\\)\\|ndif\\|rror\\)\\|file\\|i\\(?:f\\(?:n?def\\)?\\|mport\\|nclude\\)\\|line\\|pragma\\|undef\\|warning"
;;
(defconst cpp-font-lock-keywords-source-directives
"define\\|e\\(?:l\\(?:if\\|se\\)\\|ndif\\|rror\\)\\|file\\|i\\(?:f\\(?:n?def\\)?\\|mport\\|nclude\\)\\|line\\|pragma\\|undef\\|warning"
- "Regular express
oi
n used in `cpp-font-lock-keywords'.")
+ "Regular express
io
n used in `cpp-font-lock-keywords'.")
;; `cpp-font-lock-keywords-source-depth' is calculated from:
;;
;; `cpp-font-lock-keywords-source-depth' is calculated from:
;;
@@
-2205,10
+2211,10
@@
Used in `cpp-font-lock-keywords'.")
'(1 font-lock-preprocessor-face prepend)
(list (+ 2 directives-depth)
'font-lock-variable-name-face nil t))))
'(1 font-lock-preprocessor-face prepend)
(list (+ 2 directives-depth)
'font-lock-variable-name-face nil t))))
-
"Font lock key
ords for C preprocessor directives.
-`c-mode', `c++-mode' and `objc-mode' have their own
-fo
nt lock keyords for C preprocessor directives. This definition is for the
-
other modes
in which C preprocessor directives are used. e.g. `asm-mode' and
+
"Font lock keyw
ords for C preprocessor directives.
+`c-mode', `c++-mode' and `objc-mode' have their own
font lock keywords
+fo
r C preprocessor directives. This definition is for the other modes
+in which C preprocessor directives are used. e.g. `asm-mode' and
`ld-script-mode'.")
\f
`ld-script-mode'.")
\f
@@
-2254,9
+2260,9
@@
other modes in which C preprocessor directives are used. e.g. `asm-mode' and
'("cond" "if" "while" "while-no-input" "let" "let*"
"prog" "progn" "progv" "prog1" "prog2" "prog*"
"inline" "lambda" "save-restriction" "save-excursion"
'("cond" "if" "while" "while-no-input" "let" "let*"
"prog" "progn" "progv" "prog1" "prog2" "prog*"
"inline" "lambda" "save-restriction" "save-excursion"
- "save-
window-excursion" "save-selected-window
"
- "save-match-data" "save-current-buffer"
"unwind-protect"
- "condition-case" "track-mouse"
+ "save-
selected-window" "save-window-excursion
"
+ "save-match-data" "save-current-buffer"
+ "
unwind-protect" "
condition-case" "track-mouse"
"eval-after-load" "eval-and-compile" "eval-when-compile"
"eval-when" "eval-at-startup" "eval-next-after-load"
"with-case-table" "with-category-table"
"eval-after-load" "eval-and-compile" "eval-when-compile"
"eval-when" "eval-at-startup" "eval-next-after-load"
"with-case-table" "with-category-table"