Skip to content

Left over use of obsolete "object name" EIEIO functionality #60

@monnier

Description

@monnier

Back in Emacs<25, EIEIO had the unusual property that every object created with make-instance had a name, which you could retrieve with eieio-object-name-string, and which was passed as the second argument to make-instance.
This was declared obsolete in Emacs-25 when EIEIO was reworked to be a bit less inefficient (in the present case, the inefficiency was to waste a slot in every object even though it was almost never used) and to better match CLOS, and as a consequence the "object name" feature was declared obsolete.

As it turns out, linemark.el still makes use of that obsolete feature for linemark-group objects.

The fix should be fairly simple: make linemark-group inherit from eieio-named and then use the object-name slot.

I think the minimal patch below might fix it, tho I don't know how to test it.

diff --git a/linemark.el b/linemark.el
index c2d502bf7e..b059e7e22c 100644
--- a/linemark.el
+++ b/linemark.el
@@ -97,7 +90,7 @@
              :protection protected))
   "Track a file/line associations with overlays used for display.")
 
-(defclass linemark-group ()
+(defclass linemark-group (eieio-named)
   ((marks :initarg :marks
           :type list
           :initform nil
@@ -133,7 +126,7 @@ the new instantiation."
         (lmg linemark-groups))
     ;; Find an old group.
     (while (and (not foundgroup) lmg)
-      (if (string= name (eieio-object-name-string (car lmg)))
+      (if (string= name (slot-value (car lmg) 'object-name))
           (setq foundgroup (car lmg)))
       (setq lmg (cdr lmg)))
     ;; Which group to use.
@@ -141,7 +134,7 @@ the new instantiation."
         ;; Recycle the old group
         (setq newgroup foundgroup)
       ;; Create a new group
-      (setq newgroup (apply 'make-instance class name args))
+      (setq newgroup (apply #'make-instance class :object-name name args))
       (setq linemark-groups (cons newgroup linemark-groups)))
     ;; Return the group
     newgroup))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions