all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Stephen Leake <stephen_leake@stephe-leake.org>
Cc: emacs-devel@gnu.org
Subject: Re: strange error from global-ede-mode
Date: Tue, 15 Sep 2015 13:23:25 -0400	[thread overview]
Message-ID: <jwvk2rrzjqb.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <86mvwq77rd.fsf@stephe-leake.org> (Stephen Leake's message of "Sun, 13 Sep 2015 08:45:26 -0500")

> @@ -766,7 +766,8 @@ Fills in OBJ's SLOT with its default value."
>    (cl-check-type obj (or eieio-object class))
>    (cl-check-type slot symbol)
>    (let* ((cl (cond ((symbolp obj) (cl--find-class obj))
> -                   (t (eieio--object-class obj))))
> +                   ((eieio-object-p obj) (eieio--object-class obj))
> +                   (t obj)))
>  	 (c (eieio--slot-name-index cl slot)))
>      (if (not c)
>  	;; It might be missing because it is a :class allocated slot.

Thanks, that looks good.

> That fixes my original problem; I'll commit this.

Please do.

> We should also provide a "slot-missing" implementation for something
> here, so future errors of this sort will give a better error message.

I guess we could simply do.


        Stefan


diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index 790e8bc..8c37f8c 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -768,7 +768,7 @@ dynamically set from SLOTS."
 (cl-defgeneric slot-missing (object slot-name operation &optional new-value)
   "Method invoked when an attempt to access a slot in OBJECT fails.")
 
-(cl-defmethod slot-missing ((object eieio-default-superclass) slot-name
+(cl-defmethod slot-missing (object slot-name
 			 _operation &optional _new-value)
   "Method invoked when an attempt to access a slot in OBJECT fails.
 SLOT-NAME is the name of the failed slot, OPERATION is the type of access
@@ -777,8 +777,9 @@ to be set.
 
 This method is called from `oref', `oset', and other functions which
 directly reference slots in EIEIO objects."
-  (signal 'invalid-slot-name (list (eieio-object-name object)
-				   slot-name)))
+  (signal 'invalid-slot-name
+          (list (if (eieio-object-p object) (eieio-object-name object) object)
+                slot-name)))
 
 (cl-defgeneric slot-unbound (object class slot-name fn)
   "Slot unbound is invoked during an attempt to reference an unbound slot.")



  reply	other threads:[~2015-09-15 17:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 19:52 strange error from global-ede-mode Stephen Leake
2015-09-10 23:47 ` Stefan Monnier
2015-09-11 16:58   ` Stephen Leake
2015-09-11 19:47     ` Stephen Leake
2015-09-12  0:26       ` Stefan Monnier
2015-09-13 13:45         ` Stephen Leake
2015-09-15 17:23           ` Stefan Monnier [this message]
2015-09-12  0:27     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvk2rrzjqb.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=stephen_leake@stephe-leake.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.