unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
Subject: Re: isearch-yank-char
Date: 30 Apr 2004 19:12:26 +0900	[thread overview]
Message-ID: <87ad0tojud.fsf@tc-1-100.kawasaki.gol.ne.jp> (raw)
In-Reply-To: Pine.LNX.3.96.1040430081120.566B-100000@acm.acm

Alan Mackenzie <acm@muc.de> writes:
> >   2. Bind C-b in isearch-mode to a function (name TBD) that loses
> >      one char from the search string.
> 
> NOT SO FAST!  Tell me, where does point get left after a C-b?  Normally,
> one character backwards.  No problem.  But....
> 
> Where does point get left in a regexp-search after C-b?

An obvious implementation might be:  Act exactly like `M-e DEL RET'.

However that's no good because M-e _always_ moves forward, even if
the search string got shorter, and I think that would surprise many
people -- who will expect C-b to act sort of like DEL but without
removing large chunks like those added by C-w.

Another idea might be:

   (1) Save the current search-string ORIG-SEARCH-STRING, with
       length LEN.

   (2) Backtrack like DEL until the length of the search-string is
       <= LEN - 1 (if you had done a C-w, then that's probably right
       before you did it).

   (3) Now start searching forward (or backward, if C-r) again from
       the point you backed up to, for the first LEN - 1 characters
       of ORIG-SEARCH-STRING.

This makes the assumption that you're probably typing C-b because
the current search string is too long and doesn't match what you
want, and thus any search history that includes it should be
removed.

It reflects what many people probably already do manually when C-w
adds slightly too much text:  they hit DEL until the text added by
C-w is gone, and then retype all but the unwanted text character by
character.

Even when you don't use C-w, the above behavior is a convenient way
to skip back to the last point where you actually added search
text, without having to hit DEL a bunch of times to backtrack first
(I want to do this quite often).

-Miles
-- 
We are all lying in the gutter, but some of us are looking at the stars.
-Oscar Wilde

  parent reply	other threads:[~2004-04-30 10:12 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-26  4:42 isearch-yank-char Juri Linkov
2004-04-25 23:03 ` isearch-yank-char Karl Fogel
2004-04-25 23:17   ` isearch-yank-char Karl Fogel
2004-04-26  6:15   ` isearch-yank-char Juri Linkov
2004-04-26 14:10 ` isearch-yank-char Richard Stallman
2004-04-26 22:42 ` isearch-yank-char Stefan Monnier
2004-04-26 23:03   ` isearch-yank-char Miles Bader
2004-04-26 22:48     ` isearch-yank-char Karl Fogel
2004-04-27  8:09       ` isearch-yank-char Juri Linkov
2004-04-27  9:11         ` isearch-yank-char Juri Linkov
2004-04-27  9:41         ` isearch-yank-char David Kastrup
2004-04-27 22:49           ` isearch-yank-char Karl Fogel
2004-04-28  5:04           ` isearch-yank-char Juri Linkov
2004-04-29 22:08             ` isearch-yank-char Karl Fogel
2004-04-30  4:48               ` isearch-yank-char Juri Linkov
2004-04-29 22:53                 ` isearch-yank-char Karl Fogel
2004-04-30  8:27                   ` isearch-yank-char Juri Linkov
2004-04-30 11:23                     ` isearch-yank-char Romain Francoise
2004-04-30 13:47                     ` isearch-yank-char Karl Fogel
2004-04-30 20:55                       ` isearch-yank-char Juri Linkov
2004-04-30 17:34                         ` isearch-yank-char Karl Fogel
2004-05-01  0:15                           ` isearch-yank-char Juri Linkov
2004-04-30 18:57                             ` isearch-yank-char Karl Fogel
2004-05-01  1:04                               ` isearch-yank-char Juri Linkov
2004-05-01 20:02                                 ` isearch-yank-char Kim F. Storm
2004-05-02 11:32                                   ` isearch-yank-char Juri Linkov
2004-05-03 12:40                                 ` isearch-yank-char Robert J. Chassell
2004-05-02 11:19                               ` isearch-yank-char Richard Stallman
2004-05-03 19:24                                 ` isearch-yank-char Karl Fogel
2004-05-04 20:08                                   ` isearch-yank-char Richard Stallman
2004-04-30  8:31               ` isearch-yank-char Alan Mackenzie
2004-04-30  9:52                 ` isearch-yank-char Juri Linkov
2004-04-30 10:12                 ` Miles Bader [this message]
2004-04-30 13:58                 ` isearch-yank-char Karl Fogel
2004-04-27  9:36       ` isearch-yank-char Kim F. Storm
2004-04-28  5:02   ` isearch-yank-char 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=87ad0tojud.fsf@tc-1-100.kawasaki.gol.ne.jp \
    --to=miles@gnu.org \
    /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).