comparison lisp/bytecomp.el @ 5344:2a54dfbe434f

Don't quote keywords, they've been self-quoting for well over a decade. 2011-01-22 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-setq, byte-compile-set): Remove kludge allowing keywords' values to be set, all the code that does that is gone. * cl-compat.el (elt-satisfies-test-p): * faces.el (set-face-parent): * faces.el (face-doc-string): * gtk-font-menu.el: * gtk-font-menu.el (gtk-reset-device-font-menus): * msw-font-menu.el: * msw-font-menu.el (mswindows-reset-device-font-menus): * package-get.el (package-get-installedp): * select.el (select-convert-from-image-data): * sound.el: * sound.el (load-sound-file): * x-font-menu.el (x-reset-device-font-menus-core): Don't quote keywords, they're self-quoting, and the win from backward-compatibility is sufficiently small now that the style problem overrides it.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 22 Jan 2011 23:29:25 +0000
parents ec05a30f7148
children 38e24b8be4ea
comparison
equal deleted inserted replaced
5343:34ab0e66aaca 5344:2a54dfbe434f
3727 (setq var (pop args)) 3727 (setq var (pop args))
3728 (if (null args) 3728 (if (null args)
3729 ;; Odd number of args? Let `set' get the error. 3729 ;; Odd number of args? Let `set' get the error.
3730 (byte-compile-form `(set ',var) for-effect) 3730 (byte-compile-form `(set ',var) for-effect)
3731 (setq val (pop args)) 3731 (setq val (pop args))
3732 (if (keywordp var) 3732 (byte-compile-form val)
3733 ;; (setq :foo ':foo) compatibility kludge 3733 (unless (or args for-effect)
3734 (byte-compile-form `(set ',var ,val) (if args t for-effect)) 3734 (byte-compile-out 'byte-dup 0))
3735 (byte-compile-form val) 3735 (byte-compile-variable-ref 'byte-varset var)))))
3736 (unless (or args for-effect)
3737 (byte-compile-out 'byte-dup 0))
3738 (byte-compile-variable-ref 'byte-varset var))))))
3739 (setq for-effect nil)) 3736 (setq for-effect nil))
3740 3737
3741 (defun byte-compile-set (form) 3738 (defun byte-compile-set (form)
3742 ;; Compile (set 'foo x) as (setq foo x) for trivially better code and so 3739 ;; Compile (set 'foo x) as (setq foo x) for trivially better code and so
3743 ;; that we get applicable warnings. Compile everything else (including 3740 ;; that we get applicable warnings. Compile everything else (including
3744 ;; malformed calls) like a normal 2-arg byte-coded function. 3741 ;; malformed calls) like a normal 2-arg byte-coded function.
3745 (let ((symform (nth 1 form)) 3742 (let ((symform (nth 1 form))
3746 (valform (nth 2 form)) 3743 (valform (nth 2 form))
3747 sym) 3744 sym)
3748 (if (and (= (length form) 3) 3745 (if (and (eql (length form) 3)
3749 (= (safe-length symform) 2) 3746 (eql (safe-length symform) 2)
3750 (eq (car symform) 'quote) 3747 (eq (car symform) 'quote)
3751 (symbolp (setq sym (car (cdr symform)))) 3748 (symbolp (setq sym (car (cdr symform)))))
3752 (not (byte-compile-constant-symbol-p sym)))
3753 (byte-compile-setq `(setq ,sym ,valform)) 3749 (byte-compile-setq `(setq ,sym ,valform))
3754 (byte-compile-two-args form)))) 3750 (byte-compile-two-args form))))
3755 3751
3756 (defun byte-compile-setq-default (form) 3752 (defun byte-compile-setq-default (form)
3757 (let ((args (cdr form))) 3753 (let ((args (cdr form)))