emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master f3050fc 2/2: Merge branch 'master' of git.savannah.


From: Eli Zaretskii
Subject: [Emacs-diffs] master f3050fc 2/2: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Date: Sun, 28 Oct 2018 11:55:57 -0400 (EDT)

branch: master
commit f3050fc14e05a6eb18a70e0e7ce5d5302d5203e6
Merge: 2fdae77 3dd16a8
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
---
 admin/MAINTAINERS            |   2 +-
 doc/emacs/cmdargs.texi       |  18 +++-
 doc/emacs/frames.texi        |   4 +
 doc/emacs/search.texi        |  33 +++++---
 doc/emacs/xresources.texi    |   5 ++
 doc/lispref/processes.texi   |  19 +++--
 doc/misc/calc.texi           |   2 +-
 etc/NEWS                     |   8 ++
 etc/PROBLEMS                 |   7 ++
 lisp/cus-edit.el             |   2 +-
 lisp/emacs-lisp/lisp-mode.el |   4 +
 lisp/epg.el                  |   2 +-
 lisp/gnus/gnus-sum.el        |  15 ++--
 lisp/gnus/mm-util.el         |   2 +-
 lisp/help.el                 |   2 +-
 lisp/isearch.el              | 198 +++++++++++++++++++++++++++++++++----------
 lisp/net/tramp-sh.el         |   3 +-
 lisp/progmodes/cperl-mode.el |   2 +-
 lisp/simple.el               |  21 +++--
 src/image.c                  |   2 +-
 src/nsterm.m                 |  80 ++++++++---------
 21 files changed, 295 insertions(+), 136 deletions(-)

diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS
index 6db1d88..05faa58 100644
--- a/admin/MAINTAINERS
+++ b/admin/MAINTAINERS
@@ -210,8 +210,8 @@ Paul Eggert
 Michael Albinus
        src/inotify.c
         lisp/autorevert.el
-        lisp/files.el (file-name-non-special)
        lisp/eshell/em-tramp.el
+        lisp/files.el (file-name-non-special)
        lisp/net/ange-ftp.el
        lisp/notifications.el
        lisp/shadowfile.el
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 733919a..2e2767c 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -305,6 +305,8 @@ not disable loading @file{site-start.el}.
 
 @item --no-site-file
 @opindex --no-site-file
address@hidden -nsl
address@hidden -nsl
 @cindex @file{site-start.el} file, not loading
 Do not load @file{site-start.el} (@pxref{Init File}).  The @samp{-Q}
 option does this too, but other options like @samp{-q} do not.
@@ -323,14 +325,20 @@ Do not display a startup screen.  You can also achieve 
this effect by
 setting the variable @code{inhibit-startup-screen} to address@hidden
 in your initialization file (@pxref{Entering Emacs}).
 
address@hidden --no-x-resources
address@hidden --no-x-resources
address@hidden X resources, not loading
+Do not load X resources.  You can also achieve this effect by setting
+the variable @code{inhibit-x-resources} to @code{t} in your
+initialization file (@pxref{Resources}).
+
 @item -Q
 @opindex -Q
 @itemx --quick
 @opindex --quick
-Start Emacs with minimum customizations.  This is similar to using @samp{-q},
address@hidden, @samp{--no-site-lisp}, and @samp{--no-splash}
-together.  This also stops Emacs from processing X resources by
-setting @code{inhibit-x-resources} to @code{t} (@pxref{Resources}).
+Start Emacs with minimum customizations.  This is similar to using
address@hidden, @samp{--no-site-file}, @samp{--no-site-lisp},
address@hidden, and @samp{--no-splash} together..
 
 @item -daemon
 @opindex -daemon
@@ -373,6 +381,8 @@ Enable expensive correctness checks when dealing with 
dynamically
 loadable modules.  This is intended for module authors that wish to
 verify that their module conforms to the module API requirements.  The
 option makes Emacs abort if a module-related assertion triggers.
address@hidden Dynamic Modules,, Writing Dynamically-Loaded Modules,
+elisp, The GNU Emacs Lisp Reference Manual}.
 @end table
 
 @node Command Example
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 9f4c782..6bbaae2 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -934,6 +934,10 @@ the initial frame, by customizing the variable
 specify colors and fonts don't affect menus and the menu bar, since
 those are drawn by the toolkit and not directly by Emacs.
 
+  Frame appearance and behavior can also be customized through X
+resources (@pxref{X Resources}); these override the parameters of the
+initial frame specified in your init file.
+
   Note that if you are using the desktop library to save and restore
 your sessions, the frames to be restored are recorded in the desktop
 file, together with their parameters.  When these frames are restored,
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 263c4c5..c9f3ccc 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -99,10 +99,18 @@ text that matches the search string---using the 
@code{isearch} face
 that customize this highlighting.  The current search string is also
 displayed in the echo area.
 
-  If you make a mistake typing the search string, type @key{DEL}.
-Each @key{DEL} cancels the last character of the search string.
address@hidden in Isearch}, for more about dealing with unsuccessful
-search.
address@hidden isearch input item
address@hidden input item, isearch
address@hidden isearch-delete-char
address@hidden DEL @r{(Incremental search)}
+  If you make a mistake typing the search string, type @key{DEL}
+(@code{isearch-delete-char}).  Each @key{DEL} cancels the last input
+item entered during the search.  Emacs records a new @dfn{input item}
+whenever you type a command that changes the search string, the
+position of point, the success or failure of the search, the direction
+of the search, the position of the other end of the current search
+result, or the ``wrappedness'' of the search.  @xref{Error in
+Isearch}, for more about dealing with unsuccessful search.
 
 @cindex exit incremental search
 @cindex incremental search, exiting
@@ -290,14 +298,15 @@ string that failed to match is highlighted using the face
 @code{isearch-fail}.
 
   At this point, there are several things you can do.  If your string
-was mistyped, you can use @key{DEL} to erase some of it and correct
-it, or you can type @kbd{M-e} and edit it.  If you like the place you
-have found, you can type @key{RET} to remain there.  Or you can type
address@hidden, which removes from the search string the characters that
-could not be found (the @samp{T} in @samp{FOOT}), leaving those that
-were found (the @samp{FOO} in @samp{FOOT}).  A second @kbd{C-g} at
-that point cancels the search entirely, returning point to where it
-was when the search started.
+was mistyped, use @key{DEL} to cancel a previous input item
+(@pxref{Basic Isearch}), @kbd{C-M-w} to erase one character at a time,
+or @kbd{M-e} to edit it.  If you like the place you have found, you
+can type @key{RET} to remain there.  Or you can type @kbd{C-g}, which
+removes from the search string the characters that could not be found
+(the @samp{T} in @samp{FOOT}), leaving those that were found (the
address@hidden in @samp{FOOT}).  A second @kbd{C-g} at that point cancels
+the search entirely, returning point to where it was when the search
+started.
 
 @cindex quitting (in search)
 @kindex C-g @r{(Incremental search)}
diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi
index db2c6ff..903090f 100644
--- a/doc/emacs/xresources.texi
+++ b/doc/emacs/xresources.texi
@@ -46,6 +46,11 @@ this file do not take effect immediately, because the X 
server stores
 its own list of resources; to update it, use the command
 @command{xrdb}---for instance, @samp{xrdb ~/.Xdefaults}.
 
+  Settings specified via X resources in general override the
+equivalent settings in Emacs init files (@pxref{Init File}), in
+particular for parameters of the initial frame (@pxref{Frame
+Parameters}).
+
 @cindex registry, setting resources (MS-Windows)
   (MS-Windows systems do not support X resource files; on such systems,
 Emacs looks for X resources in the Windows Registry, first under the
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index e1113e3..2afc6a3 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -598,8 +598,8 @@ communication is only partially asynchronous: Emacs sends 
data to the
 process only when certain functions are called, and Emacs accepts data
 from the process only while waiting for input or for a time delay.
 
address@hidden pty
address@hidden pipe
address@hidden pty, when to use for subprocess communications
address@hidden pipe, when to use for subprocess communications
   An asynchronous process is controlled either via a @dfn{pty}
 (pseudo-terminal) or a @dfn{pipe}.  The choice of pty or pipe is made
 when creating the process, by default based on the value of the
@@ -609,11 +609,13 @@ Shell mode, because they allow for job control 
(@kbd{C-c}, @kbd{C-z},
 etc.)@: between the process and its children, and because interactive
 programs treat ptys as terminal devices, whereas pipes don't support
 these features.  However, for subprocesses used by Lisp programs for
-internal purposes, it is often better to use a pipe, because pipes are
+internal purposes (i.e., with no user interaction), where significant
+amounts of data need to be exchanged between the subprocess and the
+Lisp program, it is often better to use a pipe, because pipes are
 more efficient, and because they are immune to stray character
 injections that ptys introduce for large (around 500 byte) messages.
-Also, the total number of ptys is limited on many systems and it is
-good not to waste them.
+Also, the total number of ptys is limited on many systems, and it is
+good not to waste them unnecessarily.
 
 @defun make-process &rest args
 This function is the basic low-level primitive for starting
@@ -666,7 +668,9 @@ pipe, or @code{nil} to use the default derived from the 
value of the
 @code{process-connection-type} variable.  This parameter and the value
 of @code{process-connection-type} are ignored if a address@hidden
 value is specified for the @code{:stderr} parameter; in that case, the
-type will always be @code{pipe}.
+type will always be @code{pipe}.  On systems where ptys are not
+available (MS-Windows), this parameter is likewise ignored, and pipes
+are used unconditionally.
 
 @item :noquery @var{query-flag}
 Initialize the process query flag to @var{query-flag}.
@@ -873,7 +877,8 @@ around the call to these functions.
 Note that the value of this variable is ignored when
 @code{make-process} is called with a address@hidden value of the
 @code{:stderr} parameter; in that case, Emacs will communicate with
-the process using pipes.
+the process using pipes.  It is also ignored if ptys are unavailable
+(MS-Windows).
 
 @smallexample
 @group
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index 83807c6..f7b23d3 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -35832,7 +35832,7 @@ keystrokes are not listed in this summary.
 @r{       @:      _     @:number       @:        @:-@:number}
 @r{       @:      e     @:number       @:        @:@:1e number}
 @r{       @:      #     @:number       @:        @:@:address@hidden
address@hidden       @:      P     @:(in number)  @:        @:+/-@:}
address@hidden       @:      p     @:(in number)  @:        @:+/-@:}
 @r{       @:      M     @:(in number)  @:        @:mod@:}
 @r{       @:      @@ ' " @:  (in number)@:        @:@:HMS form}
 @r{       @:      h m s @:  (in number)@:        @:@:HMS form}
diff --git a/etc/NEWS b/etc/NEWS
index 7a81c25..226ae1e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -582,6 +582,14 @@ can now be searched via 'C-s'.
 
 ** Search and Replace
 
+*** lazy-highlight-buffer highlights matches in the full buffer.
+It is useful in combination with lazy-highlight-cleanup customized to nil
+to leave matches highlighted in the whole buffer after exiting isearch.
+Also when lazy-highlight-buffer prepares highlighting in the buffer,
+navigation through the matches without flickering is more smooth.
+lazy-highlight-buffer-max-at-a-time controls the number of matches to
+highlight in one iteration while processing the full buffer.
+
 +++
 *** New isearch bindings.
 
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 6805e87..0cbcca4 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -2599,6 +2599,13 @@ please call support for your X-server and see if you can 
get a fix.
 If you do, please send it to address@hidden so we can list it here.
 
 
+* Runtime problems specific to macOS
+
+** macOS doesn't come with libxpm, so only XPM3 is supported.
+
+Libxpm is available for macOS as part of the XQuartz project.
+
+
 * Build-time problems
 
 ** Configuration
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 723cd50..b69a63b 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -917,7 +917,7 @@ the current value of the variable, otherwise `symbol-value' 
is used.
 If optional COMMENT argument is non-nil, also prompt for a comment and return
 it as the third element in the list."
   (let* ((var (read-variable prompt-var))
-        (minibuffer-help-form '(describe-variable var))
+        (minibuffer-help-form `(describe-variable ',var))
         (val
          (let ((prop (get var 'variable-interactive))
                (type (get var 'custom-type))
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index afb7cbd..4619919 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -839,6 +839,10 @@ by more than one line to cross a string literal."
     (prog1
         (let (indent)
           (cond ((= (forward-line 1) 1) nil)
+                ;; Negative depth, probably some kind of syntax error.
+                ((null indent-stack)
+                 ;; Reset state.
+                 (setq ppss (parse-partial-sexp (point) (point))))
                 ((car indent-stack))
                 ((integerp (setq indent (calculate-lisp-indent ppss)))
                  (setf (car indent-stack) indent))
diff --git a/lisp/epg.el b/lisp/epg.el
index 9d9bc90..c8f24eb 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -655,7 +655,7 @@ callback data (if any)."
                                  :command (cons (epg-context-program context)
                                                 args)
                                  :connection-type 'pipe
-                                 :coding '(binary . binary)
+                                 :coding 'raw-text
                                  :filter #'epg--process-filter
                                  :stderr error-process
                                  :noquery t)))
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index f56b822..f9fae37 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -83,12 +83,12 @@ If an unread article in the group refers to an older, 
already
 read (or just marked as read) article, the old article will not
 normally be displayed in the Summary buffer.  If this variable is
 t, Gnus will attempt to grab the headers to the old articles, and
-thereby build complete threads.  If it has the value `some', all
-old headers will be fetched but only enough headers to connect
+thereby build complete threads.  If the value is the symbol `some',
+all old headers will be fetched but only enough headers to connect
 otherwise loose threads will be displayed.  This variable can
 also be a number.  In that case, no more than that number of old
-headers will be fetched.  If it has the value `invisible', all
-old headers will be fetched, but none will be displayed.
+headers will be fetched.  If the value is the symbol `invisible',
+all old headers will be fetched, but none will be displayed.
 
 The server has to support NOV for any of this to work.
 
@@ -203,9 +203,10 @@ Useful functions to put in this list include:
 
 (defcustom gnus-build-sparse-threads nil
   "If non-nil, fill in the gaps in threads.
-If `some', only fill in the gaps that are needed to tie loose threads
-together.  If `more', fill in all leaf nodes that Gnus can find.  If
-non-nil and non-`some', fill in all gaps that Gnus manages to guess."
+If set to the symbol `some', only fill in the gaps that are
+needed to tie loose threads together.  If the symbol `more', fill
+in all leaf nodes that Gnus can find.  If t (or any other value),
+fill in all gaps that Gnus manages to guess."
   :group 'gnus-thread
   :type '(choice (const :tag "off" nil)
                 (const some)
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el
index 25b1568..14a232f 100644
--- a/lisp/gnus/mm-util.el
+++ b/lisp/gnus/mm-util.el
@@ -827,7 +827,7 @@ decompressed data.  The buffer's multibyteness must be 
turned off."
                                            (insert-file-contents err-file)
                                            (buffer-string)
                                          (erase-buffer))
-                                        t)
+                                       nil t)
                                       " ")
                            "\n")
                    (setq err-msg
diff --git a/lisp/help.el b/lisp/help.el
index 28288e5..ad782f7 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1326,7 +1326,7 @@ puts the buffer specified by BUFFER-OR-NAME in 
`help-mode' and
 displays a message about how to delete the help window when it's no
 longer needed.  The help window will be selected if
 `help-window-select' is non-nil.
-Most of this  is done by `help-window-setup', which see."
+Most of this is done by `help-window-setup', which see."
   (declare (indent 1) (debug t))
   `(progn
      ;; Make `help-window-point-marker' point nowhere.  The only place
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 1e785a4..580b3ac 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -304,9 +304,9 @@ are `word-search-regexp' \(`\\[isearch-toggle-word]'), 
`isearch-symbol-regexp'
 
 (defcustom isearch-lazy-highlight t
   "Controls the lazy-highlighting during incremental search.
-When non-nil, all text in the buffer matching the current search
-string is highlighted lazily (see `lazy-highlight-initial-delay'
-and `lazy-highlight-interval').
+When non-nil, all text currently visible on the screen
+matching the current search string is highlighted lazily
+(see `lazy-highlight-initial-delay' and `lazy-highlight-interval').
 
 When multiple windows display the current buffer, the
 highlighting is displayed only on the selected window, unless
@@ -351,6 +351,27 @@ A value of nil means highlight all matches shown on the 
screen."
                 (integer :tag "Some"))
   :group 'lazy-highlight)
 
+(defcustom lazy-highlight-buffer-max-at-a-time 20
+  "Maximum matches to highlight at a time (for `lazy-highlight-buffer').
+Larger values may reduce Isearch's responsiveness to user input;
+smaller values make matches highlight slowly.
+A value of nil means highlight all matches in the buffer."
+  :type '(choice (const :tag "All" nil)
+                (integer :tag "Some"))
+  :group 'lazy-highlight
+  :version "27.1")
+
+(defcustom lazy-highlight-buffer nil
+  "Controls the lazy-highlighting of the full buffer.
+When non-nil, all text in the buffer matching the current search
+string is highlighted lazily (see `lazy-highlight-initial-delay',
+`lazy-highlight-interval' and `lazy-highlight-buffer-max-at-a-time').
+This is useful when `lazy-highlight-cleanup' is customized to nil
+and doesn't remove full-buffer highlighting after a search."
+  :type 'boolean
+  :group 'lazy-highlight
+  :version "27.1")
+
 (defface lazy-highlight
   '((((class color) (min-colors 88) (background light))
      (:background "paleturquoise"))
@@ -1984,11 +2005,14 @@ and reads its face argument using 
`hi-lock-read-face-name'."
 
 
 (defun isearch-delete-char ()
-  "Discard last input item and move point back.
-Last input means the last character or the last isearch command
-that added or deleted characters from the search string,
-moved point, toggled regexp mode or case-sensitivity, etc.
-If no previous match was done, just beep."
+  "Undo last input item during a search.
+
+An input item is the result of a command that pushes a new state
+of isearch (as recorded by the `isearch--state' structure) to
+`isearch-cmds'.  Info node `(emacs)Basic Isearch' explains when
+Emacs records a new input item.
+
+If no input items have been entered yet, just beep."
   (interactive)
   (if (null (cdr isearch-cmds))
       (ding)
@@ -3178,6 +3202,7 @@ since they have special meaning in a regexp."
 (defvar isearch-lazy-highlight-window-group nil)
 (defvar isearch-lazy-highlight-window-start nil)
 (defvar isearch-lazy-highlight-window-end nil)
+(defvar isearch-lazy-highlight-buffer nil)
 (defvar isearch-lazy-highlight-case-fold-search nil)
 (defvar isearch-lazy-highlight-regexp nil)
 (defvar isearch-lazy-highlight-lax-whitespace nil)
@@ -3226,10 +3251,12 @@ by other Emacs features."
                          isearch-lax-whitespace))
                 (not (eq isearch-lazy-highlight-regexp-lax-whitespace
                          isearch-regexp-lax-whitespace))
-                 (not (= (window-group-start)
-                         isearch-lazy-highlight-window-start))
-                 (not (= (window-group-end) ; Window may have been 
split/joined.
-                        isearch-lazy-highlight-window-end))
+                (not (or lazy-highlight-buffer
+                         (= (window-group-start)
+                            isearch-lazy-highlight-window-start)))
+                (not (or lazy-highlight-buffer
+                         (= (window-group-end) ; Window may have been 
split/joined.
+                            isearch-lazy-highlight-window-end)))
                 (not (eq isearch-forward
                          isearch-lazy-highlight-forward))
                 ;; In case we are recovering from an error.
@@ -3247,6 +3274,7 @@ by other Emacs features."
           isearch-lazy-highlight-window-group (selected-window-group)
          isearch-lazy-highlight-window-start (window-group-start)
          isearch-lazy-highlight-window-end   (window-group-end)
+         isearch-lazy-highlight-buffer       lazy-highlight-buffer
          ;; Start lazy-highlighting at the beginning of the found
          ;; match (`isearch-other-end').  If no match, use point.
          ;; One of the next two variables (depending on search direction)
@@ -3264,12 +3292,22 @@ by other Emacs features."
          isearch-lazy-highlight-regexp-lax-whitespace 
isearch-regexp-lax-whitespace
          isearch-lazy-highlight-regexp-function  isearch-regexp-function
          isearch-lazy-highlight-forward      isearch-forward)
+    ;; Extend start/end to match whole string at point (bug#19353)
+    (if isearch-lazy-highlight-forward
+        (setq isearch-lazy-highlight-start
+             (min (+ isearch-lazy-highlight-start
+                     (1- (length isearch-lazy-highlight-last-string)))
+                  (point-max)))
+      (setq isearch-lazy-highlight-end
+           (max (- isearch-lazy-highlight-end
+                   (1- (length isearch-lazy-highlight-last-string)))
+                (point-min))))
     (unless (equal isearch-string "")
       (setq isearch-lazy-highlight-timer
             (run-with-idle-timer lazy-highlight-initial-delay nil
                                  'isearch-lazy-highlight-start)))))
 
-(defun isearch-lazy-highlight-search ()
+(defun isearch-lazy-highlight-search (string bound)
   "Search ahead for the next or previous match, for lazy highlighting.
 Attempt to do the search exactly the way the pending Isearch would."
   (condition-case nil
@@ -3283,24 +3321,10 @@ Attempt to do the search exactly the way the pending 
Isearch would."
            (isearch-forward isearch-lazy-highlight-forward)
            (search-invisible nil)      ; don't match invisible text
            (retry t)
-           (success nil)
-           (bound (if isearch-lazy-highlight-forward
-                      (min (or isearch-lazy-highlight-end-limit (point-max))
-                           (if isearch-lazy-highlight-wrapped
-                               (+ isearch-lazy-highlight-start
-                                  ;; Extend bound to match whole string at 
point
-                                  (1- (length 
isearch-lazy-highlight-last-string)))
-                             (window-group-end)))
-                    (max (or isearch-lazy-highlight-start-limit (point-min))
-                         (if isearch-lazy-highlight-wrapped
-                             (- isearch-lazy-highlight-end
-                                ;; Extend bound to match whole string at point
-                                (1- (length 
isearch-lazy-highlight-last-string)))
-                           (window-group-start))))))
+           (success nil))
        ;; Use a loop like in `isearch-search'.
        (while retry
-         (setq success (isearch-search-string
-                        isearch-lazy-highlight-last-string bound t))
+         (setq success (isearch-search-string string bound t))
          ;; Clear RETRY unless the search predicate says
          ;; to skip this search hit.
          (if (or (not success)
@@ -3312,6 +3336,17 @@ Attempt to do the search exactly the way the pending 
Isearch would."
        success)
     (error nil)))
 
+(defun isearch-lazy-highlight-match (mb me)
+  (let ((ov (make-overlay mb me)))
+    (push ov isearch-lazy-highlight-overlays)
+    ;; 1000 is higher than ediff's 100+,
+    ;; but lower than isearch main overlay's 1001
+    (overlay-put ov 'priority 1000)
+    (overlay-put ov 'face 'lazy-highlight)
+    (unless (or (eq isearch-lazy-highlight 'all-windows)
+                isearch-lazy-highlight-buffer)
+      (overlay-put ov 'window (selected-window)))))
+
 (defun isearch-lazy-highlight-start ()
   "Start a new lazy-highlight updating loop."
   (lazy-highlight-cleanup t) ;remove old overlays
@@ -3321,19 +3356,32 @@ Attempt to do the search exactly the way the pending 
Isearch would."
   "Update highlighting of other matches for current search."
   (let ((max lazy-highlight-max-at-a-time)
         (looping t)
-        nomore)
+        nomore window-start window-end)
     (with-local-quit
       (save-selected-window
        (if (and (window-live-p isearch-lazy-highlight-window)
                 (not (memq (selected-window) 
isearch-lazy-highlight-window-group)))
            (select-window isearch-lazy-highlight-window))
+       (setq window-start (window-group-start))
+       (setq window-end (window-group-end))
        (save-excursion
          (save-match-data
            (goto-char (if isearch-lazy-highlight-forward
                           isearch-lazy-highlight-end
                         isearch-lazy-highlight-start))
            (while looping
-             (let ((found (isearch-lazy-highlight-search)))
+             (let* ((bound (if isearch-lazy-highlight-forward
+                               (min (or isearch-lazy-highlight-end-limit 
(point-max))
+                                    (if isearch-lazy-highlight-wrapped
+                                        isearch-lazy-highlight-start
+                                      window-end))
+                             (max (or isearch-lazy-highlight-start-limit 
(point-min))
+                                  (if isearch-lazy-highlight-wrapped
+                                      isearch-lazy-highlight-end
+                                    window-start))))
+                    (found (isearch-lazy-highlight-search
+                            isearch-lazy-highlight-last-string
+                            bound)))
                (when max
                  (setq max (1- max))
                  (if (<= max 0)
@@ -3345,24 +3393,17 @@ Attempt to do the search exactly the way the pending 
Isearch would."
                          (if isearch-lazy-highlight-forward
                              (if (= mb (if isearch-lazy-highlight-wrapped
                                            isearch-lazy-highlight-start
-                                         (window-group-end)))
+                                         window-end))
                                  (setq found nil)
                                (forward-char 1))
                            (if (= mb (if isearch-lazy-highlight-wrapped
                                          isearch-lazy-highlight-end
-                                       (window-group-start)))
+                                       window-start))
                                (setq found nil)
                              (forward-char -1)))
 
                        ;; non-zero-length match
-                       (let ((ov (make-overlay mb me)))
-                         (push ov isearch-lazy-highlight-overlays)
-                         ;; 1000 is higher than ediff's 100+,
-                         ;; but lower than isearch main overlay's 1001
-                         (overlay-put ov 'priority 1000)
-                         (overlay-put ov 'face 'lazy-highlight)
-                         (unless (eq isearch-lazy-highlight 'all-windows)
-                            (overlay-put ov 'window (selected-window)))))
+                       (isearch-lazy-highlight-match mb me))
                      ;; Remember the current position of point for
                      ;; the next call of `isearch-lazy-highlight-update'
                      ;; when `lazy-highlight-max-at-a-time' is too small.
@@ -3378,17 +3419,82 @@ Attempt to do the search exactly the way the pending 
Isearch would."
                      (setq isearch-lazy-highlight-wrapped t)
                      (if isearch-lazy-highlight-forward
                          (progn
-                           (setq isearch-lazy-highlight-end 
(window-group-start))
+                           (setq isearch-lazy-highlight-end window-start)
                            (goto-char (max (or 
isearch-lazy-highlight-start-limit (point-min))
-                                           (window-group-start))))
-                       (setq isearch-lazy-highlight-start (window-group-end))
+                                           window-start)))
+                       (setq isearch-lazy-highlight-start window-end)
                        (goto-char (min (or isearch-lazy-highlight-end-limit 
(point-max))
-                                       (window-group-end))))))))
-           (unless nomore
+                                       window-end)))))))
+           (if nomore
+               (when isearch-lazy-highlight-buffer
+                 (if isearch-lazy-highlight-forward
+                     (setq isearch-lazy-highlight-end (point-min))
+                   (setq isearch-lazy-highlight-start (point-max)))
+                 (run-at-time lazy-highlight-interval nil
+                              'isearch-lazy-highlight-buffer-update))
              (setq isearch-lazy-highlight-timer
                    (run-at-time lazy-highlight-interval nil
                                 'isearch-lazy-highlight-update)))))))))
 
+(defun isearch-lazy-highlight-buffer-update ()
+  "Update highlighting of other matches in the full buffer."
+  (let ((max lazy-highlight-buffer-max-at-a-time)
+        (looping t)
+        nomore window-start window-end)
+    (with-local-quit
+      (save-selected-window
+       (if (and (window-live-p isearch-lazy-highlight-window)
+                (not (memq (selected-window) 
isearch-lazy-highlight-window-group)))
+           (select-window isearch-lazy-highlight-window))
+       (setq window-start (window-group-start))
+       (setq window-end (window-group-end))
+       (save-excursion
+         (save-match-data
+           (goto-char (if isearch-lazy-highlight-forward
+                          isearch-lazy-highlight-end
+                        isearch-lazy-highlight-start))
+           (while looping
+             (let* ((bound (if isearch-lazy-highlight-forward
+                               (or isearch-lazy-highlight-end-limit 
(point-max))
+                             (or isearch-lazy-highlight-start-limit 
(point-min))))
+                    (found (isearch-lazy-highlight-search
+                            isearch-lazy-highlight-last-string
+                            bound)))
+               (when max
+                 (setq max (1- max))
+                 (if (<= max 0)
+                     (setq looping nil)))
+               (if found
+                   (let ((mb (match-beginning 0))
+                         (me (match-end 0)))
+                     (if (= mb me)     ;zero-length match
+                         (if isearch-lazy-highlight-forward
+                             (if (= mb (point-max))
+                                 (setq found nil)
+                               (forward-char 1))
+                           (if (= mb (point-min))
+                               (setq found nil)
+                             (forward-char -1)))
+                       ;; Already highlighted by isearch-lazy-highlight-update
+                       (unless (and (>= mb window-start) (<= me window-end))
+                         ;; non-zero-length match
+                         (isearch-lazy-highlight-match mb me)))
+                     ;; Remember the current position of point for
+                     ;; the next call of `isearch-lazy-highlight-update'
+                     ;; when `lazy-highlight-buffer-max-at-a-time' is too 
small.
+                     (if isearch-lazy-highlight-forward
+                         (setq isearch-lazy-highlight-end (point))
+                       (setq isearch-lazy-highlight-start (point)))))
+
+               ;; not found or zero-length match at the search bound
+               (if (not found)
+                   (setq looping nil
+                         nomore  t))))
+           (unless nomore
+             (setq isearch-lazy-highlight-timer
+                   (run-at-time lazy-highlight-interval nil
+                                'isearch-lazy-highlight-buffer-update)))))))))
+
 (defun isearch-resume (string regexp word forward message case-fold)
   "Resume an incremental search.
 STRING is the string or regexp searched for.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 956fe2d..11ee063 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4492,7 +4492,8 @@ means discard it)."
     (if (stringp output) (concat " >" output) ""))))
 
 (defconst tramp-inline-compress-commands
-  '(("gzip" "gzip -d")
+  '(;; Suppress warnings about obsolete environment variable GZIP.
+    ("env GZIP= gzip" "env GZIP= gzip -d")
     ("bzip2" "bzip2 -d")
     ("xz" "xz -d")
     ("compress" "compress -d"))
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 18a7232..7d08843 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -8786,7 +8786,7 @@ do extra unwind via `cperl-unwind-to-safe'."
        (goto-char new-beg)))
     (setq beg (point))
     (goto-char end)
-    (while (and end
+    (while (and end (< end (point-max))
                (progn
                  (or (bolp) (condition-case nil
                                 (forward-line 1)
diff --git a/lisp/simple.el b/lisp/simple.el
index 562a912..6a7d210 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1071,13 +1071,16 @@ instead of deleted."
         (filter-buffer-substring (region-beginning) (region-end) method)))))
   "Function to get the region's content.
 Called with one argument METHOD which can be:
-- nil: return the content as a string.
+- nil: return the content as a string (list of strings for
+  non-contiguous regions).
 - `delete-only': delete the region; the return value is undefined.
-- `bounds': return the boundaries of the region as a list of cons
-  cells of the form (START . END).
+- `bounds': return the boundaries of the region as a list of one
+  or more cons cells of the form (START . END).
 - anything else: delete the region and return its content
-  as a string, after filtering it with `filter-buffer-substring', which
-  is called with METHOD as its 3rd argument.")
+  as a string (or list of strings for non-contiguous regions),
+  after filtering it with `filter-buffer-substring', which
+  is called, for each contiguous sub-region, with METHOD as its
+  3rd argument.")
 
 (defvar region-insert-function
   (lambda (lines)
@@ -5527,8 +5530,10 @@ also checks the value of `use-empty-active-region'."
        (progn (cl-assert (mark)) t)))
 
 (defun region-bounds ()
-  "Return the boundaries of the region as a pair of positions.
-Value is a list of cons cells of the form (START . END)."
+  "Return the boundaries of the region.
+Value is a list of one or more cons cells of the form (START . END).
+It will have more than one cons cell when the region is non-contiguous,
+see `region-noncontiguous-p' and `extract-rectangle-bounds'."
   (funcall region-extract-function 'bounds))
 
 (defun region-noncontiguous-p ()
@@ -7935,7 +7940,7 @@ With a prefix argument, set VARIABLE to VALUE 
buffer-locally."
                   (read-variable (format "Set variable (default %s): " 
default-var)
                                  default-var)
                 (read-variable "Set variable: ")))
-         (minibuffer-help-form '(describe-variable var))
+         (minibuffer-help-form `(describe-variable ',var))
          (prop (get var 'variable-interactive))
           (obsolete (car (get var 'byte-obsolete-variable)))
          (prompt (format "Set %s %s to value: " var
diff --git a/src/image.c b/src/image.c
index 24decbc..ad4f95b 100644
--- a/src/image.c
+++ b/src/image.c
@@ -4309,7 +4309,7 @@ xpm_load_image (struct frame *f,
   return 1;
 
  failure:
-  image_error ("Invalid XPM file (%s)", img->spec);
+  image_error ("Invalid XPM3 file (%s)", img->spec);
   x_destroy_x_image (ximg);
   x_destroy_x_image (mask_img);
   x_clear_image (f, img);
diff --git a/src/nsterm.m b/src/nsterm.m
index 1ef7f5a..bcc23ff 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -279,7 +279,6 @@ long context_menu_value = 0;
 
 /* display update */
 static int ns_window_num = 0;
-static BOOL gsaved = NO;
 static BOOL ns_fake_keydown = NO;
 #ifdef NS_IMPL_COCOA
 static BOOL ns_menu_bar_is_hidden = NO;
@@ -1234,7 +1233,6 @@ ns_clip_to_rect (struct frame *f, NSRect *r, int n)
             NSRectClipList (r, 2);
           else
             NSRectClip (*r);
-          gsaved = YES;
 
           return YES;
         }
@@ -1258,11 +1256,7 @@ ns_reset_clipping (struct frame *f)
 {
   NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_reset_clipping");
 
-  if (gsaved)
-    {
-      [[NSGraphicsContext currentContext] restoreGraphicsState];
-      gsaved = NO;
-    }
+  [[NSGraphicsContext currentContext] restoreGraphicsState];
 }
 
 
@@ -1288,19 +1282,6 @@ ns_clip_to_row (struct window *w, struct glyph_row *row,
   return ns_clip_to_rect (f, &clip_rect, 1);
 }
 
-
-static void
-ns_flush_display (struct frame *f)
-/* Force the frame to redisplay.  If areas have previously been marked
-   dirty by setNeedsDisplayInRect (in ns_clip_to_rect), then this will call
-   draw_rect: which will "expose" those areas.  */
-{
-  block_input ();
-  [FRAME_NS_VIEW (f) displayIfNeeded];
-  unblock_input ();
-}
-
-
 /* ==========================================================================
 
     Visible bell and beep.
@@ -2837,6 +2818,8 @@ ns_clear_frame_area (struct frame *f, int x, int y, int 
width, int height)
 static void
 ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
 {
+  NSSize delta = NSMakeSize (dest.origin.x - src.origin.x,
+                             dest.origin.y - src.origin.y)
   NSTRACE ("ns_copy_bits");
 
   if (FRAME_NS_VIEW (f))
@@ -2845,10 +2828,21 @@ ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
 
       /* FIXME: scrollRect:by: is deprecated in macOS 10.14.  There is
          no obvious replacement so we may have to come up with our own.  */
-      [FRAME_NS_VIEW (f) scrollRect: src
-                                 by: NSMakeSize (dest.origin.x - src.origin.x,
-                                                 dest.origin.y - 
src.origin.y)];
-      [FRAME_NS_VIEW (f) setNeedsDisplay:YES];
+      [FRAME_NS_VIEW (f) scrollRect: src by: delta];
+
+#ifdef NS_IMPL_COCOA
+      /* As far as I can tell from the documentation, scrollRect:by:,
+         above, should copy the dirty rectangles from our source
+         rectangle to our destination, however it appears it clips the
+         operation to src.  As a result we need to use
+         translateRectsNeedingDisplayInRect:by: below, and we have to
+         union src and dest so it can pick up the dirty rectangles,
+         and place them, as it also clips to the rectangle.
+
+         FIXME: We need a GNUstep equivalent.  */
+      [FRAME_NS_VIEW (f) translateRectsNeedingDisplayInRect:NSUnionRect (src, 
dest)
+                                                         by:delta];
+#endif
     }
 }
 
@@ -3233,15 +3227,6 @@ ns_draw_window_cursor (struct window *w, struct 
glyph_row *glyph_row,
       else
         [FRAME_CURSOR_COLOR (f) set];
 
-#ifdef NS_IMPL_COCOA
-      /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph
-         atomic.  Cleaner ways of doing this should be investigated.
-         One way would be to set a global variable DRAWING_CURSOR
-         when making the call to draw_phys..(), don't focus in that
-         case, then move the ns_reset_clipping() here after that call.  */
-      NSDisableScreenUpdates ();
-#endif
-
       switch (cursor_type)
         {
         case DEFAULT_CURSOR:
@@ -3275,10 +3260,6 @@ ns_draw_window_cursor (struct window *w, struct 
glyph_row *glyph_row,
       /* draw the character under the cursor */
       if (cursor_type != NO_CURSOR)
         draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
-
-#ifdef NS_IMPL_COCOA
-      NSEnableScreenUpdates ();
-#endif
     }
 }
 
@@ -5119,7 +5100,7 @@ static struct redisplay_interface ns_redisplay_interface =
   ns_after_update_window_line,
   ns_update_window_begin,
   ns_update_window_end,
-  ns_flush_display, /* flush_display */
+  0, /* flush_display */
   x_clear_window_mouse_face,
   x_get_glyph_overhangs,
   x_fix_overlapping_area,
@@ -7114,7 +7095,6 @@ not_in_argv (NSString *arg)
         size_title = xmalloc (strlen (old_title) + 40);
        esprintf (size_title, "%s  —  (%d x %d)", old_title, cols, rows);
         [window setTitle: [NSString stringWithUTF8String: size_title]];
-        [window display];
         xfree (size_title);
       }
   }
@@ -8164,8 +8144,8 @@ not_in_argv (NSString *arg)
 
 - (void)drawRect: (NSRect)rect
 {
-  int x = NSMinX (rect), y = NSMinY (rect);
-  int width = NSWidth (rect), height = NSHeight (rect);
+  const NSRect *rectList;
+  NSInteger numRects;
 
   NSTRACE ("[EmacsView drawRect:" NSTRACE_FMT_RECT "]",
            NSTRACE_ARG_RECT(rect));
@@ -8173,9 +8153,23 @@ not_in_argv (NSString *arg)
   if (!emacsframe || !emacsframe->output_data.ns)
     return;
 
-  ns_clear_frame_area (emacsframe, x, y, width, height);
   block_input ();
-  expose_frame (emacsframe, x, y, width, height);
+
+  /* Get only the precise dirty rectangles to avoid redrawing
+     potentially large areas of the frame that haven't changed.
+
+     I'm not sure this actually provides much of a performance benefit
+     as it's hard to benchmark, but it certainly doesn't seem to
+     hurt.  */
+  [self getRectsBeingDrawn:&rectList count:&numRects];
+  for (int i = 0 ; i < numRects ; i++)
+    {
+      NSRect r = rectList[i];
+      expose_frame (emacsframe,
+                    NSMinX (r), NSMinY (r),
+                    NSWidth (r), NSHeight (r));
+    }
+
   unblock_input ();
 
   /*



reply via email to

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