aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/progmodes/etags.el2
-rw-r--r--lisp/progmodes/xref.el18
3 files changed, 16 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9b50a66a39d..39ae463b043 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12015-01-22 Dmitry Gutov <dgutov@yandex.ru> 12015-01-22 Dmitry Gutov <dgutov@yandex.ru>
2 2
3 * progmodes/xref.el (xref-location-marker, xref-location-group):
4 Use `cl-defgeneric' and `cl-defmethod' instead of the EIEIO
5 counterparts.
6
7 * progmodes/etags.el (xref-location-marker): Same.
8
3 * progmodes/xref.el (xref--current): Rename from `xref--selected'. 9 * progmodes/xref.el (xref--current): Rename from `xref--selected'.
4 (xref--inhibit-mark-current): Rename from 10 (xref--inhibit-mark-current): Rename from
5 `xref--inhibit-mark-selected'. Update the usages. 11 `xref--inhibit-mark-selected'. Update the usages.
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index dc3380d02f6..626855ecdd4 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2122,7 +2122,7 @@ for \\[find-tag] (which see)."
2122 (make-instance 'xref-etags-location :tag-info tag-info 2122 (make-instance 'xref-etags-location :tag-info tag-info
2123 :file (expand-file-name file))) 2123 :file (expand-file-name file)))
2124 2124
2125(defmethod xref-location-marker ((l xref-etags-location)) 2125(cl-defmethod xref-location-marker ((l xref-etags-location))
2126 (with-slots (tag-info file) l 2126 (with-slots (tag-info file) l
2127 (let ((buffer (find-file-noselect file))) 2127 (let ((buffer (find-file-noselect file)))
2128 (with-current-buffer buffer 2128 (with-current-buffer buffer
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index b82cd8eaacb..55405b63fe0 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -66,10 +66,10 @@
66 66
67;; If a backend decides to subclass xref-location it can provide 67;; If a backend decides to subclass xref-location it can provide
68;; methods for some of the following functions: 68;; methods for some of the following functions:
69(defgeneric xref-location-marker (location) 69(cl-defgeneric xref-location-marker (location)
70 "Return the marker for LOCATION.") 70 "Return the marker for LOCATION.")
71 71
72(defgeneric xref-location-group (location) 72(cl-defgeneric xref-location-group (location)
73 "Return a string used to group a set of locations. 73 "Return a string used to group a set of locations.
74This is typically the filename.") 74This is typically the filename.")
75 75
@@ -88,7 +88,7 @@ Line numbers start from 1 and columns from 0.")
88 "Create and return a new xref-file-location." 88 "Create and return a new xref-file-location."
89 (make-instance 'xref-file-location :file file :line line :column column)) 89 (make-instance 'xref-file-location :file file :line line :column column))
90 90
91(defmethod xref-location-marker ((l xref-file-location)) 91(cl-defmethod xref-location-marker ((l xref-file-location))
92 (with-slots (file line column) l 92 (with-slots (file line column) l
93 (with-current-buffer 93 (with-current-buffer
94 (or (get-file-buffer file) 94 (or (get-file-buffer file)
@@ -102,7 +102,7 @@ Line numbers start from 1 and columns from 0.")
102 (move-to-column column) 102 (move-to-column column)
103 (point-marker)))))) 103 (point-marker))))))
104 104
105(defmethod xref-location-group ((l xref-file-location)) 105(cl-defmethod xref-location-group ((l xref-file-location))
106 (oref l :file)) 106 (oref l :file))
107 107
108(defclass xref-buffer-location (xref-location) 108(defclass xref-buffer-location (xref-location)
@@ -113,12 +113,12 @@ Line numbers start from 1 and columns from 0.")
113 "Create and return a new xref-buffer-location." 113 "Create and return a new xref-buffer-location."
114 (make-instance 'xref-buffer-location :buffer buffer :position position)) 114 (make-instance 'xref-buffer-location :buffer buffer :position position))
115 115
116(defmethod xref-location-marker ((l xref-buffer-location)) 116(cl-defmethod xref-location-marker ((l xref-buffer-location))
117 (with-slots (buffer position) l 117 (with-slots (buffer position) l
118 (let ((m (make-marker))) 118 (let ((m (make-marker)))
119 (move-marker m position buffer)))) 119 (move-marker m position buffer))))
120 120
121(defmethod xref-location-group ((l xref-buffer-location)) 121(cl-defmethod xref-location-group ((l xref-buffer-location))
122 (with-slots (buffer) l 122 (with-slots (buffer) l
123 (or (buffer-file-name buffer) 123 (or (buffer-file-name buffer)
124 (format "(buffer %s)" (buffer-name buffer))))) 124 (format "(buffer %s)" (buffer-name buffer)))))
@@ -134,10 +134,10 @@ actual location is not known.")
134 "Create and return a new xref-bogus-location." 134 "Create and return a new xref-bogus-location."
135 (make-instance 'xref-bogus-location :message message)) 135 (make-instance 'xref-bogus-location :message message))
136 136
137(defmethod xref-location-marker ((l xref-bogus-location)) 137(cl-defmethod xref-location-marker ((l xref-bogus-location))
138 (user-error "%s" (oref l :message))) 138 (user-error "%s" (oref l :message)))
139 139
140(defmethod xref-location-group ((_ xref-bogus-location)) "(No location)") 140(cl-defmethod xref-location-group ((_ xref-bogus-location)) "(No location)")
141 141
142;; This should be in elisp-mode.el, but it's preloaded, and we can't 142;; This should be in elisp-mode.el, but it's preloaded, and we can't
143;; preload defclass and defmethod (at least, not yet). 143;; preload defclass and defmethod (at least, not yet).
@@ -151,7 +151,7 @@ actual location is not known.")
151(defun xref-make-elisp-location (symbol type file) 151(defun xref-make-elisp-location (symbol type file)
152 (make-instance 'xref-elisp-location :symbol symbol :type type :file file)) 152 (make-instance 'xref-elisp-location :symbol symbol :type type :file file))
153 153
154(defmethod xref-location-marker ((l xref-elisp-location)) 154(cl-defmethod xref-location-marker ((l xref-elisp-location))
155 (with-slots (symbol type file) l 155 (with-slots (symbol type file) l
156 (let ((buffer-point 156 (let ((buffer-point
157 (pcase type 157 (pcase type