GNU bug report logs - #24021
FEATURE ADDITION: 25.0.94: goto-marker, jumps to a marker potentially in a different buffer

Previous Next

Package: emacs;

Reported by: rswgnu <at> gmail.com

Date: Mon, 18 Jul 2016 16:24:02 UTC

Severity: wishlist

Tags: wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Robert Weiner <rsw <at> gnu.org>
To: 24021 <at> 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
[Message part 1 (text/plain, inline)]
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)))))
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 167 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.