From: npostavs@users.sourceforge.net
To: Robert Weiner <rsw@gnu.org>
Cc: rswgnu@gmail.com, 24021@debbugs.gnu.org
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 [thread overview]
Message-ID: <87fur5cbu5.fsf@users.sourceforge.net> (raw)
In-Reply-To: <CA+OMD9gETavHsLaoQ2s=P=f280VhM6+CoUv2Bm+v4FjD4ETAqg@mail.gmail.com> (Robert Weiner's message of "Tue, 19 Jul 2016 09:15:49 -0400")
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.
next prev parent reply other threads:[~2016-07-20 1:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-18 16:23 bug#24021: FEATURE ADDITION: 25.0.94: goto-marker, jumps to a marker potentially in a different buffer Robert Weiner
2016-07-19 0:05 ` npostavs
2016-07-19 2:05 ` Robert Weiner
2016-07-19 2:20 ` Noam Postavsky
2016-07-19 13:15 ` Robert Weiner
2016-07-20 1:55 ` npostavs [this message]
2021-12-01 19:49 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fur5cbu5.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=24021@debbugs.gnu.org \
--cc=rsw@gnu.org \
--cc=rswgnu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).