emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 344eb61 2/2: Merge branch 'master' of git.sv.gnu.or


From: Michael Albinus
Subject: [Emacs-diffs] master 344eb61 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Sun, 8 May 2016 09:48:47 +0000 (UTC)

branch: master
commit 344eb61ab3607827930354589174bb8d270241b9
Merge: 6ef5944 e8bda38
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 lib-src/etags.c               |    4 +-
 lisp/cedet/semantic/symref.el |    2 +-
 lisp/eshell/em-unix.el        |   11 +++--
 lisp/eshell/esh-var.el        |    2 +-
 lisp/jit-lock.el              |  108 +++++++++++++++++++++--------------------
 lisp/progmodes/ada-xref.el    |    4 +-
 lisp/textmodes/ispell.el      |   14 ++----
 test/lisp/jit-lock-tests.el   |   58 ++++++++++++++++++++++
 8 files changed, 133 insertions(+), 70 deletions(-)

diff --git a/lib-src/etags.c b/lib-src/etags.c
index 01e2302..e8b71e6 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1343,7 +1343,7 @@ main (int argc, char **argv)
     {
       char *cmd =
        xmalloc (strlen (tagfile) + whatlen_max +
-                sizeof "mv..OTAGS;fgrep -v '\t\t' OTAGS >;rm OTAGS");
+                sizeof "mv..OTAGS;grep -Fv '\t\t' OTAGS >;rm OTAGS");
       for (i = 0; i < current_arg; ++i)
        {
          switch (argbuffer[i].arg_type)
@@ -1356,7 +1356,7 @@ main (int argc, char **argv)
            }
          char *z = stpcpy (cmd, "mv ");
          z = stpcpy (z, tagfile);
-         z = stpcpy (z, " OTAGS;fgrep -v '\t");
+         z = stpcpy (z, " OTAGS;grep -Fv '\t");
          z = stpcpy (z, argbuffer[i].what);
          z = stpcpy (z, "\t' OTAGS >");
          z = stpcpy (z, tagfile);
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index 516a4f3..8b3196a 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -271,7 +271,7 @@ Optional SCOPE specifies which file set to search.  
Defaults to `project'.
 Refers to `semantic-symref-tool', to determine the reference tool to use
 for the current buffer.
 Returns an object of class `semantic-symref-result'."
-  (interactive "sEgrep style Regexp: ")
+  (interactive "sGrep -E style Regexp: ")
   (let* ((inst (semantic-symref-instantiate
                :searchfor text
                :searchtype 'regexp
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index c27c18c..e40dbde 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -748,7 +748,12 @@ external command."
             (cmd (progn
                    (set-text-properties 0 (length args)
                                         '(invisible t) args)
-                   (format "%s -n %s" command args)))
+                   (format "%s -n %s"
+                           (pcase command
+                             ("egrep" "grep -E")
+                             ("fgrep" "grep -F")
+                             (x x))
+                           args)))
             compilation-scroll-output)
        (grep cmd)))))
 
@@ -757,11 +762,11 @@ external command."
   (eshell-grep "grep" args t))
 
 (defun eshell/egrep (&rest args)
-  "Use Emacs grep facility instead of calling external egrep."
+  "Use Emacs grep facility instead of calling external grep -E."
   (eshell-grep "egrep" args t))
 
 (defun eshell/fgrep (&rest args)
-  "Use Emacs grep facility instead of calling external fgrep."
+  "Use Emacs grep facility instead of calling external grep -F."
   (eshell-grep "fgrep" args t))
 
 (defun eshell/agrep (&rest args)
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index 7213ad7..5915efb 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -530,7 +530,7 @@ Integers imply a direct index, and names, an associate 
lookup using
 For example, to retrieve the second element of a user's record in
 '/etc/passwd', the variable reference would look like:
 
-  ${egrep johnw /etc/passwd}[: 2]"
+  ${grep johnw /etc/passwd}[: 2]"
   (while indices
     (let ((refs (car indices)))
       (when (stringp value)
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index c49fa6e..0d9abbc 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -394,58 +394,62 @@ Defaults to the whole buffer.  END can be out of bounds."
           (setq next (or (text-property-any start end 'fontified t)
                          end))
 
-          ;; Fontify the chunk, and mark it as fontified.
-          ;; We mark it first, to make sure that we don't indefinitely
-          ;; re-execute this fontification if an error occurs.
-          (put-text-property start next 'fontified t)
-           (pcase-let
-               ;; `tight' is the part we've fully refontified, and `loose'
-               ;; is the part we've partly refontified (some of the
-               ;; functions have refontified it but maybe not all).
-               ((`(,tight-beg ,tight-end ,loose-beg ,_loose-end)
-                 (condition-case err
-                     (jit-lock--run-functions start next)
-                   ;; If the user quits (which shouldn't happen in normal
-                   ;; on-the-fly jit-locking), make sure the fontification
-                   ;; will be performed before displaying the block again.
-                   (quit (put-text-property start next 'fontified nil)
-                         (signal (car err) (cdr err))))))
-
-             ;; In case we fontified more than requested, take advantage of the
-             ;; good news.
-             (when (or (< tight-beg start) (> tight-end next))
-               (put-text-property tight-beg tight-end 'fontified t))
-
-             ;; Make sure the contextual refontification doesn't re-refontify
-             ;; what's already been refontified.
-             (when (and jit-lock-context-unfontify-pos
-                        (< jit-lock-context-unfontify-pos tight-end)
-                        (>= jit-lock-context-unfontify-pos tight-beg)
-                        ;; Don't move boundary forward if we have to
-                        ;; refontify previous text.  Otherwise, we risk moving
-                        ;; it past the end of the multiline property and thus
-                        ;; forget about this multiline region altogether.
-                        (not (get-text-property tight-beg
-                                                'jit-lock-defer-multiline)))
-               (setq jit-lock-context-unfontify-pos tight-end))
-
-             ;; The redisplay engine has already rendered the buffer up-to
-             ;; `orig-start' and won't notice if the above jit-lock-functions
-             ;; changed the appearance of any part of the buffer prior
-             ;; to that.  So if `loose-beg' is before `orig-start', we need to
-             ;; cause a new redisplay cycle after this one so that the changes
-             ;; are properly reflected on screen.
-             ;; To make such repeated redisplay happen less often, we can
-             ;; eagerly extend the refontified region with
-             ;; jit-lock-after-change-extend-region-functions.
-             (when (< loose-beg orig-start)
-               (run-with-timer 0 nil #'jit-lock-force-redisplay
-                               (copy-marker loose-beg)
-                               (copy-marker orig-start)))
-
-             ;; Find the start of the next chunk, if any.
-             (setq start
-                   (text-property-any tight-end end 'fontified nil)))))))))
+           ;; Avoid unnecessary work if the chunk is empty (bug#23278).
+           (when (> next start)
+             ;; Fontify the chunk, and mark it as fontified.
+             ;; We mark it first, to make sure that we don't indefinitely
+             ;; re-execute this fontification if an error occurs.
+             (put-text-property start next 'fontified t)
+             (pcase-let
+                 ;; `tight' is the part we've fully refontified, and `loose'
+                 ;; is the part we've partly refontified (some of the
+                 ;; functions have refontified it but maybe not all).
+                 ((`(,tight-beg ,tight-end ,loose-beg ,_loose-end)
+                   (condition-case err
+                       (jit-lock--run-functions start next)
+                     ;; If the user quits (which shouldn't happen in normal
+                     ;; on-the-fly jit-locking), make sure the fontification
+                     ;; will be performed before displaying the block again.
+                     (quit (put-text-property start next 'fontified nil)
+                           (signal (car err) (cdr err))))))
+
+               ;; In case we fontified more than requested, take advantage of 
the
+               ;; good news.
+               (when (or (< tight-beg start) (> tight-end next))
+                 (put-text-property tight-beg tight-end 'fontified t))
+
+               ;; Make sure the contextual refontification doesn't re-refontify
+               ;; what's already been refontified.
+               (when (and jit-lock-context-unfontify-pos
+                          (< jit-lock-context-unfontify-pos tight-end)
+                          (>= jit-lock-context-unfontify-pos tight-beg)
+                          ;; Don't move boundary forward if we have to
+                          ;; refontify previous text.  Otherwise, we risk 
moving
+                          ;; it past the end of the multiline property and thus
+                          ;; forget about this multiline region altogether.
+                          (not (get-text-property tight-beg
+                                                  'jit-lock-defer-multiline)))
+                 (setq jit-lock-context-unfontify-pos tight-end))
+
+               ;; The redisplay engine has already rendered the buffer up-to
+               ;; `orig-start' and won't notice if the above jit-lock-functions
+               ;; changed the appearance of any part of the buffer prior
+               ;; to that.  So if `loose-beg' is before `orig-start', we need 
to
+               ;; cause a new redisplay cycle after this one so that the 
changes
+               ;; are properly reflected on screen.
+               ;; To make such repeated redisplay happen less often, we can
+               ;; eagerly extend the refontified region with
+               ;; jit-lock-after-change-extend-region-functions.
+               (when (< loose-beg orig-start)
+                 (run-with-timer 0 nil #'jit-lock-force-redisplay
+                                 (copy-marker loose-beg)
+                                 (copy-marker orig-start)))
+
+               ;; Skip to the end of the fully refontified part.
+               (setq start tight-end)))
+           ;; Find the start of the next chunk, if any.
+           (setq start
+                 (text-property-any start end 'fontified nil))))))))
 
 (defun jit-lock-force-redisplay (start end)
   "Force the display engine to re-render START's buffer from START to END.
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 8518163..b3248d3 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -174,7 +174,7 @@ If GVD is not the debugger used, nothing happens."
   :type 'boolean :group 'ada)
 
 (defcustom ada-xref-search-with-egrep t
-  "If non-nil, use egrep to find the possible declarations for an entity.
+  "If non-nil, use grep -E to find the possible declarations for an entity.
 This alternate method is used when the exact location was not found in the
 information provided by GNAT.  However, it might be expensive if you have a lot
 of sources, since it will search in all the files in your project."
@@ -2013,7 +2013,7 @@ This function should be used when the standard algorithm 
that parses the
 exist.
 This function attempts to find the possible declarations for the identifier
 anywhere in the object path.
-This command requires the external `egrep' program to be available.
+This command requires the external `grep' program to be available.
 
 This works well when one is using an external library and wants to find
 the declaration and documentation of the subprograms one is using."
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 284fea4..0ed6c68 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -396,19 +396,15 @@ Always stores Fcc copy of message when nil."
 
 
 (defcustom ispell-grep-command
-  ;; MS-Windows/MS-DOS have `egrep' as a Unix shell script, so they
-  ;; cannot invoke it.  Use "grep -E" instead (see ispell-grep-options
-  ;; below).
-  (if (memq system-type '(windows-nt ms-dos)) "grep" "egrep")
+  "grep"
   "Name of the grep command for search processes."
   :type 'string
   :group 'ispell)
 
 (defcustom ispell-grep-options
-  (if (memq system-type '(windows-nt ms-dos)) "-Ei" "-i")
+  "-Ei"
   "String of options to use when running the program in `ispell-grep-command'.
-Should probably be \"-i\" or \"-e\".
-Some machines (like the NeXT) don't support \"-i\"."
+Should probably be \"-Ei\"."
   :type 'string
   :group 'ispell)
 
@@ -2678,8 +2674,8 @@ SPC:   Accept word this time.
 (defun ispell-lookup-words (word &optional lookup-dict)
   "Look up WORD in optional word-list dictionary LOOKUP-DICT.
 A `*' serves as a wild card.  If no wild cards, `look' is used if it exists.
-Otherwise the variable `ispell-grep-command' contains the command used to
-search for the words (usually egrep).
+Otherwise the variable `ispell-grep-command' contains the command
+\(usually \"grep\") used to search for the words.
 
 Optional second argument contains the dictionary to use; the default is
 `ispell-alternate-dictionary', overridden by `ispell-complete-word-dict'
diff --git a/test/lisp/jit-lock-tests.el b/test/lisp/jit-lock-tests.el
new file mode 100644
index 0000000..26b9799
--- /dev/null
+++ b/test/lisp/jit-lock-tests.el
@@ -0,0 +1,58 @@
+;;; jit-lock-tests.el --- tests for jit-lock
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Dmitry Gutov <address@hidden>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'jit-lock)
+(require 'ert-x)
+
+(defun jit-lock-tests--setup-buffer ()
+  (setq font-lock-defaults '(nil t))
+  (font-lock-mode))
+
+(ert-deftest jit-lock-fontify-now-fontifies-a-new-buffer ()
+  (ert-with-test-buffer (:name "xxx")
+    (jit-lock-tests--setup-buffer)
+    (insert "xyz")
+    (jit-lock-fontify-now (point-min) (point-max))
+    (should-not (text-property-not-all (point-min) (point-max) 'fontified t))))
+
+(ert-deftest jit-lock-fontify-mends-the-gaps ()
+  (ert-with-test-buffer (:name "xxx")
+    (jit-lock-tests--setup-buffer)
+    (insert "aaabbbcccddd")
+    (with-silent-modifications
+      (put-text-property 1 4 'fontified t)
+      (put-text-property 7 10 'fontified t))
+    (jit-lock-fontify-now (point-min) (point-max))
+    (should-not (text-property-not-all (point-min) (point-max) 'fontified t))))
+
+(ert-deftest jit-lock-does-not-refontify-unnecessarily ()
+  (ert-with-test-buffer (:name "xxx")
+    (setq font-lock-defaults
+          (list '(((lambda () (error "Don't call me")))) t))
+    (font-lock-mode)
+    (insert "aaa")
+    (with-silent-modifications
+      (put-text-property (point-min) (point-max) 'fontified t))
+    (jit-lock-fontify-now (point-min) (point-max))))



reply via email to

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