emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 644c6b4: * lisp/font-lock.el (font-lock-beginning-o


From: Stefan Monnier
Subject: [Emacs-diffs] master 644c6b4: * lisp/font-lock.el (font-lock-beginning-of-syntax-function): Remove
Date: Fri, 18 Sep 2015 00:33:59 +0000

branch: master
commit 644c6b414f39222890246d7fe155a369b1983246
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * 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.
---
 doc/emacs/display.texi     |   14 --------------
 doc/lispref/modes.texi     |   27 +--------------------------
 etc/NEWS                   |    3 +++
 lisp/emacs-lisp/lisp.el    |    3 +--
 lisp/emacs-lisp/syntax.el  |    7 -------
 lisp/font-core.el          |   15 ++-------------
 lisp/font-lock.el          |   34 +++++++---------------------------
 lisp/jit-lock.el           |    8 --------
 lisp/loadhist.el           |    1 -
 lisp/obsolete/lazy-lock.el |    3 +--
 10 files changed, 15 insertions(+), 100 deletions(-)

diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index 7b90e19..7aef52d 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -854,7 +854,6 @@ and the default level otherwise, use the value
 '((c-mode . 1) (c++-mode . 1)))
 @end example
 
address@hidden font-lock-beginning-of-syntax-function
 @cindex incorrect fontification
 @cindex parenthesis in column zero and fontification
 @cindex brace in column zero and fontification
@@ -867,19 +866,6 @@ any string or comment.  Therefore, you should avoid 
placing an
 open-parenthesis or open-brace in the leftmost column, if it is inside
 a string or comment.  @xref{Left Margin Paren}, for details.
 
address@hidden slow display during scrolling
-  The variable @code{font-lock-beginning-of-syntax-function}, which is
-always buffer-local, specifies how Font Lock mode can find a position
-guaranteed to be outside any comment or string.  In modes which use
-the leftmost column parenthesis convention, the default value of the
-variable is @code{beginning-of-defun}---that tells Font Lock mode to
-use the convention.  If you set this variable to @code{nil}, Font Lock
-no longer relies on the convention.  This avoids incorrect results,
-but the price is that, in some cases, fontification for a changed text
-must rescan buffer text from the beginning of the buffer.  This can
-considerably slow down redisplay while scrolling, particularly if you
-are close to the end of a large buffer.
-
 @findex font-lock-add-keywords
   Font Lock highlighting patterns already exist for most modes, but
 you may want to fontify additional patterns.  You can use the function
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 8d7e29f..a174770 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -2527,7 +2527,7 @@ If address@hidden, the value should look like this:
 
 @example
 (@var{keywords} address@hidden address@hidden
- address@hidden address@hidden @address@hidden)
+ address@hidden @address@hidden)
 @end example
 
 The first element, @var{keywords}, indirectly specifies the value of
@@ -2559,11 +2559,6 @@ fontification; the resulting syntax table is stored in
 @code{nil}, syntactic fontification uses the syntax table returned by
 the @code{syntax-table} function.  @xref{Syntax Table Functions}.
 
-The fifth element, @var{syntax-begin}, specifies the value of
address@hidden  We recommend setting
-this variable to @code{nil} and using @code{syntax-begin-function}
-instead.
-
 All the remaining elements (if any) are collectively called
 @var{other-vars}.  Each of these elements should have the form
 @code{(@var{variable} . @var{value})}---which means, make
@@ -3124,26 +3119,6 @@ is @code{nil}, syntactic fontification uses the buffer's 
syntax table
 Table Functions}).
 @end defvar
 
address@hidden font-lock-beginning-of-syntax-function
-If this variable is address@hidden, it should be a function to move
-point back to a position that is syntactically at top level and
-outside of strings or comments.  The value is normally set through an
address@hidden element in @code{font-lock-defaults}.  If it is
address@hidden, Font Lock uses @code{syntax-begin-function} to move back
-outside of any comment, string, or sexp (@pxref{Position Parse}).
-
-This variable is semi-obsolete; we usually recommend setting
address@hidden instead.  One of its uses is to tune the
-behavior of syntactic fontification, e.g., to ensure that different
-kinds of strings or comments are highlighted differently.
-
-The specified function is called with no arguments.  It should leave
-point at the beginning of any enclosing syntactic block.  Typical values
-are @code{beginning-of-line} (used when the start of the line is known
-to be outside a syntactic block), or @code{beginning-of-defun} for
-programming modes, or @code{backward-paragraph} for textual modes.
address@hidden defvar
-
 @defvar font-lock-syntactic-face-function
 If this variable is address@hidden, it should be a function to determine
 which face to use for a given syntactic element (a string or a comment).
diff --git a/etc/NEWS b/etc/NEWS
index 49ce9b7..b5c52e3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -856,6 +856,9 @@ a typographically-correct documents.
 
 * Incompatible Lisp Changes in Emacs 25.1
 
+** Removed font-lock-beginning-of-syntax-function and the SYNTAX-BEGIN
+slot in font-lock-defaults.
+
 +++
 ** `package-initialize' now sets `package-enable-at-startup' to nil if
 called 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 7b7b48c..ca977db 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 5101925..fee6214 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 6d8588b..2253204 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 cec95bf..d93cf71 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 8c798d5..4e8fa7b 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 52fd047..4ea1bcb 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 79afd80..d05a7d8 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]