diff options
| author | Dmitry Gutov | 2015-01-03 16:02:04 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2015-01-03 23:10:36 +0200 |
| commit | 8bef7b6ad1775124eeed81acf46551c0fc3aa75e (patch) | |
| tree | 0c0fda633fef079a26221febf249c3ab1058c214 | |
| parent | 5496236583e22bce185650988a1ae675216e883e (diff) | |
| download | emacs-8bef7b6ad1775124eeed81acf46551c0fc3aa75e.tar.gz emacs-8bef7b6ad1775124eeed81acf46551c0fc3aa75e.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/menu-bar.el | 1 | ||||
| -rw-r--r-- | lisp/progmodes/xref.el | 4 |
3 files changed, 11 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 34e22af92a9..49640f89055 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2015-01-03 Dmitry Gutov <dgutov@yandex.ru> | 1 | 2015-01-03 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 2 | ||
| 3 | * progmodes/xref.el (xref-marker-stack-empty-p): New function. | ||
| 4 | |||
| 5 | * menu-bar.el (menu-bar-goto-menu): Use it. | ||
| 6 | |||
| 7 | 2015-01-03 Dmitry Gutov <dgutov@yandex.ru> | ||
| 8 | |||
| 3 | * progmodes/xref.el (xref--window-configuration): New variable. | 9 | * progmodes/xref.el (xref--window-configuration): New variable. |
| 4 | (xref-show-location-at-point): New command. | 10 | (xref-show-location-at-point): New command. |
| 5 | (xref--restore-window-configuration): New function. | 11 | (xref--restore-window-configuration): New function. |
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 @@ | |||
| 381 | 381 | ||
| 382 | (bindings--define-key menu [xref-pop] | 382 | (bindings--define-key menu [xref-pop] |
| 383 | '(menu-item "Back" xref-pop-marker-stack | 383 | '(menu-item "Back" xref-pop-marker-stack |
| 384 | :visible (not (xref-marker-stack-empty-p)) | ||
| 384 | :help "Back to the position of the last search")) | 385 | :help "Back to the position of the last search")) |
| 385 | 386 | ||
| 386 | (bindings--define-key menu [xref-apropos] | 387 | (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." | |||
| 301 | (let ((marker (ring-remove ring))) | 301 | (let ((marker (ring-remove ring))) |
| 302 | (set-marker marker nil nil))))) | 302 | (set-marker marker nil nil))))) |
| 303 | 303 | ||
| 304 | (defun xref-marker-stack-empty-p () | ||
| 305 | "Return t if the marker stack is empty; nil otherwise." | ||
| 306 | (ring-empty-p xref--marker-ring)) | ||
| 307 | |||
| 304 | 308 | ||
| 305 | (defun xref--goto-location (location) | 309 | (defun xref--goto-location (location) |
| 306 | "Set buffer and point according to xref-location LOCATION." | 310 | "Set buffer and point according to xref-location LOCATION." |