help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: killing the result of isearch


From: Tomas Nordin
Subject: Re: killing the result of isearch
Date: Thu, 09 Nov 2017 22:38:01 +0100

Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:

>> On Nov 9, 2017, at 7:24, Tomas Nordin <tomasn@posteo.net> wrote:
>> 
>> Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:
>> 
>>> No, I am actually talking about expectations from using emacs where regions 
>>> are highlighted, like what isearch seems like doing. What I am seeing is 
>>> what looks like a region (and except for the active match, all the others 
>>> are highlighted exactly as a region would be), but it doesn't act like a 
>>> region. So there is a UI promise that's broken.
>> 
>> Does this imply that in a read-only buffer, there must be no highlighting of 
>> the match for you not to say the UI is broken?
>
> Read my text again, and read your question one more time. You probably have 
> the answer you need by now.
>
>> You cannot act on the text there.
>
> I can certainly M-w on any region I like. A region is a region, regardless of 
> the buffer state, afaiu.

Ok, in a couple of posts it looked like the lack of possibility to just
delete the thing highlighted was the main distraction. I also got the
impression it is the subject of the thread.

>
>> Or, in a read-only buffer, is it good that the match(es) are highlighted? 
>> Why?
>
> I may be thick, but it does look like you're trying to make me look like a 
> fool, when it is you who do not seem to properly understand the issue I'm 
> talking about.

I don't want to upset anyone, and I didn't have that intention. My
wording was maybe unnecessarily short.

I was trying to suggest that a highlight might have other meanings than
that it will be altered by next insertion or deletion.

Anyway, I think I was reacting on the UI promise wording. I don't know
there is such promise. There are expectations of course, based on
peoples habits and prior experience. I agree that in most other
applications, a highlighted region will get replaced by the next
character you insert, or deleted if that is the action.

When I started out with Emacs, I already knew that almost everything is
different from what I was used to. So, for example, visit a file is not
done by "ctrl-O" or a search is not started with "ctrl-f". Things like
that. So many things are different so I never even reflected over that
the region is not replaced just by hitting a character.

About the incremental search thing. I agree that it *could* be useful
maybe to add an in-search command like

      Type C-l to toggle isearch-lock-string.
       The current search string is frozen and next self-insert-command
       or DEL will operate in the current buffer. C-l again from this
       state will revert to normal isearch. In this mode you can hit C-s
       again to get at the next mach.

But then again, I don't know it would save so many key-strokes. If I want
to search and delete, I find it rather fast anyway to just hit C-s again
two times to get to the next match.

I was curious on the expectations based on other editors, so I tried
this at work with notepad++. The first thing tried was a ctrl-f for the
search. That brings up a dialog for the search and it was not possible
to just delete the thing found. I checked a little and it turned out
that pressing <f3> (after a search and dialog closed) would "select"
next match (the first was already consumed by the dialog search) and
move point to the end of it. And then, yes, possible to act directly on
that selection, like delete for example.

However, this required that one first do a regular search (ctrl-f),
escape that dialog and then start to press <f3>.

Its one of the many things that is different in Emacs to other editors
but then I think that other editors differ to each-other as well, and
each promise their own things. But I don't agree that Emacs is braking a
UI promise. But for sure it will have a different method for doing
things compared to some other editor.

I think one exciting thing with Emacs has been the practice that you
never have to use the mouse for anything (if you don't want to). I could
guess that many commands are not even possible to do via the mouse. Then
one could maybe claim that since Emacs often is used a a GUI, its
braking a promise because the mouse cannot be used for this or that
command. But then I wouldn't agree.

As you say, editing in Emacs is done by the lisp interpreter, so almost
any wish for a behavior can be satisfied by some snippets of code, often
provided by the very kind and helpful Emacs help list. Or, if enough
developers agree on a new feature it will even be added into stock
Emacs. To that note by the way, I evaled the code snippets posted by
Stefan and said `M-x delete-selection-mode`, and after that I got a
behavior exactly as I understand you are looking for. Just don't forget
to hit RET before acting on that region. That post also give some
reasons for the current behavior. I am reading my mail in Emacs so that
behavior slided smoothly into my Emacs just as if it would have been a
feature available through an item in a menu.

--
Tomas



reply via email to

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