[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 03346fb 2/2: xref: Replace defgeneric and defmethod
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] master 03346fb 2/2: xref: Replace defgeneric and defmethod with cl- counterparts |
Date: |
Thu, 22 Jan 2015 02:24:54 +0000 |
branch: master
commit 03346fb0747ddb39786bd9e43fe7f422cd48b9fe
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
xref: Replace defgeneric and defmethod with cl- counterparts
* lisp/progmodes/xref.el (xref-location-marker, xref-location-group):
Use `cl-defgeneric' and `cl-defmethod' instead of the EIEIO
counterparts.
* lisp/progmodes/etags.el (xref-location-marker): Same.
---
lisp/ChangeLog | 6 ++++++
lisp/progmodes/etags.el | 2 +-
lisp/progmodes/xref.el | 18 +++++++++---------
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9b50a66..39ae463 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
2015-01-22 Dmitry Gutov <address@hidden>
+ * progmodes/xref.el (xref-location-marker, xref-location-group):
+ Use `cl-defgeneric' and `cl-defmethod' instead of the EIEIO
+ counterparts.
+
+ * progmodes/etags.el (xref-location-marker): Same.
+
* progmodes/xref.el (xref--current): Rename from `xref--selected'.
(xref--inhibit-mark-current): Rename from
`xref--inhibit-mark-selected'. Update the usages.
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index dc3380d..626855e 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2122,7 +2122,7 @@ for \\[find-tag] (which see)."
(make-instance 'xref-etags-location :tag-info tag-info
:file (expand-file-name file)))
-(defmethod xref-location-marker ((l xref-etags-location))
+(cl-defmethod xref-location-marker ((l xref-etags-location))
(with-slots (tag-info file) l
(let ((buffer (find-file-noselect file)))
(with-current-buffer buffer
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index b82cd8e..55405b6 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -66,10 +66,10 @@
;; If a backend decides to subclass xref-location it can provide
;; methods for some of the following functions:
-(defgeneric xref-location-marker (location)
+(cl-defgeneric xref-location-marker (location)
"Return the marker for LOCATION.")
-(defgeneric xref-location-group (location)
+(cl-defgeneric xref-location-group (location)
"Return a string used to group a set of locations.
This is typically the filename.")
@@ -88,7 +88,7 @@ Line numbers start from 1 and columns from 0.")
"Create and return a new xref-file-location."
(make-instance 'xref-file-location :file file :line line :column column))
-(defmethod xref-location-marker ((l xref-file-location))
+(cl-defmethod xref-location-marker ((l xref-file-location))
(with-slots (file line column) l
(with-current-buffer
(or (get-file-buffer file)
@@ -102,7 +102,7 @@ Line numbers start from 1 and columns from 0.")
(move-to-column column)
(point-marker))))))
-(defmethod xref-location-group ((l xref-file-location))
+(cl-defmethod xref-location-group ((l xref-file-location))
(oref l :file))
(defclass xref-buffer-location (xref-location)
@@ -113,12 +113,12 @@ Line numbers start from 1 and columns from 0.")
"Create and return a new xref-buffer-location."
(make-instance 'xref-buffer-location :buffer buffer :position position))
-(defmethod xref-location-marker ((l xref-buffer-location))
+(cl-defmethod xref-location-marker ((l xref-buffer-location))
(with-slots (buffer position) l
(let ((m (make-marker)))
(move-marker m position buffer))))
-(defmethod xref-location-group ((l xref-buffer-location))
+(cl-defmethod xref-location-group ((l xref-buffer-location))
(with-slots (buffer) l
(or (buffer-file-name buffer)
(format "(buffer %s)" (buffer-name buffer)))))
@@ -134,10 +134,10 @@ actual location is not known.")
"Create and return a new xref-bogus-location."
(make-instance 'xref-bogus-location :message message))
-(defmethod xref-location-marker ((l xref-bogus-location))
+(cl-defmethod xref-location-marker ((l xref-bogus-location))
(user-error "%s" (oref l :message)))
-(defmethod xref-location-group ((_ xref-bogus-location)) "(No location)")
+(cl-defmethod xref-location-group ((_ xref-bogus-location)) "(No location)")
;; This should be in elisp-mode.el, but it's preloaded, and we can't
;; preload defclass and defmethod (at least, not yet).
@@ -151,7 +151,7 @@ actual location is not known.")
(defun xref-make-elisp-location (symbol type file)
(make-instance 'xref-elisp-location :symbol symbol :type type :file file))
-(defmethod xref-location-marker ((l xref-elisp-location))
+(cl-defmethod xref-location-marker ((l xref-elisp-location))
(with-slots (symbol type file) l
(let ((buffer-point
(pcase type