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: Sun, 30 Jun 2013 00:50:36 +0300 [thread overview]
Message-ID: <87haggoc6r.fsf@mail.jurta.org> (raw)
In-Reply-To: <7518b30b-63d2-40ea-956f-a504f40c4cfd@default> (Drew Adams's message of "Fri, 28 Jun 2013 15:00:47 -0700 (PDT)")
>> and since then I have not had problems with it. So what could
>> be done is to move this code from `isearch-other-meta-char'
>> to `isearch-yank-string' and `isearch-del-char' for more
>> general functionality by adding a new argument `BACK' to them
>> (or could you propose a better name for the argument).
>
> I take your word for it wrt the implementation. After I see it,
> I might have a suggestion wrt the name (maybe BACKWARD, as that
> seems to be the term used in our search names).
It's easy to find a name for the new arg of `isearch-yank-string'.
By default, it appends a string to the end of the search string,
so a new arg for opposite meaning could have the name `prepend'
to prepend a string to the beginning of the search string.
But what could be a name for the new arg of `isearch-del-char'?
By default, it deletes a substring from the end of the search string.
And with a non-nil new arg it will delete a substring from the
beginning of the search string. What about the name `behead'
suggested in
http://english.stackexchange.com/questions/111382/what-are-the-antonyms-of-append-and-prepend
=== modified file 'lisp/isearch.el'
--- lisp/isearch.el 2013-06-13 22:08:45 +0000
+++ lisp/isearch.el 2013-06-29 21:50:03 +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 behead)
"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 behead
+ (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 prepend)
"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 prepend
+ (concat string isearch-string)
+ (concat isearch-string string))
isearch-message
(concat isearch-message
(mapconcat 'isearch-text-char-description
next prev parent reply other threads:[~2013-06-29 21:50 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 [this message]
2013-06-29 23:02 ` Drew Adams
2013-07-02 22:39 ` Juri Linkov
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=87haggoc6r.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).