[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: PATCH: isearch-yank-until-char

From: Drew Adams
Subject: RE: PATCH: isearch-yank-until-char
Date: Tue, 27 Aug 2019 15:52:23 -0700 (PDT)

> >> `M-.' and `C-M-.' are good keys for pulling text
> >> into the minibuffer, as well as into a search string,
> >> so let's reserve them for the text pulling feature.
> >
> > OK.  (But we already have multiple text-pulling
> > keys for Isearch.)
> One of its first usages would be to bind `M-s M-.' to a command
> that turns the active region into the search string.

OK by me.  FWIW, that doesn't interfere with
any keys I have in `isearch-mode-map'.

(But `M-s M-.' is not `C-M-.' or `M-.'.)

>   (defun skip-to-char (arg char)
>     (interactive "^p\ncSkip to char: ")
>     (search-forward (char-to-string char) nil nil arg)
>     (forward-char -1))
>   (define-key esc-map "\C-z" 'skip-to-char)
> Then `C-SPC C-M-z ) M-s M-.' would be another way
> to yank until next char.

Looks useful, sounds good.

Oops, but no.  Now I see that you didn't mean
`M-s M-.' during Isearch.  You meant `M-s- M-.'
_globally_, to _start_ Isearch with a certain
search string.

When you said "a command that turns the active
region into the search string" I thought you
meant during search.

Personally, I'm not in favor of binding more
and more keys globally, to start particular
Isearches.  Global keys are rare these days.

I prefer to use the usual keys to start Isearch,
and then hit a key to make it a particular kind
of Isearch - in this case, to use the region
text as the search string (or maybe to append
it to the search string).

E.g., though I don't suggest we sacrifice the
global keys `C-M-s' and `C-M-r', nowadays we
_can_ just use `C-s M-r' to get regexp search
(a particular kind of Isearch), without needing
global keys just for that.

In this case, I'd sooner see `M-s M-.' be bound
in the Isearch map to a command that appends the
region text to the search string (or if you
prefer, replaces it).  That gives you what you
expected when starting Isearch.

IOW, `C-SPC C-M-z )' to activate the region up
to the `)' char, then `C-s M-s M-.' to use the
region as the search string.  IOW, just use
`C-s' (or `C-r' or `C-M-s' or `C-M-r') to start
searching; don't sacrifice yet another global
key for that.


[Personally, I'll have to bind `skip-to-char'
to a different key, because I bind `C-M-z'
to `thumfr-really-iconify-or-deiconify-frame'.

But that's OK.

I have a bunch of keys that end in `z', which
I use for things similar to the default `C-z'
binding of `suspend-frame' (aka

As is often the case in Emacs, a single key
(in this case `z') has more than one standard

The frame-suspension meaning of `C-z' and
`C-x C-z' is just as old as the `zap-to-char'
meaning of `M-z' (at least checking back to
Emacs 20).  It's 6 of one, half a dozen of
the other.  I iconify (thumbify) much more
than I zap-to-char, so that association is
stronger in my head.]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]