GNU bug report logs - #18321
24.4.50; EIEIO and (defmethod (setf ...))

Previous Next

Package: emacs;

Reported by: Tom Tromey <tom <at> tromey.com>

Date: Sun, 24 Aug 2014 05:10:02 UTC

Severity: wishlist

Found in version 24.4.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18321 in the body.
You can then email your comments to 18321 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18321; Package emacs. (Sun, 24 Aug 2014 05:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tom Tromey <tom <at> tromey.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 24 Aug 2014 05:10:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tom Tromey <tom <at> tromey.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4.50; EIEIO and (defmethod (setf ...))
Date: Sat, 23 Aug 2014 20:33:21 -0600
I was hoping this would work:

(defclass hibob ()
  ((click-callback :initform nil)
   (icon :initform "" :accessor hibob-icon)))

(defmethod (setf hibob-icon) :after (newval (obj hibob))
  (setq zzzz newval))

This works in Common Lisp and is quite handy.

However in elisp this gives an error.

Debugger entered--Lisp error: (wrong-type-argument symbolp (setf hibob-icon))
  fboundp((setf hibob-icon))
  eieio--defgeneric-init-form((setf hibob-icon) "Generically created method `(setf hibob-icon)'.")
  (eieio--defalias (quote (setf hibob-icon)) (eieio--defgeneric-init-form (quote (setf hibob-icon)) "Generically created method `(setf hibob-icon)'."))
  (progn (eieio--defalias (quote (setf hibob-icon)) (eieio--defgeneric-init-form (quote (setf hibob-icon)) "Generically created method `(setf hibob-icon)'.")) (eieio--defmethod (quote (setf hibob-icon)) (quote :after) (quote nil) (function (lambda (newval (obj hibob)) (setq zzzz newval)))))


I didn't see a documented way to augment the slot setter method, which
is what I'm really trying to do.





In GNU Emacs 24.4.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.9)
 of 2014-08-22 on bapiya
Repository revision: 117722 yamaoka <at> jpl.org-20140821230223-mmy41yexo692kipp
Windowing system distributor `Fedora Project', version 11.0.11404000
Configured using:
 `configure --prefix=/home/tromey/Emacs/install'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  flyspell-mode: t
  eldoc-mode: t
  which-function-mode: t
  global-auto-revert-mode: t
  erc-services-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  savehist-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill

Recent input:
t h o d C-a C-u C-n C-p C-s e i e C-w C-w C-w C-s C-s 
M-b M-x l g r e p <return> <return> <return> <return> 
C-x o C-x 1 C-u C-u C-n C-n C-n C-n C-n C-c C-c C-x 
1 C-l C-s m e t h o d C-a C-u C-u C-n C-l C-s C-s C-z 
n C-p C-e C-j C-z n M-< C-s d e f g e n e r i c - i 
n i t C-w C-a C-z n C-] C-z n C-x b e i e <tab> <return> 
M-v M-< C-s : a c c e s s C-w M-< C-s k a r l C-a C-u 
C-SPC C-s C-s M-p C-s C-s C-a M-x l g r e p <return> 
: a c c <M-backspace> <backspace> <return> <return> 
<return> C-x o C-x 1 C-u C-u C-n C-n C-c C-c C-x 1 
M-m C-f C-s C-w C-s C-s C-s C-v C-l <next> M-v <switch-frame> 
<switch-frame> C-v C-s w r i t e r M-v <switch-frame> 
C-z n <switch-frame> <switch-frame> C-l C-u C-p C-u 
C-p C-l M-v C-l C-p C-p C-M-f C-M-b C-n C-M-f C-f C-f 
C-l C-M-f C-M-b C-M-f C-l C-a C-u C-u C-p C-l C-u C-u 
C-p C-s e i e o <backspace> e <backspace> i o - C-a 
C-s - o s e t C-a C-p M-f M-f C-h f <return> C-x 1 
C-z n M-v M-v C-h f d e f m <tab> <tab> e t <tab> <tab> 
<return> C-h f d e f m a t h <return> C-h f M-p <return> 
C-h f M-p M-p <return> C-x o C-x 1 C-z n C-l z n C-c 
C-g C-/ C-z n C-c b M-v C-z n M-x r e p o r t - e m 
<tab> <return>

Recent messages:
Grep finished (matches found)
Mark saved where search started [4 times]
Type C-x 1 to delete the help window.
scroll-down-command: Beginning of buffer
Making completion list...
Type C-x 1 to delete the help window, C-M-v to scroll help.
 [3 times]
C-c C-g is undefined
Quit
Undo!

Load-path shadows:
/home/tromey/.emacs.d/elpa/css-mode-1.0/css-mode hides /home/tromey/Emacs/install/share/emacs/24.4.50/lisp/textmodes/css-mode
/home/tromey/.emacs.d/elpa/bubbles-0.5/bubbles hides /home/tromey/Emacs/install/share/emacs/24.4.50/lisp/play/bubbles

Features:
(shadow sort mail-extr warnings emacsbug sendmail gv debug jka-compr
eieio-opt speedbar sb-image ezimage dframe help-mode dabbrev log-edit
easy-mmode message dired rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev
mail-utils gmm-utils mailheader pcvs-util copyright add-log status
misearch multi-isearch vc-arch vc-mtn vc-hg vc-git vc-bzr vc-sccs vc-svn
vc-cvs vc-rcs flyspell ispell eldoc diminish projectile edmacro kmacro
pkg-info find-func lisp-mnt epl grep compile dash s dwarf-mode-autoloads
gdb-shell-autoloads jabber-autoloads lisppaste-autoloads
pydoc-info-autoloads info-look info weblogger-autoloads package appt
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs which-func imenu
autorevert filenotify cus-start cus-load erc-services erc-list erc-menu
easymenu erc-join erc-ring erc-networks erc-pcomplete pcomplete
erc-track erc-match erc-button wid-edit cl-loaddefs cl-lib erc-fill
erc-stamp erc-netsplit erc-goodies erc erc-backend erc-compat
format-spec auth-source eieio byte-opt bytecomp byte-compile cconv
eieio-core gnus-util mm-util mail-prsvr password-cache thingatpt pp
advice help-fns vc-dir ewoc vc vc-dispatcher cc-styles cc-align
cc-engine cc-vars cc-defs bbdb timezone ange-ftp comint ansi-color ring
server savehist bbdb-autoloads time-date tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 219861 41035)
 (symbols 48 33411 0)
 (miscs 40 716 2382)
 (strings 32 55441 8977)
 (string-bytes 1 1726575)
 (vectors 16 31815)
 (vector-slots 8 1321774 174920)
 (floats 8 135 717)
 (intervals 56 5229 305)
 (buffers 976 25)
 (heap 1024 166051 29102))




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Tue, 05 May 2015 18:34:02 GMT) Full text and rfc822 format available.

Notification sent to Tom Tromey <tom <at> tromey.com>:
bug acknowledged by developer. (Tue, 05 May 2015 18:34:02 GMT) Full text and rfc822 format available.

Message #10 received at 18321-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Tom Tromey <tom <at> tromey.com>
Cc: 18321-done <at> debbugs.gnu.org
Subject: Re: bug#18321: 24.4.50; EIEIO and (defmethod (setf ...))
Date: Tue, 05 May 2015 14:33:25 -0400
> I was hoping this would work:
>
> (defclass hibob ()
>   ((click-callback :initform nil)
>    (icon :initform "" :accessor hibob-icon)))
>
> (defmethod (setf hibob-icon) :after (newval (obj hibob))
>   (setq zzzz newval))
>
> This works in Common Lisp and is quite handy.

IIUC this should now work if you use cl-defmethod.


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 03 Jun 2015 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.