emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole c2bf47c15b 068/143: xref is used by etags sin


From: ELPA Syncer
Subject: [elpa] externals/hyperbole c2bf47c15b 068/143: xref is used by etags since 26.1 so use it unconditionally (#432)
Date: Mon, 19 Feb 2024 15:59:03 -0500 (EST)

branch: externals/hyperbole
commit c2bf47c15b913b51ddf03991f05e1fca73dd115c
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: GitHub <noreply@github.com>

    xref is used by etags since 26.1 so use it unconditionally (#432)
---
 hmouse-tag.el | 63 +++++++++++++++++++++++++----------------------------------
 1 file changed, 27 insertions(+), 36 deletions(-)

diff --git a/hmouse-tag.el b/hmouse-tag.el
index 00c54cc6bf..de1d0644ab 100644
--- a/hmouse-tag.el
+++ b/hmouse-tag.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    24-Aug-91
-;; Last-Mod:      5-Jan-24 at 14:02:46 by Bob Weiner
+;; Last-Mod:      5-Jan-24 at 23:01:12 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -27,35 +27,32 @@
     ;; command.
     (load "etags.elc" t nil t)))
 
-;; If etags utilizes the new xref.el library, define some helper
-;; functions to simplify programming and fix one existing function.
-(when (require 'xref nil t)
-  ;; Fix next xref function to handle when called at beginning of buffer
-  (defun xref--item-at-point ()
-    (get-text-property
-     (max (point-min) (if (eolp) (1- (point)) (point)))
-     'xref-item))
-  (when (not (fboundp 'xref-definition))
-    (defun xref-definitions (identifier)
-      "Return a list of all definitions of string IDENTIFIER."
-      (let* ((elisp-flag (smart-emacs-lisp-mode-p))
-            (xref-backend (or (and elisp-flag
-                                   (fboundp 'ert-test-boundp)
-                                   (ert-test-boundp identifier)
-                                   (boundp 'xref-etags-mode)
-                                   'etags)
-                              (xref-find-backend)))
-            (xref-items (xref-backend-definitions xref-backend identifier)))
-       xref-items))
-    (defun xref-definition (identifier)
-      "Return the first definition of string IDENTIFIER."
-      (car (xref-definitions identifier)))
-    (defun xref-item-buffer (item)
-      "Return the buffer in which xref ITEM is defined."
-      (marker-buffer (save-excursion (xref-location-marker (xref-item-location 
item)))))
-    (defun xref-item-position (item)
-      "Return the buffer position where xref ITEM is defined."
-      (marker-position (save-excursion (xref-location-marker 
(xref-item-location item)))))))
+(require 'xref)
+;; Fix next xref function to handle when called at beginning of buffer
+(defun xref--item-at-point ()
+  (get-text-property
+   (max (point-min) (if (eolp) (1- (point)) (point)))
+   'xref-item))
+(defun xref-definitions (identifier)
+  "Return a list of all definitions of string IDENTIFIER."
+  (let* ((elisp-flag (smart-emacs-lisp-mode-p))
+        (xref-backend (or (and elisp-flag
+                               (fboundp 'ert-test-boundp)
+                               (ert-test-boundp identifier)
+                               (boundp 'xref-etags-mode)
+                               'etags)
+                          (xref-find-backend)))
+        (xref-items (xref-backend-definitions xref-backend identifier)))
+    xref-items))
+(defun xref-definition (identifier)
+  "Return the first definition of string IDENTIFIER."
+  (car (xref-definitions identifier)))
+(defun xref-item-buffer (item)
+  "Return the buffer in which xref ITEM is defined."
+  (marker-buffer (save-excursion (xref-location-marker (xref-item-location 
item)))))
+(defun xref-item-position (item)
+  "Return the buffer position where xref ITEM is defined."
+  (marker-position (save-excursion (xref-location-marker (xref-item-location 
item)))))
 
 ;;; ************************************************************************
 ;;; Public declarations
@@ -90,12 +87,6 @@
 (declare-function org-in-src-block-p "org")
 (declare-function ibtype:def-symbol "hbut")
 
-;; Forward declare needed? Because of optional defined above? Can we
-;; skip checking if xref is available since it has been at least since
-;; 26.1 or even earlier? Then we should not need these declares.
-(declare-function xref-item-position "hmouse-tag")
-(declare-function xref-item-buffer "hmouse-tag")
-
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************



reply via email to

[Prev in Thread] Current Thread [Next in Thread]