emacs-diffs
[Top][All Lists]
Advanced

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

master f38751d: Make C-w worth in isearch when at the last match in the


From: Lars Ingebrigtsen
Subject: master f38751d: Make C-w worth in isearch when at the last match in the buffer
Date: Sat, 10 Oct 2020 23:06:37 -0400 (EDT)

branch: master
commit f38751db5dd9ff62367d382df85063e924239662
Author: Juri Linkov <juri@linkov.net>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make C-w worth in isearch when at the last match in the buffer
    
    * lisp/isearch.el (isearch-yank-internal): Make C-w work when at
    the last match in the buffer (bug#22118).
---
 lisp/isearch.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index f39de79..1efd9b2 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2535,6 +2535,8 @@ is bound to outside of Isearch."
     (let ((pasted-text (nth 1 event)))
       (isearch-yank-string pasted-text))))
 
+(defvar isearch--yank-prev-point nil)
+
 (defun isearch-yank-internal (jumpform)
   "Pull the text from point to the point reached by JUMPFORM.
 JUMPFORM is a lambda expression that takes no arguments and returns
@@ -2545,7 +2547,14 @@ or it might return the position of the end of the line."
    (save-excursion
      (and (not isearch-forward) isearch-other-end
          (goto-char isearch-other-end))
-     (buffer-substring-no-properties (point) (funcall jumpform)))))
+     (and (not isearch-success) isearch--yank-prev-point
+         (goto-char isearch--yank-prev-point))
+     (buffer-substring-no-properties
+      (point)
+      (prog1
+         (setq isearch--yank-prev-point (funcall jumpform))
+       (when isearch-success
+         (setq isearch--yank-prev-point nil)))))))
 
 (defun isearch-yank-char-in-minibuffer (&optional arg)
   "Pull next character from buffer into end of search string in minibuffer."



reply via email to

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