Subject: Re: bug#14742: 24.3.50; enhancement request: be able to prepend stuff from buffer when search backward

From: Juri Linkov <[email-masked]>
Date: Wed, 03 Jul 2013 01:39:47 +0300

> 2. Just use a name for the position, not the action: e.g. START or
> BEGINNING.  (I would stay away from FRONT & BACK too, as references
> to the search-string ends.  BACK is particularly problematic.)

Then let's use BEGINNING:

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-06-13 22:08:45 +0000
+++ lisp/isearch.el	2013-07-02 22:35:17 +0000
@@ -1839,7 +1839,7 @@ (defun isearch-delete-char ()
     (isearch-pop-state))
   (isearch-update))
 
-(defun isearch-del-char (&optional arg)
+(defun isearch-del-char (&optional arg beginning)
   "Delete character from end of search string and search again.
 Unlike `isearch-delete-char', it only deletes the last character,
 but doesn't cancel the effect of other isearch command.
@@ -1847,9 +1847,13 @@ (defun isearch-del-char (&optional arg)
   (interactive "p")
   (if (= 0 (length isearch-string))
       (ding)
-    (setq isearch-string (substring isearch-string 0
-				    (- (min (or arg 1)
-					    (length isearch-string))))
+    (setq isearch-string (if beginning
+			     (substring isearch-string
+					(min (or arg 1)
+					     (length isearch-string)))
+			   (substring isearch-string 0
+				      (- (min (or arg 1)
+					      (length isearch-string)))))
           isearch-message (mapconcat 'isearch-text-char-description
                                      isearch-string "")))
   ;; Use the isearch-other-end as new starting point to be able
@@ -1858,17 +1862,23 @@ (defun isearch-del-char (&optional arg)
    (isearch-push-state)
    (isearch-update)))
 
-(defun isearch-yank-string (string)
+(defun isearch-yank-string (string &optional beginning)
   "Pull STRING into search string."
   ;; Downcase the string if not supposed to case-fold yanked strings.
   (if (and isearch-case-fold-search
 	   (eq 'not-yanks search-upper-case))
       (setq string (downcase string)))
   (if isearch-regexp (setq string (regexp-quote string)))
-  (setq isearch-string (concat isearch-string string)
+  (setq isearch-string (if beginning
+			   (concat string isearch-string)
+			 (concat isearch-string string))
 	isearch-message
 	(concat isearch-message
 		(mapconcat 'isearch-text-char-description

> 3. To me, yanking stuff to the beginning is more important than
> deleting stuff from the beginning.  I was thinking either have a
> separate key (or set of keys) that is (are) analogous to the
> yank-at-end key(s) or else just reuse the same keys when searching
> backward.

I have no idea about new keys, but I need this change to implement
yanking/deletion by motion keys (disabled by default).