Mercurial > hg > xemacs-beta
comparison lisp/bytecomp.el @ 5652:cc6f0266bc36
Avoid #'delq in core Lisp, for the sake of style, a very slightly smaller binary
lisp/ChangeLog addition:
2012-05-01 Aidan Kehoe <kehoea@parhasard.net>
Avoid #'delq in core code, for the sake of style and a (very
slightly) smaller binary.
* behavior.el (disable-behavior):
* behavior.el (compute-behavior-group-children):
* buff-menu.el (buffers-tab-items):
* byte-optimize.el (byte-optimize-delay-constants-math):
* byte-optimize.el (byte-optimize-logmumble):
* byte-optimize.el (byte-decompile-bytecode-1):
* byte-optimize.el (byte-optimize-lapcode):
* bytecomp.el:
* bytecomp.el (byte-compile-arglist-warn):
* bytecomp.el (byte-compile-warn-about-unresolved-functions):
* bytecomp.el (byte-compile-lambda):
* bytecomp.el (byte-compile-out-toplevel):
* bytecomp.el (byte-compile-insert):
* bytecomp.el (byte-compile-defalias-warn):
* cl-macs.el (cl-upcase-arg):
* cl-macs.el (cl-transform-lambda):
* cl-macs.el (cl-do-proclaim):
* cl-macs.el (defstruct):
* cl-macs.el (cl-make-type-test):
* cl-macs.el (define-compiler-macro):
* cl-macs.el (delete-duplicates):
* cus-edit.el (widget-face-value-delete):
* cus-edit.el (face-history):
* easymenu.el (easy-menu-remove):
* files.el (files-fetch-hook-value):
* files.el (file-expand-wildcards):
* font-lock.el (font-lock-update-removed-keyword-alist):
* font-lock.el (font-lock-remove-keywords):
* frame.el (frame-initialize):
* frame.el (frame-notice-user-settings):
* frame.el (set-frame-font):
* frame.el (delete-other-frames):
* frame.el (get-frame-for-buffer-noselect):
* gnuserv.el (gnuserv-kill-buffer-function):
* gnuserv.el (gnuserv-check-device):
* gnuserv.el (gnuserv-kill-client):
* gnuserv.el (gnuserv-buffer-done-1):
* gtk-font-menu.el (gtk-reset-device-font-menus):
* gutter-items.el (buffers-tab-items):
* gutter.el (set-gutter-element-visible-p):
* info.el (Info-find-file-node):
* info.el (Info-history-add):
* info.el (Info-build-annotation-completions):
* info.el (Info-index):
* info.el (Info-reannotate-node):
* itimer.el (delete-itimer):
* itimer.el (start-itimer):
* lib-complete.el (lib-complete:cache-completions):
* loadhist.el (unload-feature):
* menubar-items.el (build-buffers-menu-internal):
* menubar.el (delete-menu-item):
* menubar.el (relabel-menu-item):
* msw-font-menu.el (mswindows-reset-device-font-menus):
* mule/make-coding-system.el (fixed-width-generate-helper):
* next-error.el (next-error-find-buffer):
* obsolete.el:
* obsolete.el (find-non-ascii-charset-string):
* obsolete.el (find-non-ascii-charset-region):
* occur.el (multi-occur-by-filename-regexp):
* occur.el (occur-1):
* packages.el (packages-package-hierarchy-directory-names):
* packages.el (package-get-key-1):
* process.el (setenv):
* simple.el (undo):
* simple.el (handle-pre-motion-command-current-command-is-motion):
* sound.el (load-sound-file):
* wid-edit.el (widget-field-value-delete):
* wid-edit.el (widget-checklist-match-inline):
* wid-edit.el (widget-checklist-match-find):
* wid-edit.el (widget-editable-list-delete-at):
* wid-edit.el (widget-editable-list-entry-create):
* window.el (quit-window):
* x-font-menu.el (x-reset-device-font-menus-core):
1. Replace (delq nil (mapcar ....)) with analogous (mapcan ...)
forms; this is in non-dumped files, it was done previously in
dumped files.
2. Replace (delq FOO (copy-sequence BAR)) with (remove* FOO BAR),
where #'eq and #'eql are equivalent
3. Replace (delq FOO BAR) with (delete* FOO BAR), where FOO is not
a non-fixnum number. Saves a little space in the dumped file
(since the compiler macro adds :test #'eq to the delete* call if
it's not clear that FOO is not a non-fixnum number).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 01 May 2012 16:17:42 +0100 |
parents | ae2fdb1fd9e0 |
children | e9c3fe82127d |
comparison
equal
deleted
inserted
replaced
5651:ae2fdb1fd9e0 | 5652:cc6f0266bc36 |
---|---|
1486 (byte-compile-arglist-signature-string sig) | 1486 (byte-compile-arglist-signature-string sig) |
1487 (if (equal sig '(1 . 1)) " arg" " args") | 1487 (if (equal sig '(1 . 1)) " arg" " args") |
1488 (byte-compile-arglist-signature-string (cons min max)))) | 1488 (byte-compile-arglist-signature-string (cons min max)))) |
1489 | 1489 |
1490 (setq byte-compile-unresolved-functions | 1490 (setq byte-compile-unresolved-functions |
1491 (delq calls byte-compile-unresolved-functions))))) | 1491 (delete* calls byte-compile-unresolved-functions))))) |
1492 ))) | 1492 ))) |
1493 | 1493 |
1494 ;; If we have compiled any calls to functions which are not known to be | 1494 ;; If we have compiled any calls to functions which are not known to be |
1495 ;; defined, issue a warning enumerating them. | 1495 ;; defined, issue a warning enumerating them. |
1496 ;; `unresolved' in the list `byte-compile-warnings' disables this. | 1496 ;; `unresolved' in the list `byte-compile-warnings' disables this. |
1501 (if byte-compile-autoload-environment | 1501 (if byte-compile-autoload-environment |
1502 (let ((rest byte-compile-unresolved-functions)) | 1502 (let ((rest byte-compile-unresolved-functions)) |
1503 (while rest | 1503 (while rest |
1504 (if (assq (car (car rest)) byte-compile-autoload-environment) | 1504 (if (assq (car (car rest)) byte-compile-autoload-environment) |
1505 (setq byte-compile-unresolved-functions | 1505 (setq byte-compile-unresolved-functions |
1506 (delq (car rest) byte-compile-unresolved-functions))) | 1506 (delete* (car rest) byte-compile-unresolved-functions))) |
1507 (setq rest (cdr rest))))) | 1507 (setq rest (cdr rest))))) |
1508 ;; Now warn. | 1508 ;; Now warn. |
1509 (if (cdr byte-compile-unresolved-functions) | 1509 (if (cdr byte-compile-unresolved-functions) |
1510 (let* ((str "The following functions are not known to be defined: ") | 1510 (let* ((str "The following functions are not known to be defined: ") |
1511 (L (+ (length str) 5)) | 1511 (L (+ (length str) 5)) |
2755 (arglist (nth 1 fun)) | 2755 (arglist (nth 1 fun)) |
2756 (byte-compile-bound-variables | 2756 (byte-compile-bound-variables |
2757 (let ((new-bindings | 2757 (let ((new-bindings |
2758 (mapcar #'(lambda (x) (cons x byte-compile-arglist-bit)) | 2758 (mapcar #'(lambda (x) (cons x byte-compile-arglist-bit)) |
2759 (and (memq 'free-vars byte-compile-warnings) | 2759 (and (memq 'free-vars byte-compile-warnings) |
2760 (delq '&rest (delq '&optional | 2760 (remove* '&rest (remove* '&optional arglist)))))) |
2761 (copy-sequence arglist))))))) | |
2762 (nconc new-bindings | 2761 (nconc new-bindings |
2763 (cons 'new-scope byte-compile-bound-variables)))) | 2762 (cons 'new-scope byte-compile-bound-variables)))) |
2764 (body (cdr (cdr fun))) | 2763 (body (cdr (cdr fun))) |
2765 (doc (if (stringp (car body)) | 2764 (doc (if (stringp (car body)) |
2766 (prog1 (car body) | 2765 (prog1 (car body) |
2961 (if (and (eq tmp 'funcall) | 2960 (if (and (eq tmp 'funcall) |
2962 (eq (car-safe (car body)) 'quote)) | 2961 (eq (car-safe (car body)) 'quote)) |
2963 (cons (nth 1 (car body)) (cdr body)) | 2962 (cons (nth 1 (car body)) (cdr body)) |
2964 (cons tmp body)))) | 2963 (cons tmp body)))) |
2965 (or (eq output-type 'file) | 2964 (or (eq output-type 'file) |
2966 (not (delq nil (mapcar 'consp (cdr (car body)))))))) | 2965 (notany #'consp (cdar body))))) |
2967 (setq rest (cdr rest))) | 2966 (setq rest (cdr rest))) |
2968 rest)) | 2967 rest)) |
2969 (let ((byte-compile-vector (byte-compile-constants-vector))) | 2968 (let ((byte-compile-vector (byte-compile-constants-vector))) |
2970 (list 'byte-code (byte-compile-lapcode byte-compile-output) | 2969 (list 'byte-code (byte-compile-lapcode byte-compile-output) |
2971 byte-compile-vector byte-compile-maxdepth))) | 2970 byte-compile-vector byte-compile-maxdepth))) |
3812 ((<= (length form) 256) | 3811 ((<= (length form) 256) |
3813 (mapc 'byte-compile-form (cdr form)) | 3812 (mapc 'byte-compile-form (cdr form)) |
3814 (if (cdr (cdr form)) | 3813 (if (cdr (cdr form)) |
3815 (byte-compile-out 'byte-insertN (length (cdr form))) | 3814 (byte-compile-out 'byte-insertN (length (cdr form))) |
3816 (byte-compile-out 'byte-insert 0))) | 3815 (byte-compile-out 'byte-insert 0))) |
3817 ((memq t (mapcar 'consp (cdr (cdr form)))) | 3816 ((some #'consp (cddr form)) |
3818 (byte-compile-normal-call form)) | 3817 (byte-compile-normal-call form)) |
3819 ;; We can split it; there is no function call after inserting 1st arg. | 3818 ;; We can split it; there is no function call after inserting 1st arg. |
3820 (t | 3819 (t |
3821 (while (setq form (cdr form)) | 3820 (while (setq form (cdr form)) |
3822 (byte-compile-form (car form)) | 3821 (byte-compile-form (car form)) |
4667 ;; the function it is being aliased to. | 4666 ;; the function it is being aliased to. |
4668 (defun byte-compile-defalias-warn (new alias) | 4667 (defun byte-compile-defalias-warn (new alias) |
4669 (let ((calls (assq new byte-compile-unresolved-functions))) | 4668 (let ((calls (assq new byte-compile-unresolved-functions))) |
4670 (if calls | 4669 (if calls |
4671 (setq byte-compile-unresolved-functions | 4670 (setq byte-compile-unresolved-functions |
4672 (delq calls byte-compile-unresolved-functions))))) | 4671 (delete* calls byte-compile-unresolved-functions))))) |
4673 | 4672 |
4674 ;;; tags | 4673 ;;; tags |
4675 | 4674 |
4676 ;; Note: Most operations will strip off the 'TAG, but it speeds up | 4675 ;; Note: Most operations will strip off the 'TAG, but it speeds up |
4677 ;; optimization to have the 'TAG as a part of the tag. | 4676 ;; optimization to have the 'TAG as a part of the tag. |