emacs-devel
[Top][All Lists]
Advanced

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

Re: Towards a cleaner build: eieio


From: Lars Ingebrigtsen
Subject: Re: Towards a cleaner build: eieio
Date: Sun, 16 Jun 2019 18:41:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Lars Ingebrigtsen <address@hidden> writes:

> OK; I'll take a look at rewriting one of them to see how much work it
> is...

OK, here's my test case:

(require 'semantic/db-el)
(setq obj (semanticdb-table-emacs-lisp :major-mode "foo"))

(object-print obj)
=> "#<semanticdb-table-emacs-lisp semanticdb-table-emacs-lisp-15884632da6c 
(proxy)>"

(cl-print-object obj (current-buffer))
#<semanticdb-table-emacs-lisp semanticdb-table-emacs-lisp-15884632da6c (proxy)>

So that's the way it is with an object-print method on the object.  If I
apply the following patch, I then get identical output:

(cl-print-object obj (current-buffer))
#<semanticdb-table-emacs-lisp semanticdb-table-emacs-lisp-15884632da6c (proxy)>

That's a kind of odd object-print, though, because it contains so little
information.  But I've followed the call-next-method chain up, and
there's nothing added, so I think this change is correct?  (Because the
optional STRINGS is always nil; i.e., there are no actual direct calls
to object-print.)

If this looks reasonable to you, I can do the transforms for the other
five instances of object-print in cedet.

diff --git a/lisp/cedet/semantic/db-el.el b/lisp/cedet/semantic/db-el.el
index 5375623c13..b30553d95b 100644
--- a/lisp/cedet/semantic/db-el.el
+++ b/lisp/cedet/semantic/db-el.el
@@ -53,10 +53,9 @@ semanticdb-needs-refresh-p
   "Return nil, we never need a refresh."
   nil)
 
-(cl-defmethod object-print ((obj semanticdb-table-emacs-lisp) &rest strings)
-  "Pretty printer extension for `semanticdb-table-emacs-lisp'.
-Adds the number of tags in this file to the object print name."
-  (apply #'cl-call-next-method obj (cons " (proxy)" strings)))
+(cl-defmethod cl-print-object ((obj semanticdb-table-emacs-lisp) stream)
+  "Pretty printer extension for `semanticdb-table-emacs-lisp'."
+  (princ (eieio-object-name obj " (proxy)") stream))
 
 (defclass semanticdb-project-database-emacs-lisp
   (semanticdb-project-database eieio-singleton)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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