summaryrefslogtreecommitdiff
path: root/lisp/progmodes/etags.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2021-10-01 00:02:21 +0300
committerDmitry Gutov <dgutov@yandex.ru>2021-10-01 00:02:21 +0300
commit86da812afb2572c7fead2bb07570b976bffd7c55 (patch)
tree86af033eb09c8d524d8378f710c55734ee561625 /lisp/progmodes/etags.el
parent5c73dfcbcb12d107dfdad335328b7c258bdd64c8 (diff)
downloademacs-86da812afb2572c7fead2bb07570b976bffd7c55.tar.gz
Migrate Xref off EIEIO
To improve performance and flexibility (bug#50777). * lisp/progmodes/xref.el (xref-location): Remove. (xref-file-location): Change to cl-struct. (xref-buffer-location, xref-bogus-location): Ditto. (xref-item, xref-match-item): Same. And update all method definitions accordingly. (xref--insert-xrefs): Don't use 'oref', use 'xref-item-location'. (xref--insert-xrefs, xref-show-definitions-completing-read): Insetad of 'with-slots', use 'xref-item-summary' and 'xref-item-location'. * lisp/progmodes/etags.el (xref-etags-location): Change from EIEIO class into a cl-struct. (xref-etags-apropos-location): Ditto. Update all method definitions. * test/lisp/progmodes/elisp-mode-tests.el (xref-elisp-test-run): Avoid using 'oref'.
Diffstat (limited to 'lisp/progmodes/etags.el')
-rw-r--r--lisp/progmodes/etags.el37
1 files changed, 15 insertions, 22 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index e6af2b12c73..f53b09d9e8c 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2161,18 +2161,16 @@ file name, add `tag-partial-file-name-match-p' to the list value.")
(nreverse res))))
tags-apropos-additional-actions))
-(defclass xref-etags-location (xref-location)
- ((tag-info :type list :initarg :tag-info)
- (file :type string :initarg :file
- :reader xref-location-group))
- :documentation "Location of an etags tag.")
+(cl-defstruct (xref-etags-location
+ (:constructor xref-make-etags-location (tag-info file)))
+ "Location of an etags tag."
+ tag-info file)
-(defun xref-make-etags-location (tag-info file)
- (make-instance 'xref-etags-location :tag-info tag-info
- :file (expand-file-name file)))
+(cl-defmethod xref-location-group ((l xref-etags-location))
+ (xref-etags-location-file l))
(cl-defmethod xref-location-marker ((l xref-etags-location))
- (with-slots (tag-info file) l
+ (pcase-let (((cl-struct xref-etags-location tag-info file) l))
(let ((buffer (find-file-noselect file)))
(with-current-buffer buffer
(save-excursion
@@ -2182,25 +2180,20 @@ file name, add `tag-partial-file-name-match-p' to the list value.")
(point-marker)))))))
(cl-defmethod xref-location-line ((l xref-etags-location))
- (with-slots (tag-info) l
+ (pcase-let (((cl-struct xref-etags-location tag-info) l))
(nth 1 tag-info)))
-(defclass xref-etags-apropos-location (xref-location)
- ((symbol :type symbol :initarg :symbol)
- (goto-fun :type function :initarg :goto-fun)
- (group :type string :initarg :group
- :reader xref-location-group))
- :documentation "Location of an additional apropos etags symbol.")
+(cl-defstruct (xref-etags-apropos-location
+ (:constructor xref-make-etags-apropos-location (symbol goto-fun group)))
+ "Location of an additional apropos etags symbol."
+ symbol goto-fun group)
-(defun xref-make-etags-apropos-location (symbol goto-fun group)
- (make-instance 'xref-etags-apropos-location
- :symbol symbol
- :goto-fun goto-fun
- :group group))
+(cl-defmethod xref-location-group ((l xref-etags-apropos-location))
+ (xref-etags-apropos-location-group l))
(cl-defmethod xref-location-marker ((l xref-etags-apropos-location))
(save-window-excursion
- (with-slots (goto-fun symbol) l
+ (pcase-let (((cl-struct xref-etags-apropos-location goto-fun symbol) l))
(funcall goto-fun symbol)
(point-marker))))