[Top][All Lists]

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

Re: isearch region or thing at point.

From: Ergus
Subject: Re: isearch region or thing at point.
Date: Wed, 1 May 2019 02:13:10 +0200
User-agent: NeoMutt/20180716

Hi all!:

I have 3 questions before sending all the changes I propose:

1) I provided both cases, a function isearch-forward-region and
isearch-yank-region. One can be bind to M-s something and the other to
M-something once in isearch-mode-map. So the user will be not forced to
move to exit isearch if he is already there.

But on the other hand with the yank one the other does not offer any
real advantage as C-s M-w is not shorter than M-s M-w, bust a bit
easier to type, but not to remember.

I would like M-s M-(y?w) for the first and M-(y?w) for the second... but
I still find those a bit inconsistent (and long). What do you suggest?

2) A more theoretical:

Why the region-extract-function is not a normal function?

Why {when|if|and|...}-let macros are in such a special file and most of
the code don't use them? What's the problem with them?

3) What do you think is the right behavior in case isearch-string is not

Suppose you marked a region and then type: C-s letter, the cursor will
move to letter, but the actual active region will be from mark->letter.

Because in that case the point has already moved from it's initial
position, so the region is not the same than when it started.

1) Should the command do nothing in that case?

2) Or it must yank what used to be the initial region??

3) Something else?


On Wed, May 01, 2019 at 12:33:12AM +0100, Basil L. Contovounesios wrote:
Ergus <address@hidden> writes:

On Tue, Apr 30, 2019 at 11:39:11PM +0100, Basil L. Contovounesios wrote:
Ergus <address@hidden> writes:

            (contiguous (= (length bounds) 1)) ;; Region is contiguous

Better to use the function region-noncontiguous-p.

I already had the bounds.. I didn't want to do the funcall again... but
I know it is probably not important.. I am just an obsessed.

The higher-level and more flexible region-extract-function will handle
this for you in any case.

            (region-string (and (= (count-lines region-beg region-end) 1)
                                 region-beg region-end)))

Why can't the region span multiple lines?  Better to use
region-extract-function for this, as it is more flexible.

I don't thing that searching multiple lines will be very useful in
practice and could potentially produce some corner cases. But I
will think about that a bit more.

AFAIK, isearch is designed to work perfectly fine with multiple lines,
and I use this feature a lot, especially in the context of lax
whitespace matches in Info manuals, for example.

Providing a dedicated region isearch command which is limited to a
single line sounds hardly better than using isearch-yank-word-or-char or

        (isearch-yank-string region-string)

        (when-let (count (and arg (prefix-numeric-value arg)))
          (isearch-repeat-forward count)))

This can be simplified as per Noam's suggestion.
Yes, sorry, I was concerned if somehow the prefix could be non-nil, but
(prefix-numeric-value arg) could return nil... I don't really know the
fancy valued that prefix could potentially have. But probably there is
not any danger there.

All potential prefix values are listed under (info "(elisp) Prefix
Command Arguments"), and prefix-numeric-value is guaranteed to return an



reply via email to

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