emacs-devel
[Top][All Lists]
Advanced

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

pop-tag-mark - shouldn't it use pop-to-buffer instead of switch-to-buffe


From: Drew Adams
Subject: pop-tag-mark - shouldn't it use pop-to-buffer instead of switch-to-buffer?
Date: Tue, 12 Feb 2008 23:18:02 -0800

>From another thread:

> From: Stefan Monnier Sent: Thursday, December 20, 2007 4:43 PM
> Subject: Re: error "Cannot switch buffers in (minibuffer | a 
> dedicated) window"
> 
> > Am I missing something, or is this a gratuitous error that just gets
> > in the way?
> 
> It's just a way to say "please get all authors to stop using
> switch-to-buffer from their elisp package and replace them 
> with calls to pop-to-buffer".

A propos, shouldn't `pop-tag-mark' use `pop-to-buffer' here, instead of
`switch-to-buffer'? Otherwise, if you already have a window/frame open to
the marker's buffer, it doesn't reuse it.

(defun pop-tag-mark ()
  "Pop back to where \\[find-tag] was last invoked.

This is distinct from invoking \\[find-tag] with a negative argument
since that pops a stack of markers at which tags were found, not from
where they were found."
  (interactive)
  (if (ring-empty-p find-tag-marker-ring)
      (error "No previous locations for find-tag invocation"))
  (let ((marker (ring-remove find-tag-marker-ring 0)))
    (switch-to-buffer (or (marker-buffer marker)
                          (error "The marked buffer has been deleted")))
    (goto-char (marker-position marker))
    (set-marker marker nil nil)))





reply via email to

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