]> code.delx.au - gnu-emacs/commitdiff
Only show "Back" when the marker stack is non-empty
authorDmitry Gutov <dgutov@yandex.ru>
Sat, 3 Jan 2015 14:02:04 +0000 (16:02 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 3 Jan 2015 21:10:36 +0000 (23:10 +0200)
* lisp/menu-bar.el (menu-bar-goto-menu): Use it.

* lisp/progmodes/xref.el (xref-marker-stack-empty-p): New function.

lisp/ChangeLog
lisp/menu-bar.el
lisp/progmodes/xref.el

index 34e22af92a94bb8d94ab3df3cbd7adc38b9ca45a..49640f8905525a090d1b836727254ac64c767a0c 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-03  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * progmodes/xref.el (xref-marker-stack-empty-p): New function.
+
+       * menu-bar.el (menu-bar-goto-menu): Use it.
+
 2015-01-03  Dmitry Gutov  <dgutov@yandex.ru>
 
        * progmodes/xref.el (xref--window-configuration): New variable.
index 7d7e4660fb55bac0332ff3c857d045c3e4f42a1a..67cb3273d23bba7f39a9f0c78a0a76f20c052868 100644 (file)
 
     (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]
index cb331e1c833a930209b7d5c28f461a7ada671715..7bc6500a8de14432c1cf01879af22e4deef3beab 100644 (file)
@@ -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))
+
 \f
 (defun xref--goto-location (location)
   "Set buffer and point according to xref-location LOCATION."