]> git.eshelyaron.com Git - emacs.git/commitdiff
Add xref operations to context menu unconditionally
authorMattias Engdegård <mattiase@acm.org>
Sat, 21 Aug 2021 08:59:54 +0000 (10:59 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sat, 21 Aug 2021 10:41:53 +0000 (12:41 +0200)
* lisp/progmodes/prog-mode.el (prog-context-menu):
Add xref operations to the context menu even if xref hasn't been
loaded yet; the functions involved are autoloaded (bug#50067).

lisp/progmodes/prog-mode.el

index a8b608b018a2ccbf621c77b64fda97df63fbb174..4f000d6613af42c29a4f7aafab32846bf48b07f1 100644 (file)
                                 prettify-symbols-mode))
 
 (defun prog-context-menu (menu)
-  (when (featurep 'xref)
-    (define-key-after menu [prog-separator] menu-bar-separator
-      'mark-whole-buffer)
-    (define-key-after menu [xref-find-def]
-      '(menu-item "Find Definition" xref-find-definitions-at-mouse
-                  :visible (save-excursion
-                             (mouse-set-point last-input-event)
-                             (xref-backend-identifier-at-point (xref-find-backend)))
-                  :help "Find definition of function or variable")
-      'prog-separator)
-    (define-key-after menu [xref-pop]
-      '(menu-item "Back Definition" xref-pop-marker-stack
-                  :visible (not (xref-marker-stack-empty-p))
-                  :help "Back to the position of the last search")
-      'xref-find-def))
+  (define-key-after menu [prog-separator] menu-bar-separator
+    'mark-whole-buffer)
+  (define-key-after menu [xref-find-def]
+    '(menu-item "Find Definition" xref-find-definitions-at-mouse
+                :visible (save-excursion
+                           (mouse-set-point last-input-event)
+                           (xref-backend-identifier-at-point
+                            (xref-find-backend)))
+                :help "Find definition of function or variable")
+    'prog-separator)
+  (define-key-after menu [xref-pop]
+    '(menu-item "Back Definition" xref-pop-marker-stack
+                :visible (not (xref-marker-stack-empty-p))
+                :help "Back to the position of the last search")
+    'xref-find-def)
   menu)
 
 (defvar prog-mode-map