unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
Cc: Alan Mackenzie <acm@muc.de>,
	Augusto Stoffel <arstoffel@gmail.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: [WIP PATCH] Controlling Isearch from the minibuffer
Date: Wed, 12 May 2021 23:07:55 +0000	[thread overview]
Message-ID: <SA2PR10MB4474FD4D6B268832D4DCCFBCF3529@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87lf8jppfi.fsf@gmail.com>

> While isearching, I regularly find myself reaching for regular
> navigation/editing commands (C-a, C-b, M-b, M-DEL… even C-x o, on
> occasion), 

You "regularly" want to move within the search-pattern,
to do some editing of it besides at the end.  Is that it?

But in that case, what about `C-x o'?

> and tripping out of isearch.  

You don't want to end Isearch when you move to another
window?  Is it because you don't want to have to hit
`C-s' again, after `C-x o'?  Or do you regularly want
to both switch windows and edit the search string,
without hitting `C-s'?

> This thread made me discover M-e,

Really?  In that case, I suggest you first try using
that to do your editing, before asking that Isearch
be rewritten to be minibuffer-based.  It's really not
a big deal to use `M-e', IMO.

> but I doubt I'll use it much, since it takes the
> "i" out of "isearch".

I don't think so.  If you're using `M-b' and such to
get to the middle of the search pattern you're already
taking the "i" out of "isearch" to a degree.

`M-e M-b X C-s' is not a lot different from `M-b X',
and how often is this need "regularly" felt?

Anyway, I do sympathize with the need/desire to
sometimes want to directly go to the middle of the
pattern somewhere and insert or delete something
there.

Which is why I added an option to do that - but without
making Isearch depend on the minibuffer all the time.
Have Isearch use the minibuffer only for editing the
search pattern, as it does now, but obviate having to
hit `M-e' to do so, for certain movement etc. keys.

How would you feel about what I described as existing
in isearch+.el:

Customize `isearchp-initiate-edit-commands' to include
`beginning-of-line' (`C-a'), `backward-kill-word'
(`M-DEL'),...?

It already includes `C-b', `M-b', `C-M-b', `<left>',
C-<left>', and `M-<left>'.  Your wish is half granted,
even by default.

These are all prepared for possible inclusion, but are
commented out in the code - just to give folks an idea:

;; backward-delete-char                ; `DEL'
;; backward-delete-char-untabify       ; `DEL'
;; backward-kill-paragraph             ; `C-backspace'
;; backward-kill-sentence              ; `C-x DEL'
;; backward-kill-sexp                  ; `C-M-backspace'
;; backward-kill-word                  ; `M-DEL'
;; backward-list                       ; `C-M-p'
;; backward-page                       ; `C-x ['
;; backward-paragraph                  ; `C-up', `M-{'
;; backward-sentence                   ; `M-a'
;; backward-to-indentation             ; Not bound by default
;; backward-up-list                    ; `C-M-u', `C-M-up'
;; delete-backward-char
;; kill-backward-up-list               ; Not bound by default
;; beginning-of-buffer                 ; `M-<', `C-home'
;; beginning-of-defun                  ; `C-M-a', `C-M-home',
;; beginning-of-line                   ; `C-a', `home'
;; beginning-of-line-text              ; Not bound by default
;; beginning-of-visual-line            ; `C-a', `home'

(For most search patterns some of those likely wouldn't
be very useful - e.g., `backward-page'.  But if they're
not useful here then they're surely not useful in the
even more general case where all of Isearch would use
the minibuffer!)

With any such keys included, hitting the key does what
`M-e' does, but it also does what the command does.

E.g., `C-a' puts point at the beginning of the line in
the minibuffer (as `M-e C-a' would today).  Just insert
some text there, then hit `C-s' to continue with the
edited search pattern.

Like `M-e', this still uses the minibuffer only for
search-pattern editing.  And it lets users still use
other keys during Isearch that are specific to Isearch,
including using keys to exit Isearch.  (It's important
to some people to be able to exit using a bunch of keys
apparently.)  Isearch+ binds lots more keys during
Isearch - for things controlling search behavior (other
than just the search pattern).

Note that you can include any command.  But what
commands does it really make most sense to include?
Answer, I think: commands that move point _backward_
in the search pattern, possibly deleting some text
before or after movement (i.e. from the end or from
the new position).

Why?  Because the regular Isearch behavior of having
`DEL' delete chars from the end is _good_ - that's
what most pattern "editing" is about, in practice.

Being able to delete more than a char from the end
can sometimes be handy - e.g. delete a sexp.  Likewise,
moving backward various amounts, to insert or delete
some text from the middle or the beginning of the
pattern.

But _general_ minibuffer keys?  I don't think so.
(I really don't, as much as I practically live in the
minibuffer.)

Sure, even `C-x o' could be useful.  But in that case
do you want to continue searching with the same
pattern in the other window?  If so, even today that's
just `C-x o' then `C-s'.  Or do you want to, at the
same time, make some pattern edit?  The use case isn't
clear, to me.

Think about it.  Is this really pretty much only about
editing the search pattern?  If so, then I see no good
reason to reimplement Isearch based on the minibuffer.

What's needed for that is much less.  In that case, it
sounds like the only complaint is that some find the
need to hit `M-e' annoying.  Or it's something they're
not used to (perhaps, like you, they've just found out
about `M-e').  And to take care of that perceived
annoyance I propose what I mention above: implicit
`M-e' for certain keys.

Yes, to tell Emacs you're done editing the pattern in
a non-trivial way you need to hit `C-s'.  Worth it, IMO.

  reply	other threads:[~2021-05-12 23:07 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08 10:13 [WIP PATCH] Controlling Isearch from the minibuffer Augusto Stoffel
2021-05-09 13:36 ` Alan Mackenzie
2021-05-09 17:58   ` Augusto Stoffel
2021-05-10 19:51     ` Alan Mackenzie
2021-05-11  9:00       ` Augusto Stoffel
2021-05-11 15:34         ` [External] : " Drew Adams
2021-05-11 18:31           ` Juri Linkov
2021-05-11 19:38             ` Drew Adams
2021-05-12  6:45           ` Augusto Stoffel
2021-05-12 12:44             ` Stefan Monnier
2021-05-12 15:31               ` Drew Adams
2021-05-12 22:17                 ` Kévin Le Gouguec
2021-05-12 23:07                   ` Drew Adams [this message]
2021-05-13 15:12                     ` Kévin Le Gouguec
2021-05-12 21:09               ` Augusto Stoffel
2021-05-12 15:30             ` Drew Adams
2021-05-09 19:09   ` Juri Linkov
2021-05-09 19:05 ` Juri Linkov
2021-05-10 20:24   ` Augusto Stoffel
2021-05-10 21:17     ` Juri Linkov
2021-05-12  6:40       ` Augusto Stoffel
2021-05-12 17:13         ` Juri Linkov
2021-05-12 20:52           ` Augusto Stoffel
2021-05-13 16:31             ` Juri Linkov
2021-05-13 20:12               ` [ELPA?] " Augusto Stoffel
2021-05-14  1:17                 ` Jean Louis
2021-05-14  8:36                   ` Augusto Stoffel
2021-05-14 17:30                 ` Augusto Stoffel
2021-05-14 18:20                   ` Juri Linkov
2021-05-16 11:00                     ` Augusto Stoffel
2021-05-16 18:19                       ` Juri Linkov
2021-05-25 20:50                         ` Juri Linkov
2021-05-29 11:48                           ` Augusto Stoffel
2021-05-14 18:18                 ` Juri Linkov
2021-05-16 18:12                   ` Juri Linkov
2021-05-16 18:49                     ` Augusto Stoffel
2021-05-21  9:09                       ` Augusto Stoffel
2021-05-21 10:25                         ` Eli Zaretskii
2021-05-21 11:56                           ` Augusto Stoffel
2021-05-21 12:31                             ` Eli Zaretskii
2021-05-21 12:49                               ` Augusto Stoffel
2021-05-21 15:05                               ` Stefan Monnier
2021-05-21 15:09                                 ` Eli Zaretskii

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=SA2PR10MB4474FD4D6B268832D4DCCFBCF3529@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=acm@muc.de \
    --cc=arstoffel@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=kevin.legouguec@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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).