From: Robert Weiner <rsw@gnu.org>
To: 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 12:23:02 -0400 [thread overview]
Message-ID: <CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 983 bytes --]
Since goto-char signals an error when given a marker pointing to a buffer
other than the current one (probably to prevent programming errors) and
pop-global-mark only works on the global-mark-ring, there is a need for a
simple function that jumps to the location of an arbitrary marker. The
following function does that and is based on pop-global-mark. Please
consider adding it to simple.el.
Bob
(defun goto-marker (marker)
"Make MARKER's buffer and position current."
(interactive)
(cond ((not (markerp marker))
(error "Invalid marker: %s" marker))
((not (marker-buffer marker))
(error "Invalid marker buffer: %s" marker))
(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)))))
[-- Attachment #2: Type: text/html, Size: 3286 bytes --]
next reply other threads:[~2016-07-18 16:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-18 16:23 Robert Weiner [this message]
2016-07-19 0:05 ` bug#24021: FEATURE ADDITION: 25.0.94: goto-marker, jumps to a marker potentially in a different buffer 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
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='CA+OMD9j9-UtW-kkzk6MJjsPrgXiQNJE2ATYJ6=rh7FDu8Cx0OA@mail.gmail.com' \
--to=rsw@gnu.org \
--cc=24021@debbugs.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 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.