[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 8bef7b6 2/2: Only show "Back" when the marker stack
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] master 8bef7b6 2/2: Only show "Back" when the marker stack is non-empty |
Date: |
Sat, 03 Jan 2015 21:31:01 +0000 |
branch: master
commit 8bef7b6ad1775124eeed81acf46551c0fc3aa75e
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
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.
---
lisp/ChangeLog | 6 ++++++
lisp/menu-bar.el | 1 +
lisp/progmodes/xref.el | 4 ++++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 34e22af..49640f8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
2015-01-03 Dmitry Gutov <address@hidden>
+ * progmodes/xref.el (xref-marker-stack-empty-p): New function.
+
+ * menu-bar.el (menu-bar-goto-menu): Use it.
+
+2015-01-03 Dmitry Gutov <address@hidden>
+
* progmodes/xref.el (xref--window-configuration): New variable.
(xref-show-location-at-point): New command.
(xref--restore-window-configuration): New function.
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 7d7e466..67cb327 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 cb331e1..7bc6500 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."