aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-02-17 11:58:12 -0500
committerStefan Monnier2013-02-17 11:58:12 -0500
commit913274cbdc4a540f7c68dea45aec76845c50d94a (patch)
treeed3fbcc869a0848138c5869295ac5bcc99f0d0af
parent2f73da9c57872b084be2b0627092fa6d142f027f (diff)
downloademacs-913274cbdc4a540f7c68dea45aec76845c50d94a.tar.gz
emacs-913274cbdc4a540f7c68dea45aec76845c50d94a.zip
Don't use font-lock-syntax-table in lisp modes.
* lisp/font-lock.el (lisp-font-lock-keywords-1, lisp-font-lock-keywords-2): Don't assume all identifier chars have syntax word. * lisp/emacs-lisp/lisp-mode.el (lisp-mode-variables): Remove bar-not-symbol. Adjust callers. (lisp-mode-variables): Don't set a font-lock-syntax-table.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/emacs-lisp/lisp-mode.el12
-rw-r--r--lisp/font-lock.el30
3 files changed, 30 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 77759eee9a1..0e49ef8c242 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12013-02-17 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * font-lock.el (lisp-font-lock-keywords-1, lisp-font-lock-keywords-2):
4 Don't assume all identifier chars have syntax word.
5 * emacs-lisp/lisp-mode.el (lisp-mode-variables):
6 Remove bar-not-symbol. Adjust callers.
7 (lisp-mode-variables): Don't set a font-lock-syntax-table.
8
12013-02-17 Leo Liu <sdl.web@gmail.com> 92013-02-17 Leo Liu <sdl.web@gmail.com>
2 10
3 * net/rcirc.el (rcirc-keepalive): Fix invalid timer error. 11 * net/rcirc.el (rcirc-keepalive): Fix invalid timer error.
@@ -32,8 +40,8 @@
32 40
33 * net/tramp-compat.el (top): Require 'trampver. 41 * net/tramp-compat.el (top): Require 'trampver.
34 42
35 * net/tramp-sh.el (tramp-remote-process-environment): Set 43 * net/tramp-sh.el (tramp-remote-process-environment):
36 tramp-autoload cookie. 44 Set tramp-autoload cookie.
37 45
382013-02-16 Kevin Ryde <user42@zip.com.au> 462013-02-16 Kevin Ryde <user42@zip.com.au>
39 47
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index cd60d80b056..4ebaa0a49d5 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -187,14 +187,12 @@ It has `lisp-mode-abbrev-table' as its parent."
187 font-lock-string-face)))) 187 font-lock-string-face))))
188 font-lock-comment-face)) 188 font-lock-comment-face))
189 189
190(defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive 190(defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive)
191 bar-not-symbol)
192 "Common initialization routine for lisp modes. 191 "Common initialization routine for lisp modes.
193The LISP-SYNTAX argument is used by code in inf-lisp.el and is 192The LISP-SYNTAX argument is used by code in inf-lisp.el and is
194\(uselessly) passed from pp.el, chistory.el, gnus-kill.el and 193\(uselessly) passed from pp.el, chistory.el, gnus-kill.el and
195score-mode.el. KEYWORDS-CASE-INSENSITIVE non-nil means that for 194score-mode.el. KEYWORDS-CASE-INSENSITIVE non-nil means that for
196font-lock keywords will not be case sensitive. BAR-NOT-SYMBOL 195font-lock keywords will not be case sensitive."
197non-nil means that | is not a symbol character."
198 (when lisp-syntax 196 (when lisp-syntax
199 (set-syntax-table lisp-mode-syntax-table)) 197 (set-syntax-table lisp-mode-syntax-table))
200 (setq-local paragraph-ignore-fill-prefix t) 198 (setq-local paragraph-ignore-fill-prefix t)
@@ -228,9 +226,7 @@ non-nil means that | is not a symbol character."
228 (setq font-lock-defaults 226 (setq font-lock-defaults
229 `((lisp-font-lock-keywords 227 `((lisp-font-lock-keywords
230 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) 228 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2)
231 nil ,keywords-case-insensitive 229 nil ,keywords-case-insensitive nil nil
232 ((,(concat "+-*/.<>=!?$%_&~^:@" (if bar-not-symbol "" "|")) . "w"))
233 nil
234 (font-lock-mark-block-function . mark-defun) 230 (font-lock-mark-block-function . mark-defun)
235 (font-lock-syntactic-face-function 231 (font-lock-syntactic-face-function
236 . lisp-font-lock-syntactic-face-function)))) 232 . lisp-font-lock-syntactic-face-function))))
@@ -553,7 +549,7 @@ or to switch back to an existing one.
553 549
554Entry to this mode calls the value of `lisp-mode-hook' 550Entry to this mode calls the value of `lisp-mode-hook'
555if that value is non-nil." 551if that value is non-nil."
556 (lisp-mode-variables nil t t) 552 (lisp-mode-variables nil t)
557 (setq-local find-tag-default-function 'lisp-find-tag-default) 553 (setq-local find-tag-default-function 'lisp-find-tag-default)
558 (setq-local comment-start-skip 554 (setq-local comment-start-skip
559 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") 555 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 6e3476ac9a5..e5ce4db171b 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -2259,10 +2259,10 @@ in which C preprocessor directives are used. e.g. `asm-mode' and
2259 "\\(const\\(ant\\)?\\|custom\\|varalias\\|face\\|parameter\\|var\\(?:-local\\)?\\)\\|" 2259 "\\(const\\(ant\\)?\\|custom\\|varalias\\|face\\|parameter\\|var\\(?:-local\\)?\\)\\|"
2260 ;; Structure declarations. 2260 ;; Structure declarations.
2261 "\\(class\\|group\\|theme\\|package\\|struct\\|type\\)" 2261 "\\(class\\|group\\|theme\\|package\\|struct\\|type\\)"
2262 "\\)\\)\\>" 2262 "\\)\\)\\_>"
2263 ;; Any whitespace and defined object. 2263 ;; Any whitespace and defined object.
2264 "[ \t'\(]*" 2264 "[ \t'\(]*"
2265 "\\(setf[ \t]+\\sw+\\|\\sw+\\)?") 2265 "\\(setf[ \t]+\\(?:\\sw\\|\\s_\\)+\\|\\(?:\\sw\\|\\s_\\)+\\)?")
2266 (1 font-lock-keyword-face) 2266 (1 font-lock-keyword-face)
2267 (9 (cond ((match-beginning 3) font-lock-function-name-face) 2267 (9 (cond ((match-beginning 3) font-lock-function-name-face)
2268 ((match-beginning 6) font-lock-variable-name-face) 2268 ((match-beginning 6) font-lock-variable-name-face)
@@ -2299,7 +2299,7 @@ in which C preprocessor directives are used. e.g. `asm-mode' and
2299 "with-silent-modifications" "with-syntax-table" 2299 "with-silent-modifications" "with-syntax-table"
2300 "with-temp-buffer" "with-temp-file" "with-temp-message" 2300 "with-temp-buffer" "with-temp-file" "with-temp-message"
2301 "with-timeout" "with-timeout-handler" "with-wrapper-hook") t) 2301 "with-timeout" "with-timeout-handler" "with-wrapper-hook") t)
2302 "\\>") 2302 "\\_>")
2303 . 1) 2303 . 1)
2304 ;; Control structures. Common Lisp forms. 2304 ;; Control structures. Common Lisp forms.
2305 (,(concat 2305 (,(concat
@@ -2320,23 +2320,25 @@ in which C preprocessor directives are used. e.g. `asm-mode' and
2320 "with-open-stream" "with-output-to-string" 2320 "with-open-stream" "with-output-to-string"
2321 "with-package-iterator" "with-simple-restart" 2321 "with-package-iterator" "with-simple-restart"
2322 "with-slots" "with-standard-io-syntax") t) 2322 "with-slots" "with-standard-io-syntax") t)
2323 "\\>") 2323 "\\_>")
2324 . 1) 2324 . 1)
2325 ;; Exit/Feature symbols as constants. 2325 ;; Exit/Feature symbols as constants.
2326 (,(concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\>" 2326 (,(concat "(\\(catch\\|throw\\|featurep\\|provide\\|require\\)\\>"
2327 "[ \t']*\\(\\sw+\\)?") 2327 "[ \t']*\\(\\(?:\\sw\\|\\s_\\)+\\)?")
2328 (1 font-lock-keyword-face) 2328 (1 font-lock-keyword-face)
2329 (2 font-lock-constant-face nil t)) 2329 (2 font-lock-constant-face nil t))
2330 ;; Erroneous structures. 2330 ;; Erroneous structures.
2331 ("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\>" 1 font-lock-warning-face) 2331 ("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\>" 1 font-lock-warning-face)
2332 ;; Words inside \\[] tend to be for `substitute-command-keys'. 2332 ;; Words inside \\[] tend to be for `substitute-command-keys'.
2333 ("\\\\\\\\\\[\\(\\sw+\\)\\]" 1 font-lock-constant-face prepend) 2333 ("\\\\\\\\\\[\\(\\(?:\\sw\\|\\s_\\)+\\)\\]"
2334 (1 font-lock-constant-face prepend))
2334 ;; Words inside `' tend to be symbol names. 2335 ;; Words inside `' tend to be symbol names.
2335 ("`\\(\\sw\\sw+\\)'" 1 font-lock-constant-face prepend) 2336 ("`\\(\\(?:\\sw\\|\\s_\\)\\(?:\\sw\\|\\s_\\)+\\)'"
2337 (1 font-lock-constant-face prepend))
2336 ;; Constant values. 2338 ;; Constant values.
2337 ("\\<:\\sw+\\>" 0 font-lock-builtin-face) 2339 ("\\<:\\(?:\\sw\\|\\s_\\)+\\>" 0 font-lock-builtin-face)
2338 ;; ELisp and CLisp `&' keywords as types. 2340 ;; ELisp and CLisp `&' keywords as types.
2339 ("\\<\\&\\sw+\\>" . font-lock-type-face) 2341 ("\\<\\&\\(?:\\sw\\|\\s_\\)+\\>" . font-lock-type-face)
2340 ;; ELisp regexp grouping constructs 2342 ;; ELisp regexp grouping constructs
2341 ((lambda (bound) 2343 ((lambda (bound)
2342 (catch 'found 2344 (catch 'found
@@ -2353,11 +2355,11 @@ in which C preprocessor directives are used. e.g. `asm-mode' and
2353 (throw 'found t))))))) 2355 (throw 'found t)))))))
2354 (1 'font-lock-regexp-grouping-backslash prepend) 2356 (1 'font-lock-regexp-grouping-backslash prepend)
2355 (3 'font-lock-regexp-grouping-construct prepend)) 2357 (3 'font-lock-regexp-grouping-construct prepend))
2356;;; This is too general -- rms. 2358 ;; This is too general -- rms.
2357;;; A user complained that he has functions whose names start with `do' 2359 ;; A user complained that he has functions whose names start with `do'
2358;;; and that they get the wrong color. 2360 ;; and that they get the wrong color.
2359;;; ;; CL `with-' and `do-' constructs 2361 ;; ;; CL `with-' and `do-' constructs
2360;;; ("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face) 2362 ;;("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face)
2361 ))) 2363 )))
2362 "Gaudy level highlighting for Lisp modes.") 2364 "Gaudy level highlighting for Lisp modes.")
2363 2365