1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-30 08:09:04 +00:00

Silence byte-compiler warning with :read-only defstruct slots

* emacs-lisp/cl-macs.el (defstruct): Ignore argument to setf
method if slot is read-only.

Fixes: debbugs:9035
This commit is contained in:
Lawrence Mitchell 2011-07-16 17:52:46 +02:00 committed by Lars Magne Ingebrigtsen
parent be39b8cc93
commit 0794775d0d
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2011-07-16 Lawrence Mitchell <wence@gmx.li>
* emacs-lisp/cl-macs.el (defstruct): Ignore argument to setf
method if slot is read-only (bug#9035).
2011-07-16 Martin Rudalics <rudalics@gmx.at>
* frame.el (select-frame-set-input-focus): New argument

View File

@ -2396,8 +2396,10 @@ value, that slot cannot be set via `setf'.
(push (cons accessor t) side-eff)
(push (list 'define-setf-method accessor '(cl-x)
(if (cadr (memq :read-only (cddr desc)))
(list 'error (format "%s is a read-only slot"
accessor))
(list 'progn '(ignore cl-x)
(list 'error
(format "%s is a read-only slot"
'accessor)))
;; If cl is loaded only for compilation,
;; the call to cl-struct-setf-expander would
;; cause a warning because it may not be