]> code.delx.au - gnu-emacs/commitdiff
Hide "Set Tags File Name" and the separator when tags are not used
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 30 Dec 2014 03:18:48 +0000 (05:18 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 30 Dec 2014 03:18:48 +0000 (05:18 +0200)
* lisp/menu-bar.el (menu-bar-goto-uses-etags-p): New function.
(menu-bar-goto-menu): Use it to show or hide the `set-tags-name'
and `separator-tag-file' items.

lisp/ChangeLog
lisp/menu-bar.el

index 5ad67ab4cd7cb5625180c1ce239d948152e4790b..6249a3084bb1b7eb9846cf1ec0bab5df2c33b97a 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-30  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * menu-bar.el (menu-bar-goto-uses-etags-p): New function.
+       (menu-bar-goto-menu): Use it to show or hide the `set-tags-name'
+       and `separator-tag-file' items.
+
 2014-12-29  Paul Eggert  <eggert@cs.ucla.edu>
 
        * obsolete/pc-select.el (pc-selection-mode): Use system-type.
index c5f587eb719fb709adf63a3ec3ab633a86138700..ea5794dfd0bc763a8989b65db9405985138e2ddf 100644 (file)
 
     (bindings--define-key menu [set-tags-name]
       '(menu-item "Set Tags File Name..." visit-tags-table
-                  :help "Tell Tags commands which tag table file to use"))
+                  :visible (menu-bar-goto-uses-etags-p)
+                  :help "Tell navigation commands which tag table file to use"))
 
     (bindings--define-key menu [separator-tag-file]
-      menu-bar-separator)
+      '(menu-item "--" nil :visible (menu-bar-goto-uses-etags-p)))
 
     (bindings--define-key menu [xref-pop]
-      '(menu-item "Back..." xref-pop-marker-stack
+      '(menu-item "Back" xref-pop-marker-stack
                   :help "Back to the position of the last search"))
 
     (bindings--define-key menu [xref-apropos]
                   :help "Read a line number and go to that line"))
     menu))
 
+(defun menu-bar-goto-uses-etags-p ()
+  (or (not (boundp 'xref-find-function))
+      (eq xref-find-function 'etags-xref-find)))
 
 (defvar yank-menu (cons (purecopy "Select Yank") nil))
 (fset 'yank-menu (cons 'keymap yank-menu))