From: Robert Weiner <rswgnu@gmail.com>
To: npostavs@users.sourceforge.net
Cc: 24021@debbugs.gnu.org
Subject: bug#24021: FEATURE ADDITION: 25.0.94: goto-marker, jumps to a marker potentially in a different buffer
Date: Mon, 18 Jul 2016 22:05:33 -0400 [thread overview]
Message-ID: <46351974-097B-48D3-8A60-7881CA9A2553@gmail.com> (raw)
In-Reply-To: <87oa5ucx1a.fsf@users.sourceforge.net>
Thanks for the feedback. I will work on an update.
-- Bob
> On Jul 18, 2016, at 8:05 PM, npostavs@users.sourceforge.net wrote:
>>
>> (defun goto-marker (marker)
>> "Make MARKER's buffer and position current."
>> (interactive)
>
> The interactive spec doesn't match the parameter list. I'm not sure if
> it makes sense for this to be interactive (how would the user enter a
> marker?).
That interactive spec should not be in there.
>
>> (cond ((not (markerp marker))
>> (error "Invalid marker: %s" marker))
>> ((not (marker-buffer marker))
>> (error "Invalid marker buffer: %s" marker))
>
> I think these checks are redundant, you'll get the same errors when you
> call marker-buffer and set-buffer, below.
I will take a look.
>
>> (t (let* ((buffer (marker-buffer marker))
>> (position (marker-position marker)))
>> (set-buffer buffer)
>> (or (and (>= position (point-min))
>> (<= position (point-max)))
>> (if widen-automatically
>> (widen)
>> (error "Marker position is outside accessible part of buffer: %s" marker)))
>> (goto-char position)
>> (switch-to-buffer buffer)))))
>
> If this is just a "simple function" (not an interactive command), it
> shouldn't widen, or call switch-to-buffer.
But it does need to do these things to leave the selected buffer and point where the marker points. It only widens if the marker position is outside the restricted range. It can be wrapped in save-restriction and save-excursion for times when it is used for temporary effect, e.g. to find the column of the marker position.
Bob
next prev parent reply other threads:[~2016-07-19 2:05 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 [this message]
2016-07-19 2:20 ` Noam Postavsky
2016-07-19 13:15 ` Robert Weiner
2016-07-20 1:55 ` npostavs
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46351974-097B-48D3-8A60-7881CA9A2553@gmail.com \
--to=rswgnu@gmail.com \
--cc=24021@debbugs.gnu.org \
--cc=npostavs@users.sourceforge.net \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.