From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hans BKK Newsgroups: gmane.emacs.help Subject: Re: Generating a listing of all symbols (16K+) and labeling subsets Date: Tue, 22 Apr 2014 21:11:36 -0700 (PDT) Message-ID: <51a18e1e-5537-466a-afcc-baa34235d5a6@googlegroups.com> References: <38d1beb3-fffd-4718-ae10-be9646ac4a63@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1398226527 16189 80.91.229.3 (23 Apr 2014 04:15:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Apr 2014 04:15:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 23 06:15:20 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wcoae-0003Mw-Gg for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Apr 2014 06:15:20 +0200 Original-Received: from localhost ([::1]:58539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wcoad-0001QS-OP for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Apr 2014 00:15:19 -0400 X-Received: by 10.236.29.51 with SMTP id h39mr21457581yha.45.1398226296947; Tue, 22 Apr 2014 21:11:36 -0700 (PDT) X-Received: by 10.182.40.195 with SMTP id z3mr5916obk.34.1398226296777; Tue, 22 Apr 2014 21:11:36 -0700 (PDT) Original-Path: usenet.stanford.edu!cm18no5469002qab.0!news-out.google.com!en3ni276igc.0!nntp.google.com!c1no2403230igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <38d1beb3-fffd-4718-ae10-be9646ac4a63@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2602:306:334f:a5e0:81db:f077:ec84:39f6; posting-account=IUdGewoAAACF9WtA3i8stuVyXNk2FqaH Original-NNTP-Posting-Host: 2602:306:334f:a5e0:81db:f077:ec84:39f6 User-Agent: G2/1.0 Injection-Date: Wed, 23 Apr 2014 04:11:36 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:205052 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97318 Archived-At: 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