unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37417: 26.3; [PATCH] Isearch yank text at point improvements
@ 2019-09-16  0:59 Drew Adams
  2019-11-19 16:44 ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2019-09-16  0:59 UTC (permalink / raw)
  To: 37417

[-- Attachment #1: Type: text/plain, Size: 950 bytes --]

The attached patches and change-log entry implement what is
discussed in emacs-devel thread "PATCH: isearch-yank-until-match"
and part of thread "PATCH: isearch-yank-until-char".

1. They fix commands that yank consecutive text at point so that
   they respect search direction.  This is controlled by option
   `isearch-directional-yank'.

2. Related new yank commands are provided:
   `isearch-yank-through-new-match', bound to `C-M-m'
   `isearch-yank-through-key-move', bound to `M-s k'
   `isearch-yank-through-rec-edit-move', bound to `C-M-c'

3. Emacs manual node `Isearch Yank' is updated accordingly.

In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.17763
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''

[-- Attachment #2: isearch-el-2019-09-14c.patch --]
[-- Type: application/octet-stream, Size: 19294 bytes --]

diff -u isearch.el isearch-2019-09-14b-PATCHED.el
--- isearch.el	2019-09-14 09:43:02.426403600 -0700
+++ isearch-2019-09-14b-PATCHED.el	2019-09-15 17:12:20.146560800 -0700
@@ -173,6 +173,10 @@
 command history."
   :type 'boolean)
 
+(defcustom isearch-directional-yank t
+  "Non-nil if yanking consecutive text at point respects search direction."
+  :type 'boolean)
+
 (defvar isearch-mode-hook nil
   "Function(s) to call after starting up an incremental search.")
 
@@ -517,6 +521,15 @@
     (define-key map [isearch-yank-until-char]
       '(menu-item "Until char..." isearch-yank-until-char
                   :help "Yank from point to specified character into search string"))
+    (define-key map [isearch-yank-through-new-match]
+      '(menu-item "Through Match For..." isearch-yank-through-new-match
+                  :help "Yank from point through match for another pattern"))
+    (define-key map [isearch-yank-through-key-move]
+      '(menu-item "Through Key Destination..." isearch-yank-through-key-move
+                  :help "Yank from search hit through new position from using a key"))
+    (define-key map [isearch-yank-through-rec-edit-move]
+      '(menu-item "Through Recursive-Edit Destination..." isearch-yank-through-rec-edit-move
+                  :help "Yank from search hit through new position from recursive edit"))
     (define-key map [isearch-yank-line]
       '(menu-item "Rest of line" isearch-yank-line
                   :help "Yank the rest of the current line on search string"))
@@ -708,8 +721,11 @@
     (define-key map "\M-\C-d" 'isearch-del-char)
     (define-key map "\M-\C-y" 'isearch-yank-char)
     (define-key map    "\C-y" 'isearch-yank-kill)
-    (define-key map "\M-\C-z" 'isearch-yank-until-char)
     (define-key map "\M-s\C-e" 'isearch-yank-line)
+    (define-key map "\M-\C-z" 'isearch-yank-until-char)
+    (define-key map (kbd "C-M-m") 'isearch-yank-through-new-match)
+    (define-key map (kbd "M-s k") 'isearch-yank-through-key-move)
+    (define-key map (kbd "C-M-c") 'isearch-yank-through-rec-edit-move)
 
     (define-key map "\M-s\M-<" 'isearch-beginning-of-buffer)
     (define-key map "\M-s\M->" 'isearch-end-of-buffer)
@@ -1003,7 +1019,13 @@
 Type \\[isearch-yank-char] to yank char from buffer onto end of search\
  string and search for it.
 Type \\[isearch-yank-until-char] to yank from point until the next instance of a
- specified character onto end of search string and search for it.
+ specified character onto end of search string.
+Type \\[isearch-yank-through-new-match] to yank from point through match for another pattern
+ onto search string.
+Type \\[isearch-yank-through-key-move] to yank from search hit through position from movement key\
+ onto search string.
+Type \\[isearch-yank-through-rec-edit-move] to yank from search hit through position from recursive edit\
+ onto search string.
 Type \\[isearch-yank-line] to yank rest of line onto end of search string\
  and search for it.
 Type \\[isearch-yank-kill] to yank the last string of killed text.
@@ -1737,6 +1759,64 @@
      (isearch-abort)  ;; outside of let to restore outside global values
      )))
 
+(defmacro define-isearch-yank-movement-command (command arguments doc-string
+                                                        interactive
+                                                        bindings action)
+  "Define Isearch COMMAND to adjust search string based on cursor position.
+The command should move the cursor, which is at one end of the current
+search hit, to a new location.
+
+The existing search string is expanded or reduced to include the
+buffer text from the search hit through the new cursor position.
+
+ARGUMENTS is a list of arguments to the command.
+DOC-STRING is the command's doc string.
+INTERACTIVE is `interative' form.
+BINDINGS is a list of `let*' bindings added around the command code.
+  Local variable `isearch-new-position' is also bound, before the
+  BINDINGS you provide - see ACTION, below.
+BINDINGS is macroexpanded, so it can also be a macro call that expands
+to a list of bindings.
+
+ACTION is your code that moves the cursor.  It should set variable
+`isearch-new-position' to the new cursor position."
+  (let ((fwd     (make-symbol "fwd"))
+        (beg     (make-symbol "beg"))
+        (end     (make-symbol "end"))
+        (min-be  (make-symbol "min-be"))
+        (max-be  (make-symbol "max-be")))
+    `(defun ,command ,arguments ,doc-string
+            ,interactive
+            (let ((,fwd  isearch-forward)
+                  (,beg  isearch-other-end)
+                  (,end  (point))
+                  isearch-new-position)
+              (let* ,bindings
+                ,action
+                (let ((,min-be  (min ,beg ,end))
+                      (,max-be  (max ,beg ,end)))
+                  (setq isearch-string     (if (< isearch-new-position ,beg)
+                                               (buffer-substring
+                                                (min isearch-new-position ,max-be)
+                                                (max isearch-new-position ,max-be))
+                                             (buffer-substring
+                                              (min isearch-new-position ,min-be)
+                                              (max isearch-new-position ,min-be)))
+                        isearch-message    (mapconcat 'isearch-text-char-description
+                                                      isearch-string "")
+                        isearch-barrier    (if (or (and ,fwd
+                                                        (< isearch-new-position ,beg))
+                                                   (and (not ,fwd)
+                                                        (not (< isearch-new-position ,beg))))
+                                               ,end
+                                             isearch-new-position)
+                        isearch-other-end  (if (< isearch-new-position ,beg)
+                                               (if ,fwd isearch-new-position ,beg)
+                                             (if (not ,fwd) isearch-new-position ,beg)))
+                  (goto-char isearch-barrier)
+                  (isearch-highlight isearch-other-end isearch-barrier)
+                  (when isearch-lazy-highlight (isearch-lazy-highlight-new-loop))))))))
+
 (defvar minibuffer-history-symbol) ;; from external package gmhist.el
 
 (defun isearch-edit-string ()
@@ -2453,8 +2533,9 @@
   (isearch-push-state)
   (isearch-update))
 
-(defun isearch-yank-string (string)
-  "Pull STRING into search string."
+(defun isearch-yank-string (string &optional respect-direction)
+  "Pull STRING into search string.
+Non-nil RESPECT-DIRECTION means prepend STRING if searching backward."
   ;; Downcase the string if not supposed to case-fold yanked strings.
   (if (and isearch-case-fold-search
 	   (eq 'not-yanks search-upper-case))
@@ -2462,8 +2543,9 @@
   (if isearch-regexp (setq string (regexp-quote string)))
   ;; Don't move cursor in reverse search.
   (setq isearch-yank-flag t)
-  (isearch-process-search-string
-   string (mapconcat 'isearch-text-char-description string "")))
+  (isearch-process-search-string string
+				 (mapconcat 'isearch-text-char-description string "")
+				 respect-direction))
 
 (defun isearch-yank-kill ()
   "Pull string from kill ring into search string."
@@ -2514,17 +2596,20 @@
   (interactive)
   (isearch-yank-string (xterm--pasted-text)))
 
-(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
-a buffer position, possibly having moved point to that position.
-For example, it might move point forward by a word and return point,
-or it might return the position of the end of the line."
+(defun isearch-yank-internal (jumpfun &optional respect-direction)
+  "Pull the text from point to the point reached by JUMPFUN.
+JUMPFUN is a function that takes no arguments and returns a buffer
+position, possibly having moved point to that position.
+
+For example, JUMPFUN might move forward by a word and return point, or
+it might return the position of the end of the line.
+
+Non-nil RESPECT-DIRECTION means prepend text if searching backward."
   (isearch-yank-string
-   (save-excursion
-     (and (not isearch-forward) isearch-other-end
-	  (goto-char isearch-other-end))
-     (buffer-substring-no-properties (point) (funcall jumpform)))))
+   (save-excursion 
+       (when (and (not isearch-forward)  (not respect-direction)) (goto-char isearch-other-end))
+       (buffer-substring-no-properties (point) (funcall jumpfun)))
+   respect-direction))
 
 (defun isearch-yank-char-in-minibuffer (&optional arg)
   "Pull next character from buffer into end of search string in minibuffer."
@@ -2537,61 +2622,191 @@
     (forward-char arg)))
 
 (defun isearch-yank-char (&optional arg)
-  "Pull next character from buffer into search string.
-If optional ARG is non-nil, pull in the next ARG characters."
+  "Pull character from buffer into search string.
+If `isearch-directional-yank' is non-nil then use next char for
+forward search, previous char for backward search.
+
+With a numeric prefix ARG, pull in ARG characters."
   (interactive "p")
-  (isearch-yank-internal (lambda () (forward-char arg) (point))))
+  (isearch-yank-internal
+   (lambda ()
+     (funcall (if (or isearch-forward  (not isearch-directional-yank))
+                  #'forward-char
+                #'backward-char)
+              arg)
+     (point))
+   isearch-directional-yank))
 
-(defun isearch--yank-char-or-syntax (syntax-list fn)
+(defun isearch--yank-char-or-syntax (syntax-list fn &optional respect-direction)
   (isearch-yank-internal
    (lambda ()
      (if (or (memq (char-syntax (or (char-after) 0)) syntax-list)
              (memq (char-syntax (or (char-after (1+ (point))) 0))
                    syntax-list))
 	 (funcall fn 1)
-       (forward-char 1))
-     (point))))
+       (if (or isearch-forward  (not respect-direction))
+           (forward-char 1)
+         (backward-char 1)))
+     (point))
+   respect-direction))
 
 (defun isearch-yank-word-or-char ()
+  "Pull character or word from buffer into search string.
+If `isearch-directional-yank' is non-nil then yank next one for
+forward search, previous one for backward search."
+  (interactive)
+  (if (or isearch-forward  (not isearch-directional-yank))
+      (isearch--yank-char-or-syntax '(?w) 'forward-word isearch-directional-yank)
+    (isearch--yank-char-or-syntax '(?w) 'backward-word 'RESPECT-DIRECTION)))
+
+(defun isearch-yank-word-or-char-forward ()
   "Pull next character or word from buffer into search string."
   (interactive)
-  (isearch--yank-char-or-syntax '(?w) 'forward-word))
+  (isearch--yank-char-or-syntax '(?w) 'forward-word isearch-directional-yank))
 
-(defun isearch-yank-symbol-or-char ()
-  "Pull next character or symbol from buffer into search string."
+(defun isearch-yank-word-or-char-backward ()
+  "Pull previous character or word from buffer into search string."
   (interactive)
-  (isearch--yank-char-or-syntax '(?w ?_) 'forward-symbol))
+  (isearch--yank-char-or-syntax '(?w) 'backward-word 'RESPECT-DIRECTION))
+
+(defun isearch-yank-symbol-or-char ()
+  "Pull character or symbol from buffer into search string.
+If `isearch-directional-yank' is non-nil then pull next one for
+forward search, previous one for backward search."
+  (interactive)
+  (if (or isearch-forward  (not isearch-directional-yank))
+      (isearch--yank-char-or-syntax '(?w ?_) 'forward-symbol isearch-directional-yank)
+    (isearch--yank-char-or-syntax '(?w ?_) 'backward-symbol 'RESPECT-DIRECTION)))
 
 (defun isearch-yank-word (&optional arg)
-  "Pull next word from buffer into search string.
-If optional ARG is non-nil, pull in the next ARG words."
-  (interactive "p")
-  (isearch-yank-internal (lambda () (forward-word arg) (point))))
+  "Pull word from buffer into search string.
+If `isearch-directional-yank' is non-nil then pull next word for
+forward search, previous word for backward search.
 
-(defun isearch-yank-until-char (char)
-  "Pull everything until next instance of CHAR from buffer into search string.
-Interactively, prompt for CHAR.
-This is often useful for keyboard macros, for example in programming
-languages or markup languages in which CHAR marks a token boundary."
-  (interactive "cYank until character: ")
+With a numeric prefix ARG, pull in ARG words."
+  (interactive "p")
   (isearch-yank-internal
-   (lambda () (let ((inhibit-field-text-motion t))
-                (condition-case nil
-                    (progn
-                      (search-forward (char-to-string char))
-                      (forward-char -1))
-                  (search-failed
-                   (message "`%c' not found" char)
-                   (sit-for 2)))
-                (point)))))
+   (lambda ()
+     (funcall (if (or isearch-forward  (not isearch-directional-yank))
+                  #'forward-word
+                #'backward-word)
+              arg)
+     (point))
+   isearch-directional-yank))
 
 (defun isearch-yank-line (&optional arg)
   "Pull rest of line from buffer into search string.
-If optional ARG is non-nil, yank the next ARG lines."
+If `isearch-directional-yank' is non-nil then pull in rest of line in
+search direction.
+
+With a numeric prefix ARG, pull in ARG lines."
+  (interactive "p")
+  (if (or isearch-forward  (not isearch-directional-yank))
+      (isearch-yank-line-forward arg)
+    (isearch-yank-line-backward arg)))
+
+(defun isearch-yank-line-forward (&optional arg)
+  "Pull rest of line, going forward, from buffer into search string.
+With a numeric prefix ARG, pull in the next ARG lines."
+  (interactive "p")
+  (isearch-yank-internal
+   (lambda ()
+     (let ((inhibit-field-text-motion  t))
+       (line-end-position (if (eolp) (1+ arg) arg))))))
+
+(defun isearch-yank-line-backward (&optional arg)
+  "Pull rest of line, going backward, from buffer into search string.
+With a numeric prefix ARG, pull in the previous ARG lines."
   (interactive "p")
   (isearch-yank-internal
-   (lambda () (let ((inhibit-field-text-motion t))
-		(line-end-position (if (eolp) (1+ arg) arg))))))
+   (lambda ()
+     (let ((inhibit-field-text-motion  t)
+	   (arg2                       (- 2 arg)))
+       (line-beginning-position (if (bolp) (1- arg2) arg2))))
+   'RESPECT-DIRECTION))
+
+(defun isearch-yank-until-char (char)
+  "Pull buffer text, up to next instance of CHAR, into search string.
+You are prompted for CHAR.
+This is often useful for keyboard macros, for example in programming
+languages or markup languages in which CHAR marks a token boundary."
+  (interactive "cYank until character: ")
+  (isearch-yank-internal
+   (lambda ()
+     (let ((inhibit-field-text-motion  t)
+           (fwd                        (or isearch-forward  (not isearch-directional-yank))))
+       (condition-case nil
+           (progn (funcall (if fwd #'search-forward #'search-backward)
+                           (char-to-string char))
+                  (if fwd (backward-char) (forward-char)))
+         (search-failed (message "`%c' not found" char) (sit-for 2)))
+       (point)))
+   isearch-directional-yank))
+
+(defun isearch-yank-through-new-match (arg)
+  "Pull text from point through match for another pattern, onto search string.
+You are prompted for the pattern.
+With a prefix arg, match the pattern as a regexp."
+  (interactive "P")
+  (let ((fwd  (or isearch-forward  (not isearch-directional-yank)))
+        pattern)
+    (with-isearch-suspended
+     (setq pattern  (if arg (read-regexp "Match regexp: ") (read-string "Match: "))))
+    (isearch-yank-internal
+     (lambda ()
+       (let ((inhibit-field-text-motion  t))
+         (funcall (if arg
+                      (if fwd #'search-forward-regexp #'search-backward-regexp)
+                    (if fwd #'search-forward #'search-backward))
+                  pattern)
+         (point)))
+     isearch-directional-yank)))
+
+(define-isearch-yank-movement-command isearch-yank-through-key-move (key)
+  "Adjust search to include text from search hit through a key destination.
+You are prompted for a key sequence that moves the cursor.  The key
+can do anything else as well, but only the new cursor position is used
+by the command.
+
+If it makes sense for the key, you can use a prefix arg with `\\<isearch-mode-map>\
+\\[isearch-yank-through-key-move]'
+to apply the prefix arg to the key.  For example, `C-u 5 \
+\\[isearch-yank-through-key-move] M-f'
+moves the cursor forward 5 words and adjusts the search string
+accordingly.
+
+If the new position is outside the existing search hit then the text
+from the search hit to the new position is added to the search string.
+If the position is inside the hit, then the text from the edge of the
+hit through the new position is removed from the search string."
+  (interactive "kKey sequence (to move cursor): ")
+  ((inhibit-field-text-motion  t)
+   (isearch-mode-map           nil)
+   (command                    (key-binding key t)))
+  (save-excursion
+    (call-interactively command)
+    (setq isearch-new-position  (point))))
+
+(define-isearch-yank-movement-command isearch-yank-through-rec-edit-move ()
+  "Adjust search to include text from search hit through a new cursor position.
+You enter a recursive edit to move the cursor any way you like.
+Use \\[exit-recursive-edit] to resume search with the adjusted search string.
+
+In the recursive edit you can do anything, but the effect used by the
+command is only cursor movement to a new position.
+
+If the new position is outside the existing search hit then the text
+from the search hit to the new position is added to the search string.
+If the position is inside the hit, then the text from the edge of the
+hit through the new position is removed from the search string."
+  (interactive)
+  ()
+  (with-isearch-suspended
+   (save-excursion
+     (message (substitute-command-keys
+               "RECURSIVE edit. `\\[exit-recursive-edit]' to resume Isearch"))
+     (recursive-edit)
+     (setq isearch-new-position  (point)))))
 
 (defun isearch-char-by-name (&optional count)
   "Read a character by its Unicode name and add it to the search string.
@@ -3037,9 +3252,16 @@
 		    (mapconcat 'isearch-text-char-description string ""))))
     (isearch-process-search-string string message)))
 
-(defun isearch-process-search-string (string message)
-  (setq isearch-string (concat isearch-string string)
-	isearch-message (concat isearch-message message))
+(defun isearch-process-search-string (string message &optional respect-direction)
+  "Append STRING to `isearch-string' and MESSAGE to `isearch-message'.
+Non-nil RESPECT-DIRECTION means prepend STRING if searching backward."
+  (let ((fwd  (or isearch-forward  (not respect-direction))))
+    (setq isearch-string   (if fwd
+			       (concat isearch-string string)
+			     (concat string isearch-string))
+	  isearch-message  (if fwd
+			       (concat isearch-message message)
+			     (concat message isearch-message))))
   (isearch-search-and-update))
 
 \f

[-- Attachment #3: search-texi-2019-09-14c.patch --]
[-- Type: application/octet-stream, Size: 3318 bytes --]

diff -u search.texi search-2019-09-14b-PATCHED.texi
--- search.texi	2019-09-14 10:54:14.421506200 -0700
+++ search-2019-09-14b-PATCHED.texi	2019-09-15 17:26:33.159283700 -0700
@@ -246,6 +246,13 @@
 search string.  The commands described in this subsection let you do
 that conveniently.
 
+@cindex incremental search, yank direction
+@cindex incremental search, directional yank
+If option @code{isearch-directional-yank} is non-@code{nil} then
+yanking consecutive buffer text at the search hit respects the search
+direction: reverse search prepends the yanked text to the search
+string.  (Forward search always appends the yanked text.)
+
 @kindex C-w @r{(Incremental search)}
 @findex isearch-yank-word-or-char
   @kbd{C-w} (@code{isearch-yank-word-or-char}) appends the next
@@ -269,12 +276,51 @@
 
 @kindex C-M-z @r{(Incremental search)}
 @findex isearch-yank-until-char
-  Similarly, @kbd{C-M-z} (@code{isearch-yank-until-char}) appends to
+  @kbd{C-M-z} (@code{isearch-yank-until-char}) appends to
 the search string everything from point until the next occurence of
 a specified character (not including that character).  This is especially
 useful for keyboard macros, for example in programming languages or
 markup languages in which that character marks a token boundary.
 
+@kindex C-M-m @r{(Incremental search)}
+@findex isearch-yank-through-new-match
+ @kbd{C-M-m} (@code{isearch-yank-through-new-match}) pulls text to the
+search string from point through a match for another pattern, for
+which you are prompted.  With a prefix argument the pattern is matched
+as a regexp.
+
+@kindex M-s k @r{(Incremental search)}
+@findex isearch-yank-through-key-move
+ @kbd{M-s k} (@code{isearch-yank-through-key-move}) adjusts the search
+string to include text from the current search hit through the
+destination of using an arbitrary key sequence, for which you are
+prompted.  The key can do anything else as well, but only the new
+cursor position is used by the command.  (Non-nil
+@code{isearch-yank-on-move} is not needed for this.)
+
+If it makes sense for the key, you can use a prefix argument with
+@kbd{M-s k} to apply the prefix arg to the key.  For example, @kbd{C-u
+5 M-s k M-f} moves the cursor forward 5 words and adjusts the search
+string accordingly.
+
+@kindex C-M-c @r{(Incremental search)}
+@findex isearch-yank-through-rec-edit-move
+ @kbd{C-M-c} (@code{isearch-yank-through-rec-edit-move}) adjusts the
+search string to include text from the current search hit through a
+new cursor position, which results from a recursive edit.  Use the
+same key, @kbd{C-M-c}, to end the recursive edit and resume search
+with the adjusted search string.
+
+In the recursive edit you can do anything, but the effect used by the
+command is only the cursor movement to a new position.
+
+For both @code{isearch-yank-through-key-move} and
+@code{isearch-yank-through-rec-edit-move}, if the new position is
+outside the existing search hit then the text from the search hit to
+the new position is added to the search string.  If the position is
+inside the hit then the text from the edge of the hit through the new
+position is removed from the search string.
+
 @kindex C-y @r{(Incremental search)}
 @kindex M-y @r{(Incremental search)}
 @kindex mouse-2 @r{in the minibuffer (Incremental search)}

[-- Attachment #4: NEWS-2019-09-14c.patch --]
[-- Type: application/octet-stream, Size: 2021 bytes --]

diff -u NEWS NEWS-2019-09-14b-PATCHED
--- NEWS	2019-09-14 11:15:41.862099700 -0700
+++ NEWS-2019-09-14b-PATCHED	2019-09-15 17:31:45.096932500 -0700
@@ -1255,10 +1255,22 @@
 +++
 *** New isearch bindings.
 
-'C-M-z' invokes new function 'isearch-yank-until-char', which yanks
-everything from point up to but not including the specified
-character into the search string.  This is especially useful for
-keyboard macros.
+'C-M-c' invokes new command 'isearch-yank-through-rec-edit-move',
+which yanks text from the current search hit through the position from
+a recursive edit.
+
+'C-M-m' invokes new command 'isearch-yank-through-new-match', which
+yanks text from point through a match for another pattern, for which
+you are prompted.
+
+'M-s k' invokes new command 'isearch-yank-through-key-move', which
+yanks text from the current search hit through the position from using
+a key, for which you are prompted.
+
+'C-M-z' invokes new command 'isearch-yank-until-char', which yanks
+text from point up to but not including the specified character, for
+which you are prompted.  This is especially useful for keyboard
+macros.
 
 'C-M-w' in isearch changed from 'isearch-del-char' to the new function
 'isearch-yank-symbol-or-char'.  'isearch-del-char' is now bound to
@@ -1271,12 +1283,17 @@
 JUST the search string.
 
 +++
+*** New option 'isearch-directional-yank' non-'nil' means yanking
+consecutive buffer text at the search hit respects the search
+direction: reverse search prepends the yanked text to the search
+string, instead of appending.
+
 *** New variable 'isearch-yank-on-move' provides options 't' and 'shift'
 to extend the search string by yanking text that ends at the new
 position after moving point in the current buffer.  'shift' extends
 the search string by motion commands while holding down the shift key.
 
-*** 'isearch-allow-scroll' provides new option 'unlimited' to allow
+*** 'isearch-allow-scroll' provides new value 'unlimited', to allow
 scrolling any distance off screen.
 
 ---

[-- Attachment #5: isearch-ChangeLog-2019-09-14a --]
[-- Type: application/octet-stream, Size: 1262 bytes --]

* lisp/isearch.el (isearch-directional-yank): New user option.
  (define-isearch-yank-movement-command): New macro.
  (isearch-yank-through-new-match, isearch-yank-through-key-move,
  isearch-yank-through-rec-edit-move,
  isearch-yank-word-or-char-forward,
  isearch-yank-word-or-char-backward, isearch-yank-line-forward,
  isearch-yank-line-backward): New commands.
  (isearch-menu-bar-yank-map): Add isearch-yank-through-new-match,
  isearch-yank-through-key-move, isearch-yank-through-rec-edit-move.
  (isearch-mode-map): Bind commands: isearch-yank-through-new-match
  (C-M-m), isearch-yank-through-key-move (M-s k),
  isearch-yank-through-rec-edit-move (C-M-c).
  (isearch-forward): Add the new keys to doc string.
  (isearch-yank-string, isearch-yank-internal,
  isearch--yank-char-or-syntax, isearch-process-search-string): Add
  optional arg RESPECT-DIRECTION.
  (isearch-yank-internal): Rename arg JUMPFORM to JUMPFUN and correct
  doc string.
  (isearch-yank-char, isearch--yank-char-or-syntax,
  isearch-yank-symbol-or-char, isearch-yank-word, isearch-yank-line,
  isearch-yank-until-char): Respect isearch-directional-yank.
  
* doc/emacs/search.texi (Isearch Yanking): Document the new option,
  keys, and commands.

* etc/NEWS: Mention the above.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#37417: 26.3; [PATCH] Isearch yank text at point improvements
  2019-09-16  0:59 bug#37417: 26.3; [PATCH] Isearch yank text at point improvements Drew Adams
@ 2019-11-19 16:44 ` Drew Adams
  2019-11-19 23:13   ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2019-11-19 16:44 UTC (permalink / raw)
  To: 37417

ping





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#37417: 26.3; [PATCH] Isearch yank text at point improvements
  2019-11-19 16:44 ` Drew Adams
@ 2019-11-19 23:13   ` Juri Linkov
  2020-08-09 19:00     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2019-11-19 23:13 UTC (permalink / raw)
  To: Drew Adams; +Cc: 37417

> ping

Sorry, your patch is unacceptable large for such a minor peripheral feature.

Either create a separate package that implements this feature,
or rewrite the patch using the seq library that would help
to implement the same feature in just a few lines of code.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#37417: 26.3; [PATCH] Isearch yank text at point improvements
  2019-11-19 23:13   ` Juri Linkov
@ 2020-08-09 19:00     ` Lars Ingebrigtsen
  2020-08-09 23:28       ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-09 19:00 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 37417

Juri Linkov <juri@linkov.net> writes:

>> ping
>
> Sorry, your patch is unacceptable large for such a minor peripheral feature.
>
> Either create a separate package that implements this feature,
> or rewrite the patch using the seq library that would help
> to implement the same feature in just a few lines of code.

It was indeed a surprisingly large patch, but the feature does seem
useful.

I've only skimmed the patch, but could you really replace all that with
just a few lines if you used the seq library?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#37417: 26.3; [PATCH] Isearch yank text at point improvements
  2020-08-09 19:00     ` Lars Ingebrigtsen
@ 2020-08-09 23:28       ` Juri Linkov
  2020-08-10 10:48         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2020-08-09 23:28 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 37417

> It was indeed a surprisingly large patch, but the feature does seem
> useful.
>
> I've only skimmed the patch, but could you really replace all that with
> just a few lines if you used the seq library?

Actually there are several diverse features mingled in the same patch.
Do you think all of them might be useful to add to isearch.el?
I doubt that many users might want to use them.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#37417: 26.3; [PATCH] Isearch yank text at point improvements
  2020-08-09 23:28       ` Juri Linkov
@ 2020-08-10 10:48         ` Lars Ingebrigtsen
  2020-08-10 23:45           ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-10 10:48 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 37417

Juri Linkov <juri@linkov.net> writes:

>> It was indeed a surprisingly large patch, but the feature does seem
>> useful.
>>
>> I've only skimmed the patch, but could you really replace all that with
>> just a few lines if you used the seq library?
>
> Actually there are several diverse features mingled in the same patch.
> Do you think all of them might be useful to add to isearch.el?
> I doubt that many users might want to use them.

OK, so your objection wasn't the lack of the use of the seq library, but
that the patch implements functionality you don't think is useful?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#37417: 26.3; [PATCH] Isearch yank text at point improvements
  2020-08-10 10:48         ` Lars Ingebrigtsen
@ 2020-08-10 23:45           ` Juri Linkov
  2020-08-11 11:07             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2020-08-10 23:45 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 37417

>> Actually there are several diverse features mingled in the same patch.
>> Do you think all of them might be useful to add to isearch.el?
>> I doubt that many users might want to use them.
>
> OK, so your objection wasn't the lack of the use of the seq library, but
> that the patch implements functionality you don't think is useful?

Actually I expressed this opinion in context of my own situation that
is similar to this feature request - some time ago I wrote a patch
for isearch.el that implements a new feature of displaying numeric hints
on each visible lazy-isearch match.  But then my doubt was that it will
impact the size of isearch.el that is already one of the biggest files
in the Emacs repository.  Then I rewrote the patch using the seq library
that helped to squeeze the patch down to a couple dozen of lines,
but still I doubt the usefulness of my implemented feature.
This is why I decided to release it as a separate package.
So this is what I suggest to do with features that are not in high demand,
or are stil experimental, or are too big to fit into the existing packages.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#37417: 26.3; [PATCH] Isearch yank text at point improvements
  2020-08-10 23:45           ` Juri Linkov
@ 2020-08-11 11:07             ` Lars Ingebrigtsen
  2020-08-18 16:13               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-11 11:07 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 37417

Juri Linkov <juri@linkov.net> writes:

> This is why I decided to release it as a separate package.
> So this is what I suggest to do with features that are not in high demand,
> or are stil experimental, or are too big to fit into the existing packages.

Yeah, these new features proposed by Drew seem somewhat complicated, so
having them in a separate package might make sense.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#37417: 26.3; [PATCH] Isearch yank text at point improvements
  2020-08-11 11:07             ` Lars Ingebrigtsen
@ 2020-08-18 16:13               ` Lars Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-18 16:13 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 37417

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Juri Linkov <juri@linkov.net> writes:
>
>> This is why I decided to release it as a separate package.
>> So this is what I suggest to do with features that are not in high demand,
>> or are stil experimental, or are too big to fit into the existing packages.
>
> Yeah, these new features proposed by Drew seem somewhat complicated, so
> having them in a separate package might make sense.

Nobody seems to have an further comments here, so I'm closing this bug
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-08-18 16:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-16  0:59 bug#37417: 26.3; [PATCH] Isearch yank text at point improvements Drew Adams
2019-11-19 16:44 ` Drew Adams
2019-11-19 23:13   ` Juri Linkov
2020-08-09 19:00     ` Lars Ingebrigtsen
2020-08-09 23:28       ` Juri Linkov
2020-08-10 10:48         ` Lars Ingebrigtsen
2020-08-10 23:45           ` Juri Linkov
2020-08-11 11:07             ` Lars Ingebrigtsen
2020-08-18 16:13               ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).