annotate lisp/font-core.el @ 60495:8e1bab51992b

(face-id): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Tue, 08 Mar 2005 02:55:39 +0000
parents 6e156606b5c5
children b76b7700df8d 3ebd9bdb4fe5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
1 ;;; font-core.el --- Core interface to font-lock
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
2
59871
83af8894e534 (font-lock-default-function): Handle the rare case where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 52401
diff changeset
3 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
83af8894e534 (font-lock-default-function): Handle the rare case where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 52401
diff changeset
4 ;; 2002, 2003, 2005 Free Software Foundation, Inc.
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
5
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
6 ;; Maintainer: FSF
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
7 ;; Keywords: languages, faces
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
8
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
10
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
14 ;; any later version.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
15
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
20
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
25
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
26 ;;; Code:
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
27
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
28 ;; This variable is used by mode packages that support Font Lock mode by
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
29 ;; defining their own keywords to use for `font-lock-keywords'. (The mode
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
30 ;; command should make it buffer-local and set it to provide the set up.)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
31 (defvar font-lock-defaults nil
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
32 "Defaults for Font Lock mode specified by the major mode.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
33 Defaults should be of the form:
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
34
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
35 (KEYWORDS KEYWORDS-ONLY CASE-FOLD SYNTAX-ALIST SYNTAX-BEGIN ...)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
36
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
37 KEYWORDS may be a symbol (a variable or function whose value is the keywords to
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
38 use for fontification) or a list of symbols. If KEYWORDS-ONLY is non-nil,
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
39 syntactic fontification (strings and comments) is not performed.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
40 If CASE-FOLD is non-nil, the case of the keywords is ignored when fontifying.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
41 If SYNTAX-ALIST is non-nil, it should be a list of cons pairs of the form
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
42 \(CHAR-OR-STRING . STRING) used to set the local Font Lock syntax table, for
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
43 keyword and syntactic fontification (see `modify-syntax-entry').
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
44
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
45 If SYNTAX-BEGIN is non-nil, it should be a function with no args used to move
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
46 backwards outside any enclosing syntactic block, for syntactic fontification.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
47 Typical values are `beginning-of-line' (i.e., the start of the line is known to
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
48 be outside a syntactic block), or `beginning-of-defun' for programming modes or
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
49 `backward-paragraph' for textual modes (i.e., the mode-dependent function is
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
50 known to move outside a syntactic block). If nil, the beginning of the buffer
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
51 is used as a position outside of a syntactic block, in the worst case.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
52
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
53 These item elements are used by Font Lock mode to set the variables
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
54 `font-lock-keywords', `font-lock-keywords-only',
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
55 `font-lock-keywords-case-fold-search', `font-lock-syntax-table' and
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
56 `font-lock-beginning-of-syntax-function', respectively.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
57
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
58 Further item elements are alists of the form (VARIABLE . VALUE) and are in no
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
59 particular order. Each VARIABLE is made buffer-local before set to VALUE.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
60
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
61 Currently, appropriate variables include `font-lock-mark-block-function'.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
62 If this is non-nil, it should be a function with no args used to mark any
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
63 enclosing block of text, for fontification via \\[font-lock-fontify-block].
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
64 Typical values are `mark-defun' for programming modes or `mark-paragraph' for
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
65 textual modes (i.e., the mode-dependent function is known to put point and mark
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
66 around a text block relevant to that mode).
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
67
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
68 Other variables include that for syntactic keyword fontification,
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
69 `font-lock-syntactic-keywords'
47120
16d24d1d0e99 (font-lock-defaults): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 46975
diff changeset
70 and those for buffer-specialized fontification functions,
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
71 `font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function',
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
72 `font-lock-fontify-region-function', `font-lock-unfontify-region-function',
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
73 `font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.")
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
74 (make-variable-buffer-local 'font-lock-defaults)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
75
51719
1963828b8333 (font-lock-defaults-alist): Remove obsolete entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50595
diff changeset
76 (defvar font-lock-defaults-alist nil
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
77 "Alist of fall-back Font Lock defaults for major modes.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
78
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
79 Each item should be a list of the form:
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
80
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
81 (MAJOR-MODE . FONT-LOCK-DEFAULTS)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
82
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
83 where MAJOR-MODE is a symbol and FONT-LOCK-DEFAULTS is a list of default
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
84 settings. See the variable `font-lock-defaults', which takes precedence.")
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
85 (make-obsolete-variable 'font-lock-defaults-alist 'font-lock-defaults)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
86
45476
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
87 (defvar font-lock-function 'font-lock-default-function
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
88 "A function which is called when `font-lock-mode' is toggled.
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
89 It will be passed one argument, which is the current value of
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
90 `font-lock-mode'.")
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
91
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
92 (define-minor-mode font-lock-mode
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
93 "Toggle Font Lock mode.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
94 With arg, turn Font Lock mode off if and only if arg is a non-positive
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
95 number; if arg is nil, toggle Font Lock mode; anything else turns Font
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
96 Lock on.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
97 \(Font Lock is also known as \"syntax highlighting\".)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
98
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
99 When Font Lock mode is enabled, text is fontified as you type it:
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
100
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
101 - Comments are displayed in `font-lock-comment-face';
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
102 - Strings are displayed in `font-lock-string-face';
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
103 - Certain other expressions are displayed in other faces according to the
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
104 value of the variable `font-lock-keywords'.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
105
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
106 To customize the faces (colors, fonts, etc.) used by Font Lock for
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
107 fontifying different parts of buffer text, use \\[customize-face].
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
108
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
109 You can enable Font Lock mode in any major mode automatically by turning on in
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
110 the major mode's hook. For example, put in your ~/.emacs:
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
111
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
112 (add-hook 'c-mode-hook 'turn-on-font-lock)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
113
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
114 Alternatively, you can use Global Font Lock mode to automagically turn on Font
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
115 Lock mode in buffers whose major mode supports it and whose major mode is one
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
116 of `font-lock-global-modes'. For example, put in your ~/.emacs:
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
117
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
118 (global-font-lock-mode t)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
119
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
120 There are a number of support modes that may be used to speed up Font Lock mode
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
121 in various ways, specified via the variable `font-lock-support-mode'. Where
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
122 major modes support different levels of fontification, you can use the variable
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
123 `font-lock-maximum-decoration' to specify which level you generally prefer.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
124 When you turn Font Lock mode on/off the buffer is fontified/defontified, though
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
125 fontification occurs only if the buffer is less than `font-lock-maximum-size'.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
126
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
127 For example, to specify that Font Lock mode use use Lazy Lock mode as a support
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
128 mode and use maximum levels of fontification, put in your ~/.emacs:
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
129
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
130 (setq font-lock-support-mode 'lazy-lock-mode)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
131 (setq font-lock-maximum-decoration t)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
132
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
133 To add your own highlighting for some major mode, and modify the highlighting
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
134 selected automatically via the variable `font-lock-maximum-decoration', you can
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
135 use `font-lock-add-keywords'.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
136
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
137 To fontify a buffer, without turning on Font Lock mode and regardless of buffer
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
138 size, you can use \\[font-lock-fontify-buffer].
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
139
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
140 To fontify a block (the function or paragraph containing point, or a number of
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
141 lines around point), perhaps because modification on the current line caused
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
142 syntactic change on other lines, you can use \\[font-lock-fontify-block].
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
143
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
144 See the variable `font-lock-defaults-alist' for the Font Lock mode default
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
145 settings. You can set your own default settings for some mode, by setting a
45476
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
146 buffer local value for `font-lock-defaults', via its mode hook.
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
147
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
148 The above is the default behavior of `font-lock-mode'; you may specify
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
149 your own function which is called when `font-lock-mode' is toggled via
e1671f561407 (font-lock-function): New variable.
Colin Walters <walters@gnu.org>
parents: 45440
diff changeset
150 `font-lock-function'. "
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
151 nil nil nil
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
152 ;; Don't turn on Font Lock mode if we don't have a display (we're running a
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
153 ;; batch job) or if the buffer is invisible (the name starts with a space).
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
154 (when (or noninteractive (eq (aref (buffer-name) 0) ?\ ))
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
155 (setq font-lock-mode nil))
46906
421ce085a3cc (font-lock-mode): Add font-lock-unfontify-buffer
Richard M. Stallman <rms@gnu.org>
parents: 46899
diff changeset
156 (funcall font-lock-function font-lock-mode)
421ce085a3cc (font-lock-mode): Add font-lock-unfontify-buffer
Richard M. Stallman <rms@gnu.org>
parents: 46899
diff changeset
157 ;; Arrange to unfontify this buffer if we change major mode later.
421ce085a3cc (font-lock-mode): Add font-lock-unfontify-buffer
Richard M. Stallman <rms@gnu.org>
parents: 46899
diff changeset
158 (if font-lock-mode
46975
93d9d4da05cd (font-lock-change-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 46932
diff changeset
159 (add-hook 'change-major-mode-hook 'font-lock-change-mode nil t)
93d9d4da05cd (font-lock-change-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 46932
diff changeset
160 (remove-hook 'change-major-mode-hook 'font-lock-change-mode t)))
93d9d4da05cd (font-lock-change-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 46932
diff changeset
161
93d9d4da05cd (font-lock-change-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 46932
diff changeset
162 ;; Get rid of fontification for the old major mode.
93d9d4da05cd (font-lock-change-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 46932
diff changeset
163 ;; We do this when changing major modes.
93d9d4da05cd (font-lock-change-mode): New function.
Richard M. Stallman <rms@gnu.org>
parents: 46932
diff changeset
164 (defun font-lock-change-mode ()
47359
9da6d2e1b2ee (font-lock-change-mode): Just turn off font-lock-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47176
diff changeset
165 (font-lock-mode -1))
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
166
47374
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
167 (defun font-lock-defontify ()
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
168 "Clear out all `font-lock-face' properties in current buffer.
50595
7633f45262ae (font-lock-maximum-size, font-lock-verbose): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49692
diff changeset
169 A major mode that uses `font-lock-face' properties might want to put
47374
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
170 this function onto `change-major-mode-hook'."
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
171 (let ((modp (buffer-modified-p))
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
172 (inhibit-read-only t))
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
173 (save-restriction
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
174 (widen)
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
175 (remove-list-of-text-properties (point-min) (point-max)
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
176 '(font-lock-face)))
49692
1713a3efdd23 (font-lock-defontify): Use restore-buffer-modified-p.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49588
diff changeset
177 (restore-buffer-modified-p modp)))
47374
78178028d987 (font-lock-defontify): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47359
diff changeset
178
47359
9da6d2e1b2ee (font-lock-change-mode): Just turn off font-lock-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47176
diff changeset
179 (defun font-lock-default-function (mode)
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
180 ;; Turn on Font Lock mode.
47359
9da6d2e1b2ee (font-lock-change-mode): Just turn off font-lock-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47176
diff changeset
181 (when mode
45686
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
182 (set (make-local-variable 'char-property-alias-alist)
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
183 (copy-tree char-property-alias-alist))
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
184 ;; Add `font-lock-face' as an alias for the `face' property.
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
185 (let ((elt (assq 'face char-property-alias-alist)))
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
186 (if elt
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
187 (unless (memq 'font-lock-face (cdr elt))
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
188 (setcdr elt (nconc (cdr elt) (list 'font-lock-face))))
50595
7633f45262ae (font-lock-maximum-size, font-lock-verbose): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49692
diff changeset
189 (push (list 'face 'font-lock-face) char-property-alias-alist))))
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
190 ;; Turn off Font Lock mode.
47359
9da6d2e1b2ee (font-lock-change-mode): Just turn off font-lock-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47176
diff changeset
191 (unless mode
45686
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
192 ;; Remove `font-lock-face' as an alias for the `face' property.
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
193 (set (make-local-variable 'char-property-alias-alist)
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
194 (copy-tree char-property-alias-alist))
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
195 (let ((elt (assq 'face char-property-alias-alist)))
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
196 (when elt
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
197 (setcdr elt (remq 'font-lock-face (cdr elt)))
25d73d0e2b98 (font-lock-category-alist): Delete.
Colin Walters <walters@gnu.org>
parents: 45481
diff changeset
198 (when (null (cdr elt))
50595
7633f45262ae (font-lock-maximum-size, font-lock-verbose): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49692
diff changeset
199 (setq char-property-alias-alist
7633f45262ae (font-lock-maximum-size, font-lock-verbose): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49692
diff changeset
200 (delq elt char-property-alias-alist))))))
7633f45262ae (font-lock-maximum-size, font-lock-verbose): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49692
diff changeset
201
7633f45262ae (font-lock-maximum-size, font-lock-verbose): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49692
diff changeset
202 ;; Only do hard work if the mode has specified stuff in
7633f45262ae (font-lock-maximum-size, font-lock-verbose): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49692
diff changeset
203 ;; `font-lock-defaults'.
7633f45262ae (font-lock-maximum-size, font-lock-verbose): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49692
diff changeset
204 (when (or font-lock-defaults
59871
83af8894e534 (font-lock-default-function): Handle the rare case where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 52401
diff changeset
205 (and (boundp 'font-lock-keywords) font-lock-keywords)
60005
6e156606b5c5 (font-lock-default-function): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents: 59871
diff changeset
206 (with-no-warnings
6e156606b5c5 (font-lock-default-function): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents: 59871
diff changeset
207 (cdr (assq major-mode font-lock-defaults-alist))))
50595
7633f45262ae (font-lock-maximum-size, font-lock-verbose): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49692
diff changeset
208 (font-lock-mode-internal mode)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47374
diff changeset
209
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
210 (defun turn-on-font-lock ()
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
211 "Turn on Font Lock mode (only if the terminal can display it)."
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
212 (unless font-lock-mode
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
213 (font-lock-mode)))
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
214
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
215 ;;; Global Font Lock mode.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
216
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
217 ;; A few people have hassled in the past for a way to make it easier to turn on
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
218 ;; Font Lock mode, without the user needing to know for which modes s/he has to
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
219 ;; turn it on, perhaps the same way hilit19.el/hl319.el does. I've always
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
220 ;; balked at that way, as I see it as just re-moulding the same problem in
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
221 ;; another form. That is; some person would still have to keep track of which
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
222 ;; modes (which may not even be distributed with Emacs) support Font Lock mode.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
223 ;; The list would always be out of date. And that person might have to be me.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
224
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
225 ;; Implementation.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
226 ;;
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
227 ;; In a previous discussion the following hack came to mind. It is a gross
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
228 ;; hack, but it generally works. We use the convention that major modes start
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
229 ;; by calling the function `kill-all-local-variables', which in turn runs
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
230 ;; functions on the hook variable `change-major-mode-hook'. We attach our
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
231 ;; function `font-lock-change-major-mode' to that hook. Of course, when this
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
232 ;; hook is run, the major mode is in the process of being changed and we do not
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
233 ;; know what the final major mode will be. So, `font-lock-change-major-mode'
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
234 ;; only (a) notes the name of the current buffer, and (b) adds our function
46899
f00337f04e78 Use find-file-hook instead of find-file-hooks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46844
diff changeset
235 ;; `turn-on-font-lock-if-enabled' to the hook variables `find-file-hook' and
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
236 ;; `post-command-hook' (for buffers that are not visiting files). By the time
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
237 ;; the functions on the first of these hooks to be run are run, the new major
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
238 ;; mode is assumed to be in place. This way we get a Font Lock function run
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
239 ;; when a major mode is turned on, without knowing major modes or their hooks.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
240 ;;
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
241 ;; Naturally this requires that (a) major modes run `kill-all-local-variables',
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
242 ;; as they are supposed to do, and (b) the major mode is in place after the
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
243 ;; file is visited or the command that ran `kill-all-local-variables' has
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
244 ;; finished, whichever the sooner. Arguably, any major mode that does not
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
245 ;; follow the convension (a) is broken, and I can't think of any reason why (b)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
246 ;; would not be met (except `gnudoit' on non-files). However, it is not clean.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
247 ;;
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
248 ;; Probably the cleanest solution is to have each major mode function run some
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
249 ;; hook, e.g., `major-mode-hook', but maybe implementing that change is
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
250 ;; impractical. I am personally against making `setq' a macro or be advised,
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
251 ;; or have a special function such as `set-major-mode', but maybe someone can
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
252 ;; come up with another solution?
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
253
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
254 ;; User interface.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
255 ;;
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
256 ;; Although Global Font Lock mode is a pseudo-mode, I think that the user
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
257 ;; interface should conform to the usual Emacs convention for modes, i.e., a
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
258 ;; command to toggle the feature (`global-font-lock-mode') with a variable for
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
259 ;; finer control of the mode's behaviour (`font-lock-global-modes').
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
260 ;;
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
261 ;; The feature should not be enabled by loading font-lock.el, since other
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
262 ;; mechanisms for turning on Font Lock mode, such as M-x font-lock-mode RET or
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
263 ;; (add-hook 'c-mode-hook 'turn-on-font-lock), would cause Font Lock mode to be
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
264 ;; turned on everywhere. That would not be intuitive or informative because
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
265 ;; loading a file tells you nothing about the feature or how to control it. It
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
266 ;; would also be contrary to the Principle of Least Surprise. sm.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
267
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
268 (defcustom font-lock-global-modes t
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
269 "*Modes for which Font Lock mode is automagically turned on.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
270 Global Font Lock mode is controlled by the command `global-font-lock-mode'.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
271 If nil, means no modes have Font Lock mode automatically turned on.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
272 If t, all modes that support Font Lock mode have it automatically turned on.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
273 If a list, it should be a list of `major-mode' symbol names for which Font Lock
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
274 mode should be automatically turned on. The sense of the list is negated if it
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
275 begins with `not'. For example:
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
276 (c-mode c++-mode)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
277 means that Font Lock mode is turned on for buffers in C and C++ modes only."
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
278 :type '(choice (const :tag "none" nil)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
279 (const :tag "all" t)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
280 (set :menu-tag "mode specific" :tag "modes"
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
281 :value (not)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
282 (const :tag "Except" not)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
283 (repeat :inline t (symbol :tag "mode"))))
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
284 :group 'font-lock)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
285
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
286 (defun turn-on-font-lock-if-enabled ()
45760
1c3acb603967 font-core.el (font-lock-core-only): Variable deleted. All uses removed.
Colin Walters <walters@gnu.org>
parents: 45715
diff changeset
287 (unless (and (eq (car-safe font-lock-global-modes) 'not)
1c3acb603967 font-core.el (font-lock-core-only): Variable deleted. All uses removed.
Colin Walters <walters@gnu.org>
parents: 45715
diff changeset
288 (memq major-mode (cdr font-lock-global-modes)))
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
289 (let (inhibit-quit)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
290 (turn-on-font-lock))))
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
291
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
292 (easy-mmode-define-global-mode
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
293 global-font-lock-mode font-lock-mode turn-on-font-lock-if-enabled
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
294 :extra-args (dummy))
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
295
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
296 ;;; End of Global Font Lock mode.
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
297
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
298 (provide 'font-core)
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
299
59871
83af8894e534 (font-lock-default-function): Handle the rare case where
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 52401
diff changeset
300 ;; arch-tag: f8c286e1-02f7-41d9-b89b-1b67780aed71
45440
e879dd65b980 New file, broken out from font-lock.el.
Colin Walters <walters@gnu.org>
parents:
diff changeset
301 ;;; font-core.el ends here