[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master fc8a8bd: Move around defgeneric/defmethods in eieio
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master fc8a8bd: Move around defgeneric/defmethods in eieio |
Date: |
Wed, 19 Jun 2019 11:12:35 -0400 (EDT) |
branch: master
commit fc8a8bdb7f19db2032b7e6108ba8de9d57c7acd4
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Move around defgeneric/defmethods in eieio
* lisp/emacs-lisp/eieio.el (object-print):
* lisp/emacs-lisp/eieio-base.el (eieio-object-set-name-string):
Move the defgeneric before the defmethod, because that makes more
sense.
---
lisp/emacs-lisp/eieio-base.el | 11 ++++++-----
lisp/emacs-lisp/eieio.el | 25 +++++++++++++------------
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index b6358bd..5346138 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -508,11 +508,6 @@ instance."
(or (slot-value obj 'object-name)
(cl-call-next-method)))
-(cl-defmethod eieio-object-set-name-string ((obj eieio-named) name)
- "Set the string which is OBJ's NAME."
- (cl-check-type name string)
- (eieio-oset obj 'object-name name))
-
(cl-defgeneric eieio-object-set-name-string (obj name)
"Set the string which is OBJ's NAME."
(declare (obsolete "inherit from `eieio-named' and use (setf (slot-value OBJ
\\='object-name) NAME) instead" "25.1"))
@@ -521,6 +516,12 @@ instance."
(define-obsolete-function-alias
'object-set-name-string 'eieio-object-set-name-string "24.4")
+(with-suppressed-warnings ((obsolete eieio-object-set-name-string))
+ (cl-defmethod eieio-object-set-name-string ((obj eieio-named) name)
+ "Set the string which is OBJ's NAME."
+ (cl-check-type name string)
+ (eieio-oset obj 'object-name name)))
+
(cl-defmethod clone ((obj eieio-named) &rest params)
"Clone OBJ, initializing `:parent' to OBJ.
All slots are unbound, except those initialized with PARAMS."
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index 400599a..4b899cd 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -819,8 +819,18 @@ first and modify the returned object.")
;; No cleanup... yet.
nil)
-(cl-defmethod object-print ((this eieio-default-superclass) &rest strings)
- "Pretty printer for object THIS. Call function `object-name' with STRINGS.
+(cl-defgeneric object-print (this &rest _strings)
+ "Pretty printer for object THIS.
+
+It is sometimes useful to put a summary of the object into the
+default #<notation> string when using EIEIO browsing tools.
+Implement this method to customize the summary."
+ (declare (obsolete cl-print-object "26.1"))
+ (format "%S" this))
+
+(with-suppressed-warnings ((obsolete object-print))
+ (cl-defmethod object-print ((this eieio-default-superclass) &rest strings)
+ "Pretty printer for object THIS. Call function `object-name' with STRINGS.
The default method for printing object THIS is to use the
function `object-name'.
@@ -831,16 +841,7 @@ Implement this function and specify STRINGS in a call to
`call-next-method' to provide additional summary information.
When passing in extra strings from child classes, always remember
to prepend a space."
- (eieio-object-name this (apply #'concat strings)))
-
-(cl-defgeneric object-print (this &rest _strings)
- "Pretty printer for object THIS.
-
-It is sometimes useful to put a summary of the object into the
-default #<notation> string when using EIEIO browsing tools.
-Implement this method to customize the summary."
- (declare (obsolete cl-print-object "26.1"))
- (format "%S" this))
+ (eieio-object-name this (apply #'concat strings))))
(with-suppressed-warnings ((obsolete object-print))
(cl-defmethod cl-print-object ((object eieio-default-superclass) stream)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master fc8a8bd: Move around defgeneric/defmethods in eieio,
Lars Ingebrigtsen <=