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.
This commit is contained in:
Dmitry Gutov 2015-01-03 16:02:04 +02:00
parent 5496236583
commit 8bef7b6ad1
3 changed files with 11 additions and 0 deletions

View 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.

View file

@ -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]

View 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))
(defun xref--goto-location (location)
"Set buffer and point according to xref-location LOCATION."