From: Dmitry Gutov Date: Sat, 3 Jan 2015 14:02:04 +0000 (+0200) Subject: Only show "Back" when the marker stack is non-empty X-Git-Tag: emacs-25.0.90~2611^2~12 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8bef7b6ad1775124eeed81acf46551c0fc3aa75e;p=emacs.git Only show "Back" when the marker stack is non-empty * lisp/menu-bar.el (menu-bar-goto-menu): Use it. * lisp/progmodes/xref.el (xref-marker-stack-empty-p): New function. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 34e22af92a9..49640f89055 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2015-01-03 Dmitry Gutov + + * progmodes/xref.el (xref-marker-stack-empty-p): New function. + + * menu-bar.el (menu-bar-goto-menu): Use it. + 2015-01-03 Dmitry Gutov * progmodes/xref.el (xref--window-configuration): New variable. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 7d7e4660fb5..67cb3273d23 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -381,6 +381,7 @@ (bindings--define-key menu [xref-pop] '(menu-item "Back" xref-pop-marker-stack + :visible (not (xref-marker-stack-empty-p)) :help "Back to the position of the last search")) (bindings--define-key menu [xref-apropos] diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index cb331e1c833..7bc6500a8de 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -301,6 +301,10 @@ backward." (let ((marker (ring-remove ring))) (set-marker marker nil nil))))) +(defun xref-marker-stack-empty-p () + "Return t if the marker stack is empty; nil otherwise." + (ring-empty-p xref--marker-ring)) + (defun xref--goto-location (location) "Set buffer and point according to xref-location LOCATION."