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

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

bug#24021: FEATURE ADDITION: 25.0.94: goto-marker, jumps to a marker pot


From: npostavs
Subject: bug#24021: FEATURE ADDITION: 25.0.94: goto-marker, jumps to a marker potentially in a different buffer
Date: Tue, 19 Jul 2016 21:55:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux)

Robert Weiner <rsw@gnu.org> writes:

>
> I like these checks as they make the specific error very
> clear. set-buffer will trigger a type error when given a nil buffer
> but neither marker-buffer nor marker-position signal an error when
> given a marker that doesn't point anywhere, so the checks prior to
> calling those functions are relevant.

Fair enough, I would suggest using (unless ... (error ...)) to avoid
having the error checking add nesting depth to the main code.

>>
>> If this is just a "simple function" (not an interactive command), it
>> shouldn't widen, or call switch-to-buffer.
>>
>> 
>>
>> save-excursion or save-current-buffer don't counteract
>> switch-to-buffer, because it affects the UI selected buffer.
>
> You are right that save-excursion and save-restriction won't
> counteract the effects of this function, so its purpose must be to put
> the selected window's point at the location of the marker. Possibly, a
> macro called with-marker-location could be useful when one needs to
> temporarily set buffer and point from a marker and evaluate some forms
> but not affect the display.

It really just makes more sense to let the caller do (switch-to-buffer
(current-buffer)) if needed.  Or display-buffer, or pop-to-buffer.  Not
hard coding the switch-to-buffer call makes the function more flexible
and usable in more situations.





reply via email to

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