From: Hans BKK <hansbkk@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Generating a listing of all symbols (16K+) and labeling subsets
Date: Tue, 22 Apr 2014 21:11:36 -0700 (PDT) [thread overview]
Message-ID: <51a18e1e-5537-466a-afcc-baa34235d5a6@googlegroups.com> (raw)
In-Reply-To: <38d1beb3-fffd-4718-ae10-be9646ac4a63@googlegroups.com>
On Friday, April 18, 2014 1:15:38 AM UTC-4, Hans BKK wrote:
> To that end I'd like to generate standardized-format text "symbols
> reports" on the relevant values of all functions, variables, key
> bindings etc, so that I can do A-B comparison via diff between stock
> vanilla emacs vs after installing these bundles, or in fact any
> packages in the future.
Updated code, now including docstrings and variable values (including for functions)
Will likely kill the final "(t / leftovers / other (misc) symbol" bucket if it's true changes in that category are unlikely to be of interest.
Exploring the code and resulting output has been a decent learning exercise in its own right.
Any and all feedback welcome.
----------------------
(defun macrop (object)
"Non-nil if and only if OBJECT is a macro."
(let ((def (indirect-function object t)))
(when (consp def)
(or (eq 'macro (car def))
(and (autoloadp def) (memq (nth 4 def) '(macro t)))))))
(defun list-hh-symbols ()
"Display a list of Emacs symbols and their docstrings"
(interactive)
(message "Looking up all symbols...")
(with-output-to-temp-buffer "*List Symbols*"
(let (vars)
(mapatoms (function (lambda (sym)
(setq vars (cons sym vars)))))
(setq vars (sort vars 'string-lessp))
(while vars
(let ((sym (car vars)))
(cond
((fboundp sym) ; ALL functions
(cond
((commandp sym) ; interactive commands
(cond
((keymapp sym)
(princ "=================\n")
(unless (documentation sym)
(princ "\n"))
(princ "command - keymap: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
((subrp (symbol-function sym))
(princ "=============================\n")
(unless (documentation sym)
(princ "\n"))
(princ "command - built-in primitive: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
((byte-code-function-p (symbol-function sym))
(princ "====================\n")
(unless (documentation sym)
(princ "\n"))
(princ "command - byte-code: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
((functionp sym)
(princ "================\n")
(unless (documentation sym)
(princ "\n"))
(princ "command - elisp: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
(t
(princ "==============\n")
(unless (documentation sym)
(princ "\n"))
(princ "other command: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
)
)
(t ; non-interactive functions
(cond
((macrop sym)
(princ "================\n")
(unless (documentation sym)
(princ "\n"))
(princ "function - macro: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
((keymapp sym)
(princ "==================\n")
(unless (documentation sym)
(princ "\n"))
(princ "function - keymap: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
((subrp (symbol-function sym))
(princ "==============================\n")
(unless (documentation sym)
(princ "\n"))
(princ "function - built-in primitive: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
((byte-code-function-p (symbol-function sym))
(princ "=====================\n")
(unless (documentation sym)
(princ "\n"))
(princ "function - byte-code: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
((functionp sym)
(princ "=================\n")
(unless (documentation sym)
(princ "\n"))
(princ "function - elisp: ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
(t
(princ "============================\n")
(unless (documentation sym)
(princ "\n"))
(princ "other ~function (aliases??): ")
(prin1 sym)
(princ "\n\n")
(when (documentation sym)
(princ (substitute-command-keys
(documentation sym)))
(princ "\n\n"))
(when (boundp sym)
(princ "-------\n")
(princ "as value: ")
(prin1 (symbol-value sym))
(princ "\n\n"))
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n"))
(when (documentation sym)
(princ "\n"))
)
)
)
)
)
((boundp sym) ; ALL variables
(cond
((custom-variable-p sym)
(princ "=====================\n")
(unless (documentation-property sym
'variable-documentation)
(princ "\n"))
(princ "user (custom) option: ")
(prin1 sym)
(princ "\n\n")
(princ "---------------------\n")
(princ "value: ")
(prin1 (symbol-value sym))
(princ "\n\n")
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n\n"))
)
((keywordp sym)
(princ "========\n")
(princ "\n")
(princ "keyword: ")
(prin1 sym)
(princ "\n\n")
)
(t
(princ "=========================\n")
(unless (documentation-property sym
'variable-documentation)
(princ "\n"))
(princ "non-user (setq) variable: ")
(prin1 sym)
(princ "\n\n")
(princ "-------------------------\n")
(princ "value: ")
(prin1 (symbol-value sym))
(princ "\n\n")
(when (documentation-property sym
'variable-documentation)
(princ (substitute-command-keys
(documentation-property sym
'variable-documentation)))
(princ "\n\n\n")))
)
)
((facep sym)
(princ "=====\n")
(princ "\n")
(princ "face: ")
(prin1 sym)
(princ "\n\n")
)
(t
(princ "====================\n")
(princ "\n")
(princ "other (misc) symbol: ")
(prin1 sym)
(princ "\n\n")
)
)
(setq vars (cdr vars))))
(message "Looking up all symbols...done")
(with-current-buffer "*List Symbols*"
(setq buffer-read-only t)))))
;;;;;;;;;;;;;;;;;;;;;;;
(provide 'list-hh-symbols)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; list-hh-symbols.el ends here
next prev parent reply other threads:[~2014-04-23 4:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-18 5:15 Generating a listing of all symbols (16K+) and labeling subsets Hans BKK
2014-04-18 19:01 ` Hans BKK
2014-04-18 20:47 ` Nicolas Richard
2014-04-19 1:23 ` Hans BKK
2014-04-19 2:16 ` John Mastro
2014-04-19 2:25 ` Hans BKK
2014-04-19 2:50 ` Hans BKK
2014-04-19 4:24 ` Drew Adams
2014-04-19 20:15 ` Hans BKK
2014-04-23 4:11 ` Hans BKK [this message]
2014-04-23 7:40 ` Florian v. Savigny
[not found] ` <<874n1klchv.fsf@bertrandrussell.Speedport_W_723V_1_32_000>
2014-04-23 15:07 ` Drew Adams
2014-04-23 13:22 ` Hans BKK
2014-04-24 2:30 ` Hans BKK
-- strict thread matches above, loose matches on Subject: below --
2014-04-18 2:34 hansbkk
2014-04-18 2:09 hansbkk
2014-04-18 7:19 ` Thien-Thi Nguyen
2014-04-18 10:09 ` Thorsten Jolitz
[not found] ` <mailman.19825.1397815734.10748.help-gnu-emacs@gnu.org>
2014-04-18 15:00 ` Hans BKK
[not found] ` <mailman.19813.1397805348.10748.help-gnu-emacs@gnu.org>
2014-04-18 14:55 ` Hans BKK
2014-04-18 15:27 ` Nicolas Richard
2014-04-19 16:34 ` Robert Thorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51a18e1e-5537-466a-afcc-baa34235d5a6@googlegroups.com \
--to=hansbkk@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.