Mercurial > hg > xemacs-beta
annotate lisp/callers-of-rpt.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 | 308d34e9f07d |
children |
rev | line source |
---|---|
428 | 1 ;;; callers-of-rpt.el --- generate call graph of lisp in XEmacs |
2 | |
3 ;; Copyright (C) 1997 Karl Hegbloom | |
4 ;; Copyright (C) 1997 Free Software Foundation, Inc. | |
5 | |
6 ;; Author: Karl Hegbloom <karlheg@inetarena.com> | |
7 ;; Maintainer: XEmacs Development Team | |
8 ;; Keywords: internal | |
9 | |
10 ;; This file is part of XEmacs. | |
11 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
428
diff
changeset
|
12 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
428
diff
changeset
|
13 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
428
diff
changeset
|
14 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
428
diff
changeset
|
15 ;; option) any later version. |
428 | 16 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
428
diff
changeset
|
17 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
428
diff
changeset
|
18 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
428
diff
changeset
|
19 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
428
diff
changeset
|
20 ;; for more details. |
428 | 21 |
22 ;; You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
428
diff
changeset
|
23 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
428 | 24 |
25 ;;; Synched up with: not in FSF | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;; Grep-2.1 is required. | |
30 ;; Modify the `xemacs-src-lisp-dir' and `xemacs-pkg-lisp-dir' to reflect | |
31 ;; where these directories live on your local system. | |
32 | |
33 ;;; Code: | |
34 | |
35 (defvar xemacs-src-lisp-dir "/usr/src/xemacs-20.0/lisp/" | |
36 "Where the XEmacs 20 lisp sources live.") | |
37 (defvar xemacs-pkg-lisp-dir "/home/xemacs/packages/" | |
38 "Where the package lisp sources live.") | |
39 | |
40 ;; (makunbound 'caller-table) | |
41 (defconst caller-table (make-hash-table :test 'equal) | |
42 "Hash table keyed on the symbols being required. Each element will | |
43 be a list of file-names of programs that depend on them.") | |
44 | |
45 ;;./apel/atype.el:(require 'emu) | |
46 ;;./apel/atype.el:(require 'alist) | |
47 ;;./apel/emu-e19.el: (require 'emu-xemacs)) | |
48 ;;./apel/emu-e19.el: (require 'emu-19) | |
49 | |
50 (defun make-caller-report () | |
51 "Generate a simple report showing .el files that are `require'd by | |
52 other .el files, and the list of programs that depend on them." | |
53 (interactive) | |
54 (let ((cmd-out (get-buffer-create "*caller-report find-grep output*")) | |
55 (rpt (get-buffer-create "* caller report *")) | |
56 file-name) | |
57 (switch-to-buffer cmd-out) | |
58 (buffer-disable-undo cmd-out) | |
59 (set-syntax-table emacs-lisp-mode-syntax-table cmd-out) | |
60 (erase-buffer cmd-out) | |
61 (message "Running the find | grep...") | |
62 (sit-for 0) | |
63 ;; Note: Edit this part as needed for your installation. | |
64 (shell-command (concat | |
65 ;; First the installed lisp | |
66 "cd " xemacs-src-lisp-dir " ;" | |
67 "grep -H '(require ' $(find -name '*.el' -print) |" | |
68 " grep -v 'auto-autoloads\\.el\\|callers-of-rpt\\.el' |" | |
69 " grep -v 'el:[ \t]*;\\|require load' ;" ; ones commented off, and cus-edit.el | |
70 ;; Then the packages | |
71 "cd " xemacs-pkg-lisp-dir " ;" | |
72 "grep -H '(require ' $(find -name '*.el' -print) |" | |
73 " grep -v 'auto-autoloads\\.el\\|callers-of-rpt\\.el' |" | |
74 " grep -v 'el:[ \t]*;' ;" ; ones commented off | |
75 ) | |
76 cmd-out) | |
77 (message "Running the find | grep... Done.") | |
78 (goto-char (point-min)) | |
79 (sit-for 0) | |
80 (while (not (eobp)) | |
81 (setq file-name (buffer-substring (+ (point) 2) ; skip the leading "./" | |
82 (progn | |
83 (skip-chars-forward "^:") | |
84 (point)) | |
85 cmd-out)) | |
86 (re-search-forward "(require '" nil t) | |
87 (let* ((key (buffer-substring (point) (progn | |
88 (skip-chars-forward "^) ") | |
89 (point)) | |
90 cmd-out)) | |
91 (lst (gethash key caller-table))) | |
92 (unless (member file-name lst) | |
93 (puthash key (cons file-name lst) caller-table))) | |
94 (forward-line 1) | |
95 (sit-for 0)) | |
96 (switch-to-buffer rpt) | |
97 (buffer-disable-undo rpt) | |
98 (erase-buffer rpt) | |
99 (sit-for 0) | |
100 (let (keys) | |
101 (maphash #'(lambda (key val) (push key keys)) caller-table) | |
102 (setq keys (sort keys #'string<)) | |
103 (mapc #'(lambda (key) | |
104 (insert (format "(%s '(" key)) | |
105 (let ((lst (gethash key caller-table))) | |
106 (while lst | |
107 (insert (format "%S" (car lst))) | |
108 (setq lst (cdr lst)) | |
109 (when lst (insert " ")))) | |
110 (insert "))\n") | |
111 (sit-for 0)) | |
112 keys)))) | |
113 | |
114 (byte-compile 'make-caller-report) | |
115 (delete-other-windows) | |
116 (make-caller-report) | |
117 | |
118 ;;; callers-of-rpt.el ends here |