unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: 14742@debbugs.gnu.org
Subject: bug#14742: 24.3.50; enhancement request: be able to prepend stuff from buffer when search backward
Date: Wed, 03 Jul 2013 01:39:47 +0300	[thread overview]
Message-ID: <87y59ok18k.fsf@mail.jurta.org> (raw)
In-Reply-To: <8ada7269-baa9-483f-9595-d46619393aa7@default> (Drew Adams's message of "Sat, 29 Jun 2013 16:02:58 -0700 (PDT)")

> 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).





  reply	other threads:[~2013-07-02 22:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 18:17 bug#14742: 24.3.50; enhancement request: be able to prepend stuff from buffer when search backward Drew Adams
2013-06-28 21:43 ` Juri Linkov
2013-06-28 22:00   ` Drew Adams
2013-06-29 21:50     ` Juri Linkov
2013-06-29 23:02       ` Drew Adams
2013-07-02 22:39         ` Juri Linkov [this message]
2013-07-02 23:42           ` Drew Adams
2013-07-02 23:53             ` Juri Linkov
2013-07-03  1:07               ` Drew Adams
2013-07-03  5:40                 ` Drew Adams
2013-07-03 22:57                   ` Juri Linkov
2013-07-04  0:17                     ` Drew Adams
2013-07-04 23:34                       ` Juri Linkov
2013-07-05 10:37                         ` Stefan Monnier
2013-07-05 22:28                           ` Juri Linkov
2013-07-05 22:59                             ` Stefan Monnier
2013-07-05 23:17                               ` Juri Linkov
2013-07-06  0:40                                 ` Stefan Monnier
2020-09-18 14:30                             ` Lars Ingebrigtsen
2020-09-18 16:11                               ` Drew Adams
2020-09-21 19:07                                 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y59ok18k.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=14742@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).