diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-09-17 20:33:55 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-09-17 20:33:55 -0400 |
commit | 644c6b414f39222890246d7fe155a369b1983246 (patch) | |
tree | 79419f8bf3b77624013dfa105b69155c14c65844 /lisp | |
parent | 284c470ef752967fcd8bae6a450dc138462b1e49 (diff) | |
download | emacs-644c6b414f39222890246d7fe155a369b1983246.tar.gz |
* lisp/font-lock.el (font-lock-beginning-of-syntax-function): Remove
(font-lock-fontify-block): Don't let-bind it.
(font-lock-compile-keywords): Don't use it.
(font-lock-set-defaults): Don't set it. Allow the variable alist to
start one slot earlier, instead.
* lisp/emacs-lisp/syntax.el (font-lock-beginning-of-syntax-function):
Don't declare.
(syntax-ppss): Don't use it either.
* lisp/font-core.el (font-lock-defaults): Remove SYNTAX-BEGIN
from docstring.
* doc/emacs/display.texi (Font Lock): Don't mention
font-lock-beginning-of-syntax-function.
* doc/lispref/modes.texi (Font Lock Basics): Update description of
font-lock-defaults.
(Syntactic Font Lock): Remove font-lock-beginning-of-syntax-function.
* lisp/loadhist.el (unload-feature-special-hooks):
Remove font-lock-beginning-of-syntax-function.
* lisp/obsolete/lazy-lock.el (lazy-lock-fontify-region):
* lisp/emacs-lisp/lisp.el (beginning-of-defun-raw): Don't let-bind
font-lock-beginning-of-syntax-function.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emacs-lisp/lisp.el | 3 | ||||
-rw-r--r-- | lisp/emacs-lisp/syntax.el | 7 | ||||
-rw-r--r-- | lisp/font-core.el | 15 | ||||
-rw-r--r-- | lisp/font-lock.el | 34 | ||||
-rw-r--r-- | lisp/jit-lock.el | 8 | ||||
-rw-r--r-- | lisp/loadhist.el | 1 | ||||
-rw-r--r-- | lisp/obsolete/lazy-lock.el | 3 |
7 files changed, 11 insertions, 60 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 7b7b48c66de..ca977db4b1d 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -364,8 +364,7 @@ is called as a function to find the defun's beginning." (arg-+ve (> arg 0))) (save-restriction (widen) - (let ((ppss (let (syntax-begin-function - font-lock-beginning-of-syntax-function) + (let ((ppss (let (syntax-begin-function) (syntax-ppss))) ;; position of least enclosing paren, or nil. encl-pos) diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 51019254943..fee62149b38 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -43,8 +43,6 @@ (eval-when-compile (require 'cl-lib)) -(defvar font-lock-beginning-of-syntax-function) - ;;; Applying syntax-table properties where needed. (defvar syntax-propertize-function nil @@ -503,11 +501,6 @@ running the hook." ;; - The function might be slow. ;; - If this function almost always finds a safe nearby spot, ;; the cache won't be populated, so consulting it is cheap. - (when (and (not syntax-begin-function) - (boundp 'font-lock-beginning-of-syntax-function) - font-lock-beginning-of-syntax-function) - (set (make-local-variable 'syntax-begin-function) - font-lock-beginning-of-syntax-function)) (when (and syntax-begin-function (progn (goto-char pos) (funcall syntax-begin-function) diff --git a/lisp/font-core.el b/lisp/font-core.el index 6d8588bfa33..2253204d9f7 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el @@ -30,7 +30,7 @@ "Defaults for Font Lock mode specified by the major mode. Defaults should be of the form: - (KEYWORDS [KEYWORDS-ONLY [CASE-FOLD [SYNTAX-ALIST [SYNTAX-BEGIN ...]]]]) + (KEYWORDS [KEYWORDS-ONLY [CASE-FOLD [SYNTAX-ALIST ...]]]) KEYWORDS may be a symbol (a variable or function whose value is the keywords to use for fontification) or a list of symbols (specifying different levels @@ -45,20 +45,9 @@ If SYNTAX-ALIST is non-nil, it should be a list of cons pairs of the form \(CHAR-OR-STRING . STRING) used to set the local Font Lock syntax table, for keyword and syntactic fontification (see `modify-syntax-entry'). -If SYNTAX-BEGIN is non-nil, it should be a function with no args used to move -backwards outside any enclosing syntactic block, for syntactic fontification. -Typical values are `beginning-of-line' (i.e., the start of the line is known to -be outside a syntactic block), or `beginning-of-defun' for programming modes or -`backward-paragraph' for textual modes (i.e., the mode-dependent function is -known to move outside a syntactic block). If nil, the beginning of the buffer -is used as a position outside of a syntactic block, in the worst case. - -\(See also Info node `(elisp)Font Lock Basics'.) - These item elements are used by Font Lock mode to set the variables `font-lock-keywords', `font-lock-keywords-only', -`font-lock-keywords-case-fold-search', `font-lock-syntax-table' and -`font-lock-beginning-of-syntax-function', respectively. +`font-lock-keywords-case-fold-search', `font-lock-syntax-table'. Further item elements are alists of the form (VARIABLE . VALUE) and are in no particular order. Each VARIABLE is made buffer-local before set to VALUE. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index cec95bf259c..d93cf7184ca 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -556,21 +556,6 @@ This is normally set via `font-lock-defaults'.") If this is nil, the major mode's syntax table is used. This is normally set via `font-lock-defaults'.") -(defvar font-lock-beginning-of-syntax-function nil - "Non-nil means use this function to move back outside all constructs. -When called with no args it should move point backward to a place which -is not in a string or comment and not within any bracket-pairs (or else, -a place such that any bracket-pairs outside it can be ignored for Emacs -syntax analysis and fontification). - -If this is nil, Font Lock uses `syntax-begin-function' to move back -outside of any comment, string, or sexp. This variable is semi-obsolete; -we recommend setting `syntax-begin-function' instead. - -This is normally set via `font-lock-defaults'.") -(make-obsolete-variable 'font-lock-beginning-of-syntax-function - 'syntax-begin-function "23.3" 'set) - (defvar font-lock-mark-block-function nil "Non-nil means use this function to mark a block of text. When called with no args it should leave point at the beginning of any @@ -1347,7 +1332,7 @@ no ARG is given and `font-lock-mark-block-function' is nil. If `font-lock-mark-block-function' non-nil and no ARG is given, it is used to delimit the region to fontify." (interactive "P") - (let ((inhibit-point-motion-hooks t) font-lock-beginning-of-syntax-function + (let ((inhibit-point-motion-hooks t) deactivate-mark) ;; Make sure we have the right `font-lock-keywords' etc. (if (not font-lock-mode) (font-lock-set-defaults)) @@ -1765,9 +1750,7 @@ If SYNTACTIC-KEYWORDS is non-nil, it means these keywords are used for (cons t (cons keywords (mapcar #'font-lock-compile-keyword keywords)))) (if (and (not syntactic-keywords) - (let ((beg-function - (or font-lock-beginning-of-syntax-function - syntax-begin-function))) + (let ((beg-function syntax-begin-function)) (or (eq beg-function 'beginning-of-defun) (get beg-function 'font-lock-syntax-paren-check))) (not beginning-of-defun-function)) @@ -1890,17 +1873,14 @@ Sets various variables using `font-lock-defaults' and (list (car selem)) (mapcar 'identity (car selem)))) (modify-syntax-entry char syntax font-lock-syntax-table))))) - ;; Syntax function for syntactic fontification? - (if (nth 4 defaults) - (set (make-local-variable 'font-lock-beginning-of-syntax-function) - (nth 4 defaults)) - (kill-local-variable 'font-lock-beginning-of-syntax-function)) + ;; (nth 4 defaults) used to hold `font-lock-beginning-of-syntax-function', + ;; but that was removed in 25.1, so if it's a cons cell, we assume that + ;; it's part of the variable alist. ;; Variable alist? - (dolist (x (nthcdr 5 defaults)) + (dolist (x (nthcdr (if (consp (nth 4 defaults)) 4 5) defaults)) (set (make-local-variable (car x)) (cdr x))) ;; Set up `font-lock-keywords' last because its value might depend - ;; on other settings (e.g. font-lock-compile-keywords uses - ;; font-lock-beginning-of-syntax-function). + ;; on other settings. (set (make-local-variable 'font-lock-keywords) (font-lock-eval-keywords keywords)) ;; Local fontification? diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index 8c798d5c4d0..4e8fa7b15cb 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -382,14 +382,6 @@ Defaults to the whole buffer. END can be out of bounds." (save-excursion (unless start (setq start (point-min))) (setq end (if end (min end (point-max)) (point-max))) - ;; This did bind `font-lock-beginning-of-syntax-function' to - ;; nil at some point, for an unknown reason. Don't do this; it - ;; can make highlighting slow due to expensive calls to - ;; `parse-partial-sexp' in function - ;; `font-lock-fontify-syntactically-region'. Example: paging - ;; from the end of a buffer to its start, can do repeated - ;; `parse-partial-sexp' starting from `point-min', which can - ;; take a long time in a large buffer. (let ((orig-start start) next) (save-match-data ;; Fontify chunks beginning at START. The end of a diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 52fd04736f6..4ea1bcb9f50 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -123,7 +123,6 @@ from a file." delete-frame-functions disabled-command-function fill-nobreak-predicate find-directory-functions find-file-not-found-functions - font-lock-beginning-of-syntax-function font-lock-fontify-buffer-function font-lock-fontify-region-function font-lock-mark-block-function diff --git a/lisp/obsolete/lazy-lock.el b/lisp/obsolete/lazy-lock.el index 79afd80813f..d05a7d86dbc 100644 --- a/lisp/obsolete/lazy-lock.el +++ b/lisp/obsolete/lazy-lock.el @@ -892,8 +892,7 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'." (save-excursion (save-match-data (save-buffer-state - ;; Ensure syntactic fontification is always correct. - (font-lock-beginning-of-syntax-function next) + (next) ;; Find successive unfontified regions between BEG and END. (condition-case data (do-while beg |