emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Handle case where `beg` and `end` are strings instead of mar


From: Stefan Monnier
Subject: Re: [PATCH] Handle case where `beg` and `end` are strings instead of markers
Date: Fri, 29 Apr 2022 17:05:11 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>> +  (let ((beg (if (number-or-marker-p beg)
>> +                 beg
>> +               (save-excursion
>> +                 (goto-char (minibuffer-prompt-end))
>> +                 (search-forward beg))))
>> +        (end (if (number-or-marker-p end)
>> +                 end
>> +               (save-excursion
>> +                 (goto-char (point-max))
>> +                 (search-backward end)))))
>
> What if there are several matches for `beg` and/or for `end` in
> the buffer?  How do we know we got the intended one?

IIUC part of the purpose of using strings rather than positions is to
account for the case where the text was modified between the moment the
*Completions* list was created and the moment the user selects one of
the options.  So another question is what to do if the search fails (the
above code signals an error in that case, which is probably not what we
want).


        Stefan




reply via email to

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