Subject: 24.4.50; EIEIO and (defmethod (setf ...))

From: Tom Tromey <[email-masked]>
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 [email-masked]
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))