emacs-devel
[Top][All Lists]
Advanced

[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: Sun, 25 Aug 2019 18:14:50 -0700 (PDT)

> > Commands like `isearch-yank-until-char',
> > which yank consecutive buffer text at the
> > search point, are better if they can also
> > work with backward search.
> 
> Backward yanking is a separate feature unrelated
> to isearch-yank-until-char.

It's not unrelated.  That's a new command.  And
it's essentially broken for yanking when searching
backward.

> Moreover, in my opinion backward yanking is too
> awkward,

That opinion is too vague.  Unless you care to be
specific about what it is that you find awkward.

E.g., a recipe, and possibly an alternative, less
awkward, behavior that you propose for yanking
when searching backward, with an explanation for
why you find it less awkward.

Yanking text that's at the search point should be
possible regardless of the direction of search.
Why shouldn't it be?

> and should not be enabled by default.

That can be discussed.  But your opinion that
it's somehow vaguely awkward isn't a good
reason, without elaboration.

In addition, currently if you try to yank
buffer text (e.g. `C-w' and kin) while
searching backward the behavior is bizarre,
not to mention awkward.

The text yanked isn't even at the search
point.  It can be far away.  Yet your eye is
focused on the search point and the buffer
text in "front" of it (in the backward
direction).

And there's little, perhaps no, use case for
doing that, which likely prompted you to ask
if I do it often (no).  It's not something
very useful or that would likely occur to
someone.  Put simply, it's wrong behavior.

If you were to be faithful to your argument
that yanking while searching backward makes
little sense and is awkward, then you would
remove that possibility right now - make `C-w'
and kin do nothing when searching backward.
If you really want to remove such behavior for
the default case because you find it awkward,
then that's the place to start.

Nothing is lost, and a lot is gained
(including consistency), by correcting the
current yank-some-text-at-search-point
behavior for backward search, making it
parallel to the behavior for forward search.

You call that enabling something new, but it's
really fixing bad behavior that already exists.

The fact that users have long ago learned to
avoid that bad behavior, and thus never yank
buffer text when searching backward, is an
argument for fixing it, giving them the same
useful behavior they have for forward search.

`isearch-yank-until-char' is new.  It need not
ever have such bad (at best useless) behavior.

You said:

  What I also like about isearch-yank-until-char
  is that an easy way to yank until the end of
  the line with just `C-M-c C-j' is a replacement
  of isearch-yank-line.

The same is true for yanking until the
beginning of the line when searching backward.
Exact same key sequence (but the key should
not be `C-M-c' - see my argument about that).

Not that that's a big win.  `isearch-yank-line'
also works both in directions with my patch.
And that's just as easy as using `C-j' with
`isearch-yank-until-char'.

I've attached an updated patch, which fixes two
bugs in the previous patch I sent, one each in
`isearch-yank-internal' and
`isearch-yank-until-char'.  I do hope you try it.

I've also attached the result of patching, for
anyone who wants to try it and doesn't want to
bother downloading the Emacs 27 source file to
patch (from 2019-08-19, when I grabbed it).

Attachment: isearch-2019-08-19e.patch
Description: Binary data

Attachment: isearch-2019-08-19e-PATCH.el
Description: Binary data


reply via email to

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