aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2015-09-17 20:33:55 -0400
committerStefan Monnier2015-09-17 20:33:55 -0400
commit644c6b414f39222890246d7fe155a369b1983246 (patch)
tree79419f8bf3b77624013dfa105b69155c14c65844
parent284c470ef752967fcd8bae6a450dc138462b1e49 (diff)
downloademacs-644c6b414f39222890246d7fe155a369b1983246.tar.gz
emacs-644c6b414f39222890246d7fe155a369b1983246.zip
* 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.
-rw-r--r--doc/emacs/display.texi14
-rw-r--r--doc/lispref/modes.texi27
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/emacs-lisp/lisp.el3
-rw-r--r--lisp/emacs-lisp/syntax.el7
-rw-r--r--lisp/font-core.el15
-rw-r--r--lisp/font-lock.el34
-rw-r--r--lisp/jit-lock.el8
-rw-r--r--lisp/loadhist.el1
-rw-r--r--lisp/obsolete/lazy-lock.el3
10 files changed, 15 insertions, 100 deletions
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index 7b90e19991b..7aef52d99d5 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -854,7 +854,6 @@ and the default level otherwise, use the value
854'((c-mode . 1) (c++-mode . 1))) 854'((c-mode . 1) (c++-mode . 1)))
855@end example 855@end example
856 856
857@vindex font-lock-beginning-of-syntax-function
858@cindex incorrect fontification 857@cindex incorrect fontification
859@cindex parenthesis in column zero and fontification 858@cindex parenthesis in column zero and fontification
860@cindex brace in column zero and fontification 859@cindex brace in column zero and fontification
@@ -867,19 +866,6 @@ any string or comment. Therefore, you should avoid placing an
867open-parenthesis or open-brace in the leftmost column, if it is inside 866open-parenthesis or open-brace in the leftmost column, if it is inside
868a string or comment. @xref{Left Margin Paren}, for details. 867a string or comment. @xref{Left Margin Paren}, for details.
869 868
870@cindex slow display during scrolling
871 The variable @code{font-lock-beginning-of-syntax-function}, which is
872always buffer-local, specifies how Font Lock mode can find a position
873guaranteed to be outside any comment or string. In modes which use
874the leftmost column parenthesis convention, the default value of the
875variable is @code{beginning-of-defun}---that tells Font Lock mode to
876use the convention. If you set this variable to @code{nil}, Font Lock
877no longer relies on the convention. This avoids incorrect results,
878but the price is that, in some cases, fontification for a changed text
879must rescan buffer text from the beginning of the buffer. This can
880considerably slow down redisplay while scrolling, particularly if you
881are close to the end of a large buffer.
882
883@findex font-lock-add-keywords 869@findex font-lock-add-keywords
884 Font Lock highlighting patterns already exist for most modes, but 870 Font Lock highlighting patterns already exist for most modes, but
885you may want to fontify additional patterns. You can use the function 871you may want to fontify additional patterns. You can use the function
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 8d7e29f9eef..a1747707d11 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -2527,7 +2527,7 @@ If non-@code{nil}, the value should look like this:
2527 2527
2528@example 2528@example
2529(@var{keywords} [@var{keywords-only} [@var{case-fold} 2529(@var{keywords} [@var{keywords-only} [@var{case-fold}
2530 [@var{syntax-alist} [@var{syntax-begin} @var{other-vars}@dots{}]]]]) 2530 [@var{syntax-alist} @var{other-vars}@dots{}]]])
2531@end example 2531@end example
2532 2532
2533The first element, @var{keywords}, indirectly specifies the value of 2533The first element, @var{keywords}, indirectly specifies the value of
@@ -2559,11 +2559,6 @@ fontification; the resulting syntax table is stored in
2559@code{nil}, syntactic fontification uses the syntax table returned by 2559@code{nil}, syntactic fontification uses the syntax table returned by
2560the @code{syntax-table} function. @xref{Syntax Table Functions}. 2560the @code{syntax-table} function. @xref{Syntax Table Functions}.
2561 2561
2562The fifth element, @var{syntax-begin}, specifies the value of
2563@code{font-lock-beginning-of-syntax-function}. We recommend setting
2564this variable to @code{nil} and using @code{syntax-begin-function}
2565instead.
2566
2567All the remaining elements (if any) are collectively called 2562All the remaining elements (if any) are collectively called
2568@var{other-vars}. Each of these elements should have the form 2563@var{other-vars}. Each of these elements should have the form
2569@code{(@var{variable} . @var{value})}---which means, make 2564@code{(@var{variable} . @var{value})}---which means, make
@@ -3124,26 +3119,6 @@ is @code{nil}, syntactic fontification uses the buffer's syntax table
3124Table Functions}). 3119Table Functions}).
3125@end defvar 3120@end defvar
3126 3121
3127@defvar font-lock-beginning-of-syntax-function
3128If this variable is non-@code{nil}, it should be a function to move
3129point back to a position that is syntactically at top level and
3130outside of strings or comments. The value is normally set through an
3131@var{other-vars} element in @code{font-lock-defaults}. If it is
3132@code{nil}, Font Lock uses @code{syntax-begin-function} to move back
3133outside of any comment, string, or sexp (@pxref{Position Parse}).
3134
3135This variable is semi-obsolete; we usually recommend setting
3136@code{syntax-begin-function} instead. One of its uses is to tune the
3137behavior of syntactic fontification, e.g., to ensure that different
3138kinds of strings or comments are highlighted differently.
3139
3140The specified function is called with no arguments. It should leave
3141point at the beginning of any enclosing syntactic block. Typical values
3142are @code{beginning-of-line} (used when the start of the line is known
3143to be outside a syntactic block), or @code{beginning-of-defun} for
3144programming modes, or @code{backward-paragraph} for textual modes.
3145@end defvar
3146
3147@defvar font-lock-syntactic-face-function 3122@defvar font-lock-syntactic-face-function
3148If this variable is non-@code{nil}, it should be a function to determine 3123If this variable is non-@code{nil}, it should be a function to determine
3149which face to use for a given syntactic element (a string or a comment). 3124which face to use for a given syntactic element (a string or a comment).
diff --git a/etc/NEWS b/etc/NEWS
index 49ce9b7eb08..b5c52e311ee 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -856,6 +856,9 @@ a typographically-correct documents.
856 856
857* Incompatible Lisp Changes in Emacs 25.1 857* Incompatible Lisp Changes in Emacs 25.1
858 858
859** Removed font-lock-beginning-of-syntax-function and the SYNTAX-BEGIN
860slot in font-lock-defaults.
861
859+++ 862+++
860** `package-initialize' now sets `package-enable-at-startup' to nil if 863** `package-initialize' now sets `package-enable-at-startup' to nil if
861called during startup. Users who call this function in their init 864called during startup. Users who call this function in their init
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."
364 (arg-+ve (> arg 0))) 364 (arg-+ve (> arg 0)))
365 (save-restriction 365 (save-restriction
366 (widen) 366 (widen)
367 (let ((ppss (let (syntax-begin-function 367 (let ((ppss (let (syntax-begin-function)
368 font-lock-beginning-of-syntax-function)
369 (syntax-ppss))) 368 (syntax-ppss)))
370 ;; position of least enclosing paren, or nil. 369 ;; position of least enclosing paren, or nil.
371 encl-pos) 370 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 @@
43 43
44(eval-when-compile (require 'cl-lib)) 44(eval-when-compile (require 'cl-lib))
45 45
46(defvar font-lock-beginning-of-syntax-function)
47
48;;; Applying syntax-table properties where needed. 46;;; Applying syntax-table properties where needed.
49 47
50(defvar syntax-propertize-function nil 48(defvar syntax-propertize-function nil
@@ -503,11 +501,6 @@ running the hook."
503 ;; - The function might be slow. 501 ;; - The function might be slow.
504 ;; - If this function almost always finds a safe nearby spot, 502 ;; - If this function almost always finds a safe nearby spot,
505 ;; the cache won't be populated, so consulting it is cheap. 503 ;; the cache won't be populated, so consulting it is cheap.
506 (when (and (not syntax-begin-function)
507 (boundp 'font-lock-beginning-of-syntax-function)
508 font-lock-beginning-of-syntax-function)
509 (set (make-local-variable 'syntax-begin-function)
510 font-lock-beginning-of-syntax-function))
511 (when (and syntax-begin-function 504 (when (and syntax-begin-function
512 (progn (goto-char pos) 505 (progn (goto-char pos)
513 (funcall syntax-begin-function) 506 (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 @@
30 "Defaults for Font Lock mode specified by the major mode. 30 "Defaults for Font Lock mode specified by the major mode.
31Defaults should be of the form: 31Defaults should be of the form:
32 32
33 (KEYWORDS [KEYWORDS-ONLY [CASE-FOLD [SYNTAX-ALIST [SYNTAX-BEGIN ...]]]]) 33 (KEYWORDS [KEYWORDS-ONLY [CASE-FOLD [SYNTAX-ALIST ...]]])
34 34
35KEYWORDS may be a symbol (a variable or function whose value is the keywords 35KEYWORDS may be a symbol (a variable or function whose value is the keywords
36to use for fontification) or a list of symbols (specifying different levels 36to 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
45\(CHAR-OR-STRING . STRING) used to set the local Font Lock syntax table, for 45\(CHAR-OR-STRING . STRING) used to set the local Font Lock syntax table, for
46keyword and syntactic fontification (see `modify-syntax-entry'). 46keyword and syntactic fontification (see `modify-syntax-entry').
47 47
48If SYNTAX-BEGIN is non-nil, it should be a function with no args used to move
49backwards outside any enclosing syntactic block, for syntactic fontification.
50Typical values are `beginning-of-line' (i.e., the start of the line is known to
51be outside a syntactic block), or `beginning-of-defun' for programming modes or
52`backward-paragraph' for textual modes (i.e., the mode-dependent function is
53known to move outside a syntactic block). If nil, the beginning of the buffer
54is used as a position outside of a syntactic block, in the worst case.
55
56\(See also Info node `(elisp)Font Lock Basics'.)
57
58These item elements are used by Font Lock mode to set the variables 48These item elements are used by Font Lock mode to set the variables
59`font-lock-keywords', `font-lock-keywords-only', 49`font-lock-keywords', `font-lock-keywords-only',
60`font-lock-keywords-case-fold-search', `font-lock-syntax-table' and 50`font-lock-keywords-case-fold-search', `font-lock-syntax-table'.
61`font-lock-beginning-of-syntax-function', respectively.
62 51
63Further item elements are alists of the form (VARIABLE . VALUE) and are in no 52Further item elements are alists of the form (VARIABLE . VALUE) and are in no
64particular order. Each VARIABLE is made buffer-local before set to VALUE. 53particular 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'.")
556If this is nil, the major mode's syntax table is used. 556If this is nil, the major mode's syntax table is used.
557This is normally set via `font-lock-defaults'.") 557This is normally set via `font-lock-defaults'.")
558 558
559(defvar font-lock-beginning-of-syntax-function nil
560 "Non-nil means use this function to move back outside all constructs.
561When called with no args it should move point backward to a place which
562is not in a string or comment and not within any bracket-pairs (or else,
563a place such that any bracket-pairs outside it can be ignored for Emacs
564syntax analysis and fontification).
565
566If this is nil, Font Lock uses `syntax-begin-function' to move back
567outside of any comment, string, or sexp. This variable is semi-obsolete;
568we recommend setting `syntax-begin-function' instead.
569
570This is normally set via `font-lock-defaults'.")
571(make-obsolete-variable 'font-lock-beginning-of-syntax-function
572 'syntax-begin-function "23.3" 'set)
573
574(defvar font-lock-mark-block-function nil 559(defvar font-lock-mark-block-function nil
575 "Non-nil means use this function to mark a block of text. 560 "Non-nil means use this function to mark a block of text.
576When called with no args it should leave point at the beginning of any 561When 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.
1347If `font-lock-mark-block-function' non-nil and no ARG is given, it is used to 1332If `font-lock-mark-block-function' non-nil and no ARG is given, it is used to
1348delimit the region to fontify." 1333delimit the region to fontify."
1349 (interactive "P") 1334 (interactive "P")
1350 (let ((inhibit-point-motion-hooks t) font-lock-beginning-of-syntax-function 1335 (let ((inhibit-point-motion-hooks t)
1351 deactivate-mark) 1336 deactivate-mark)
1352 ;; Make sure we have the right `font-lock-keywords' etc. 1337 ;; Make sure we have the right `font-lock-keywords' etc.
1353 (if (not font-lock-mode) (font-lock-set-defaults)) 1338 (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
1765 (cons t (cons keywords 1750 (cons t (cons keywords
1766 (mapcar #'font-lock-compile-keyword keywords)))) 1751 (mapcar #'font-lock-compile-keyword keywords))))
1767 (if (and (not syntactic-keywords) 1752 (if (and (not syntactic-keywords)
1768 (let ((beg-function 1753 (let ((beg-function syntax-begin-function))
1769 (or font-lock-beginning-of-syntax-function
1770 syntax-begin-function)))
1771 (or (eq beg-function 'beginning-of-defun) 1754 (or (eq beg-function 'beginning-of-defun)
1772 (get beg-function 'font-lock-syntax-paren-check))) 1755 (get beg-function 'font-lock-syntax-paren-check)))
1773 (not beginning-of-defun-function)) 1756 (not beginning-of-defun-function))
@@ -1890,17 +1873,14 @@ Sets various variables using `font-lock-defaults' and
1890 (list (car selem)) 1873 (list (car selem))
1891 (mapcar 'identity (car selem)))) 1874 (mapcar 'identity (car selem))))
1892 (modify-syntax-entry char syntax font-lock-syntax-table))))) 1875 (modify-syntax-entry char syntax font-lock-syntax-table)))))
1893 ;; Syntax function for syntactic fontification? 1876 ;; (nth 4 defaults) used to hold `font-lock-beginning-of-syntax-function',
1894 (if (nth 4 defaults) 1877 ;; but that was removed in 25.1, so if it's a cons cell, we assume that
1895 (set (make-local-variable 'font-lock-beginning-of-syntax-function) 1878 ;; it's part of the variable alist.
1896 (nth 4 defaults))
1897 (kill-local-variable 'font-lock-beginning-of-syntax-function))
1898 ;; Variable alist? 1879 ;; Variable alist?
1899 (dolist (x (nthcdr 5 defaults)) 1880 (dolist (x (nthcdr (if (consp (nth 4 defaults)) 4 5) defaults))
1900 (set (make-local-variable (car x)) (cdr x))) 1881 (set (make-local-variable (car x)) (cdr x)))
1901 ;; Set up `font-lock-keywords' last because its value might depend 1882 ;; Set up `font-lock-keywords' last because its value might depend
1902 ;; on other settings (e.g. font-lock-compile-keywords uses 1883 ;; on other settings.
1903 ;; font-lock-beginning-of-syntax-function).
1904 (set (make-local-variable 'font-lock-keywords) 1884 (set (make-local-variable 'font-lock-keywords)
1905 (font-lock-eval-keywords keywords)) 1885 (font-lock-eval-keywords keywords))
1906 ;; Local fontification? 1886 ;; 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."
382 (save-excursion 382 (save-excursion
383 (unless start (setq start (point-min))) 383 (unless start (setq start (point-min)))
384 (setq end (if end (min end (point-max)) (point-max))) 384 (setq end (if end (min end (point-max)) (point-max)))
385 ;; This did bind `font-lock-beginning-of-syntax-function' to
386 ;; nil at some point, for an unknown reason. Don't do this; it
387 ;; can make highlighting slow due to expensive calls to
388 ;; `parse-partial-sexp' in function
389 ;; `font-lock-fontify-syntactically-region'. Example: paging
390 ;; from the end of a buffer to its start, can do repeated
391 ;; `parse-partial-sexp' starting from `point-min', which can
392 ;; take a long time in a large buffer.
393 (let ((orig-start start) next) 385 (let ((orig-start start) next)
394 (save-match-data 386 (save-match-data
395 ;; Fontify chunks beginning at START. The end of a 387 ;; 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."
123 delete-frame-functions disabled-command-function 123 delete-frame-functions disabled-command-function
124 fill-nobreak-predicate find-directory-functions 124 fill-nobreak-predicate find-directory-functions
125 find-file-not-found-functions 125 find-file-not-found-functions
126 font-lock-beginning-of-syntax-function
127 font-lock-fontify-buffer-function 126 font-lock-fontify-buffer-function
128 font-lock-fontify-region-function 127 font-lock-fontify-region-function
129 font-lock-mark-block-function 128 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'."
892 (save-excursion 892 (save-excursion
893 (save-match-data 893 (save-match-data
894 (save-buffer-state 894 (save-buffer-state
895 ;; Ensure syntactic fontification is always correct. 895 (next)
896 (font-lock-beginning-of-syntax-function next)
897 ;; Find successive unfontified regions between BEG and END. 896 ;; Find successive unfontified regions between BEG and END.
898 (condition-case data 897 (condition-case data
899 (do-while beg 898 (do-while beg