annotate lisp/utils/pretty-print.el @ 112:48d667d6f17f r20-1b8

Import from CVS: tag r20-1b8
author cvs
date Mon, 13 Aug 2007 09:20:48 +0200
parents 360340f9fd5f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
1 ;; -*- Syntax: Emacs-Lisp; Mode: emacs-lisp -*-
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
2 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
3 ;; Emacs Lisp pretty printer and macro expander
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
4 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
5 ;; Copyright (C) 1992,1993 Guido Bosch <Guido.Bosch@loria.fr>
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
6
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
7 ;; This file is written in GNU Emacs Lisp, but is not part of GNU Emacs.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
8
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
9 ;; This file is part of XEmacs.
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
10
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
12 ;; under the terms of the GNU General Public License as published by
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
14 ;; any later version.
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
15
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
19 ;; General Public License for more details.
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
20
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
24 ;; 02111-1307, USA.
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
25
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
26 ;;; Synched up with: Not in FSF.
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 72
diff changeset
27
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
28 ;; Please send bugs and comments to the author.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
29 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
30 ;; <DISCLAIMER>
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
31 ;; This program is still under development. Neither the author nor
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
32 ;; CRIN-INRIA accepts responsibility to anyone for the consequences of
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
33 ;; using it or for whether it serves any particular purpose or works
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
34 ;; at all.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
35 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
36 ;; The package has been developed under Lucid Emacs 19, but also runs
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
37 ;; on Emacs 18, if it is compiled with the version 19 byte compiler
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
38 ;; (function `compiled-function-p' lacking).
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
39 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
40
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
41 ;; Installation and Usage
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
42 ;; ----------------------
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
43 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
44 ;; This package provides an Emacs Lisp sexpression pretty printer and
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
45 ;; macroexpander. To install it, put the following line in your .emacs,
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
46 ;; default.el or site-init.el/site-run.el (for Lucid Emacs):
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
47 ;; (require 'pp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
48 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
49 ;; The package can also be made autoloadable, with the following entry
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
50 ;; points:
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
51 ;; (autoload 'pp-function "pp" nil t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
52 ;; (autoload 'pp-variable "pp" nil t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
53 ;; (autoload 'pp-plist "pp" nil t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
54 ;; (autoload 'macroexpand-sexp "pp" nil t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
55 ;; (autoload 'macroexpand-all-sexp "pp" nil t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
56 ;; (autoload 'prettyexpand-sexp "pp" nil t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
57 ;; (autoload 'prettyexpand-all-sexp "pp" nil t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
58 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
59 ;;(define-key emacs-lisp-mode-map '(control meta m) 'macroexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
60 ;;(define-key emacs-lisp-mode-map '(control meta M) 'macroexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
61 ;;(define-key emacs-lisp-mode-map '(control symbol m) 'prettyexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
62 ;;(define-key emacs-lisp-mode-map '(control symbol M) 'prettyexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
63 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
64 ;;(define-key lisp-interaction-mode-map '(control meta m) 'macroexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
65 ;;(define-key lisp-interaction-mode-map '(control meta M) 'macroexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
66 ;;(define-key lisp-interaction-mode-map '(control symbol m) 'prettyexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
67 ;;(define-key lisp-interaction-mode-map '(control symbol M) 'prettyexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
68 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
69
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
70 ;; Pretty printing of the different cells of a symbol is done with the
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
71 ;; commands:
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
72 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
73 ;; M-x pp-function
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
74 ;; M-x pp-variable
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
75 ;; M-x pp-plist
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
76 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
77 ;; They print a symbol's function definition, variable value and
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
78 ;; property list, respectively. These commands pop up a separate
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
79 ;; window in which the pretty printed lisp object is displayed.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
80 ;; Completion for function and variable symbols is provided. If a
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
81 ;; function is byte compiled, `pp-function' proposes to call the Emacs
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
82 ;; Lisp disassembler (this feature only works for Emacs 19, as it
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
83 ;; needs the `compiled-function-p' predicate).
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
84 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
85 ;; To use the macro expander, put the cursor at the beginning of the
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
86 ;; form to be expanded, then type
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
87 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
88 ;; C-M-m (macroexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
89 ;; or C-M-Sh-M (macroexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
90 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
91 ;; Both commands will pop up a temporary window containing the
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
92 ;; macroexpanded code. The only difference is that the second command
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
93 ;; expands recursively all containing macro calls, while the first one
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
94 ;; does it only for the uppermost sexpression.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
95 ;; With a prefix argument, the macro expansion isn't displayed in a
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
96 ;; separate buffer but replaces the original code in the current
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
97 ;; buffer. Be aware: Comments will be lost.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
98 ;; You can get back the original sexpression using the `undo'
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
99 ;; command on `C-x u'.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
100 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
101 ;; There is also a prettyfied version of the macroexpander:
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
102 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
103 ;; C-Sym-m (prettyexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
104 ;; or C-Sym-M (prettyexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
105 ;;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
106 ;; The only difference with the corresponding macroexpand commands is
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
107 ;; that calls to macros specified in the variable
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
108 ;; `pp-shadow-expansion-list' are not expanded, in order to make the
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
109 ;; code look nicer. This is only useful for Lucid Emacs or code that
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
110 ;; uses Dave Gillespies cl package, as it inhibits expansion of the
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
111 ;; following macros: block, eval-when, defun*, defmacro*, function*,
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
112 ;; setf.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
113
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
114 ; Change History
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
115 ;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
116 ; $Log: pretty-print.el,v $
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 78
diff changeset
117 ; Revision 1.3 1997/03/08 23:27:00 steve
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 78
diff changeset
118 ; Patches to Beta6
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
119 ;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
120 ; Revision 1.4 1993/03/25 14:09:52 bosch
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
121 ; Commands `prettyexpand-sexp' and `prettyexpand-all-sexp' and
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
122 ; corresponding key bindings added. Commands pp-{function, variable}
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
123 ; rewritten. `pp-plist' added. Function `pp-internal-loop' (for Dave
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
124 ; Gillespies CL loop macro) added.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
125 ;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
126 ; Revision 1.3 1993/03/03 12:24:13 bosch
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
127 ; Macroexpander rewritten. Function `pp-macroexpand-all' added (snarfed
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
128 ; from Dave Gillespies cl-extra.el). Pretty printing for top level
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
129 ; defining forms added (`pp-internal-def'). Key bindings for
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
130 ; `emacs-lisp-mode-map' and `lisp-interaction-mode-map' added. Built-in
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
131 ; variable `print-gensym' set for printinng uninterned symbols. Started
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
132 ; adding support for cl-dg (defun*, defmacro*, ...). Minor bug fixes.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
133 ;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
134 ; Revision 1.2 1993/02/25 17:35:02 bosch
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
135 ; Comments about Emacs 18 compatibility added.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
136 ;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
137 ; Revision 1.1 1993/02/25 16:55:01 bosch
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
138 ; Initial revision
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
139 ;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
140 ;
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
141
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
142
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
143 ;; TO DO LIST
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
144 ;; ----------
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
145 ;; Provide full Emacs 18 compatibility.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
146
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
147 ;; Popper support
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
148 (defvar pp-buffer-name "*Pretty Print*")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
149 (defvar pp-macroexpand-buffer-name "*Macro Expansion*")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
150 (if (featurep 'popper)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
151 (or (eq popper-pop-buffers 't)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
152 (setq popper-pop-buffers
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
153 (cons pp-buffer-name
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
154 (cons pp-macroexpand-buffer-name
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
155 popper-pop-buffers)))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
156
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
157 ;; User level functions
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
158 ;;;###autoload
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
159 (defun pp-function (symbol)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 78
diff changeset
160 "Pretty print the function definition of SYMBOL in a separate buffer"
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
161 (interactive
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
162 (list (pp-read-symbol 'fboundp "Pretty print function definition of: ")))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
163 (if (compiled-function-p (symbol-function symbol))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
164 (if (y-or-n-p
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
165 (format "Function %s is byte compiled. Disassemble? " symbol))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
166 (disassemble (symbol-function symbol))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
167 (pp-symbol-cell symbol 'symbol-function))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
168 (pp-symbol-cell symbol 'symbol-function)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
169
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
170 ;;;###autoload
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
171 (defun pp-variable (symbol)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 78
diff changeset
172 "Pretty print the variable value of SYMBOL in a separate buffer"
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
173 (interactive
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
174 (list (pp-read-symbol 'boundp "Pretty print variable value of: ")))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
175 (pp-symbol-cell symbol 'symbol-value))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
176
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
177 ;;;###autoload
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
178 (defun pp-plist (symbol)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 78
diff changeset
179 "Pretty print the property list of SYMBOL in a separate buffer"
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
180 (interactive
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
181 (list (pp-read-symbol 'symbol-plist "Pretty print property list of: ")))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
182 (pp-symbol-cell symbol 'symbol-plist))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
183
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
184 (defun pp-read-symbol (predicate prompt)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
185 "Read a symbol for which PREDICATE is true, promptiong with PROMPT."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
186 (let (symbol)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
187 (while (or (not symbol) (not (funcall predicate symbol)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
188 (setq symbol
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
189 (intern-soft
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
190 (completing-read
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
191 prompt
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
192 obarray
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
193 predicate
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
194 t
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
195 (and symbol (symbol-name symbol))))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
196 symbol))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
197
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
198 (defun pp-symbol-cell (symbol accessor)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
199 "Pretty print the contents of the cell of SYMBOL that can be reached
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
200 with the function ACCESSOR."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
201 (with-output-to-temp-buffer pp-buffer-name
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
202 (set-buffer pp-buffer-name)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
203 (emacs-lisp-mode)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
204 (erase-buffer)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
205 (pp-internal
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
206 (funcall accessor symbol)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
207 (format "%s's %s is:\n" symbol accessor))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
208 (terpri)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
209
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
210
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
211
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
212 ;; Macro expansion (user level)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
213
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
214 ;;;###autoload
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
215 (defun macroexpand-sexp (&optional replace)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
216 "Macro expand the sexpression following point. Pretty print expansion in a
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
217 temporary buffer. With prefix argument, replace the original
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
218 sexpression by its expansion in the current buffer."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
219 (interactive "P")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
220 (pp-macroexpand-internal 'macroexpand replace t))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
221
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
222 ;;;###autoload
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
223 (defun macroexpand-all-sexp (&optional replace)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
224 "Macro expand recursively the sexpression following point. Pretty print
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
225 expansion in a temporary buffer. With prefix argument, replace the
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
226 original sexpression by its expansion in the current buffer."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
227 (interactive "P")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
228 (pp-macroexpand-internal 'pp-macroexpand-all replace t))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
229
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
230 ;;;###autoload
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
231 (defun prettyexpand-sexp (&optional replace)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
232 "Macro expand the sexpression following point. Pretty print expansion
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
233 in a temporary buffer. With prefix argument, replace the original
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
234 sexpression by its expansion in the current buffer.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
235 However, calls to macros specified in the variable
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
236 `pp-shadow-expansion-list' are not expanded, in order to make the code
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
237 look nicer."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
238
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
239 (interactive "P")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
240 (pp-macroexpand-internal 'macroexpand replace))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
241
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
242 ;;;###autoload
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
243 (defun prettyexpand-all-sexp (&optional replace)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
244 "Macro expand recursively the sexpression following point. Pretty print
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
245 expansion in a temporary buffer. With prefix argument, replace the
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
246 original sexpression by its expansion in the current buffer.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
247 However, calls to macros specified in the variable
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
248 `pp-shadow-expansion-list' are not expanded, in order to make the code
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
249 look nicer."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
250 (interactive "P")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
251 (pp-macroexpand-internal 'pp-macroexpand-all replace))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
252
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
253 (define-key emacs-lisp-mode-map '(control meta m) 'macroexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
254 (define-key emacs-lisp-mode-map '(control meta M) 'macroexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
255 (define-key emacs-lisp-mode-map '(control symbol m) 'prettyexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
256 (define-key emacs-lisp-mode-map '(control symbol M) 'prettyexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
257
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
258 (define-key lisp-interaction-mode-map '(control meta m) 'macroexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
259 (define-key lisp-interaction-mode-map '(control meta M) 'macroexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
260 (define-key lisp-interaction-mode-map '(control symbol m) 'prettyexpand-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
261 (define-key lisp-interaction-mode-map '(control symbol M) 'prettyexpand-all-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
262
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
263
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
264 ;; Macro expansion (internals)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
265
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
266 (defvar pp-shadow-expansion-list
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
267 (mapcar 'list '(block eval-when defun* defmacro* function* setf))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
268 "The value of this variable is given as the optional environment
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
269 argument of the macroexpand functions. Forms specified in this list are
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
270 not expanded.")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
271
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
272 (defun pp-macroexpand-internal
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
273 (macroexpand-function replace &optional dont-shadow)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
274 "Macro expand the sexp that starts at point, using
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
275 MACROEXPAND-FUNCTION. If REPLACE is non-nil, replace the original
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
276 text by its expansion, otherwise pretty print the expansion in a
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
277 temporary buffer. With optional argument DONT-SHADOW non-nil, do not
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
278 use the `pp-shadow-expansion-list' to inhibit expansion of some
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
279 forms."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
280
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
281 (interactive)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
282 (let ((expansion
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
283 (funcall
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
284 macroexpand-function
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
285 (let ((stab (syntax-table)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
286 (unwind-protect
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
287 (save-excursion
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
288 (set-syntax-table emacs-lisp-mode-syntax-table)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
289 ;; (forward-sexp 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
290 (read (current-buffer)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
291 (set-syntax-table stab)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
292 (if dont-shadow
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
293 nil
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
294 pp-shadow-expansion-list))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
295 (save-excursion
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
296 (if replace
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
297 (let ((start (point))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
298 (end (progn (forward-sexp 1) (point))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
299 (delete-region start end)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
300 (pp-internal expansion))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
301 (with-output-to-temp-buffer pp-macroexpand-buffer-name
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
302 (set-buffer pp-macroexpand-buffer-name)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
303 (erase-buffer)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
304 (emacs-lisp-mode)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
305 (pp-internal expansion))))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
306
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
307 ;; Internal pretty print functions
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
308
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
309 (defun pp-internal (form &optional title)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
310 "Pretty print FORM in in the current buffer.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
311 Optional string TITEL is inserted before the pretty print."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
312 (let (start)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
313 (if title (princ title))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
314 (setq start (point))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
315 ;; print-escape-newlines must be t, otherwise we cannot use
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
316 ;; (current-column) to detect good line breaks
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
317 (let ((print-escape-newlines t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
318 (print-gensym t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
319 )
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
320 (prin1 form (current-buffer))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
321 (goto-char start)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
322 (pp-internal-sexp))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
323
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
324 (defun pp-internal-sexp ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
325 "Pretty print the following sexp.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
326 Point must be on or before the first character."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
327
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
328 (skip-chars-forward " \n\t")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
329 (let* ((char (following-char))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
330 (ch-class (char-syntax char))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
331 (start (point)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
332
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
333 (cond
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
334 ;; open paren
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
335 ((eq char ?\()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
336 (down-list 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
337 (if (memq (char-syntax (following-char)) '(?_ ?w))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
338 (let ((symbol (read (current-buffer))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
339 (cond ((fboundp symbol)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
340 (goto-char start)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
341 (pp-internal-function symbol))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
342 ((memq symbol '(lambda macro))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
343 (pp-internal-lambda))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
344 (t
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
345 (goto-char start)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
346 (pp-internal-list))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
347 (up-list -1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
348 (pp-internal-list)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
349
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
350 ;;symbols & strings
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
351 ((memq ch-class '(?_ ; symbol
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
352 ?w ; word
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
353 ?\" ; string
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
354 ?\\ ; escape
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
355 ?\' ; quote (for uninterned symbols)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
356 )) (forward-sexp 1))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
357
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
358 ;; vector
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
359 ((eq char ?\[) (pp-internal-list))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
360
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
361 ;; error otherwise
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
362 (t (error "pp-internal-sexp: character class not treated yet: `%c'"
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
363 ch-class)))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
364
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
365 (defun pp-internal-function (func)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
366 "Pretty print a functuion call.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
367 Point must be on the open paren. the function symbol may be passed as an
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
368 optional argument."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
369 (let ((start (point))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
370 (too-large (>= (save-excursion
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
371 (forward-sexp 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
372 (current-column))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
373 fill-column))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
374 (indent-info (get func lisp-indent-function)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
375 (down-list 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
376 ;; skip over function name
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
377 (forward-sexp 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
378 (cond
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
379 ((memq func '(let let*)) (pp-internal-let))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
380
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
381 ((eq func 'cond) (pp-internal-cond))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
382
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
383 ((memq func '(if while with-output-to-temp-buffer catch block))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
384 (pp-internal-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
385 (pp-internal-body 't))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
386
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
387 ((eq func 'quote) (pp-internal-quote))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
388
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
389 ((memq func '(progn
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
390 prog1 prog2
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
391 save-window-excursion
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
392 save-excursion
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
393 save-restriction))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
394 (pp-internal-body 't))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
395
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
396 ((memq func '(defun defmacro defsubst defun* defmacro*))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
397 (pp-internal-def))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
398
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
399 ((eq func 'loop) (pp-internal-loop))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
400
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
401 ('t (pp-internal-body too-large)))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
402
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
403 (defun pp-internal-def ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
404 (forward-sexp 1) ; skip name
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
405 (if (looking-at " nil") ; replace nil by ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
406 (replace-match " ()")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
407 (forward-sexp 1))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
408 (if (looking-at " \"")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
409 ;; comment string. Replace all escaped linefeeds by real ones
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
410 (let ((limit (save-excursion (forward-sexp 1) (point-marker))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
411 (newline-and-indent)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
412 (while (re-search-forward "\\\\n" limit t)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
413 (replace-match "\n" nil nil))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
414 (goto-char limit)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
415 (pp-internal-body 't))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
416
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
417 (defun pp-internal-list ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
418 "Pretty print a list or a vector.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
419 Point must be on the open paren."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
420 (let ((too-large (>= (save-excursion
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
421 (forward-sexp 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
422 (current-column))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
423 fill-column)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
424 (down-list 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
425 (pp-internal-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
426 (pp-internal-body too-large)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
427
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
428 (defun pp-internal-body (&optional force-indent)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
429 "Prety print a body of sexp. Stop after reaching a `)'. If argument
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
430 FORCE-INDENT is non-nil, break line after each sexpression of the
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
431 body."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
432 (skip-chars-forward " \n\t")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
433 (let (ch-class)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
434 ;; while not closing paren
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
435 (while (/= (setq ch-class (char-syntax (following-char))) ?\))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
436 (if force-indent (newline-and-indent))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
437 (pp-internal-sexp))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
438 (up-list 1)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
439
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
440 (defun pp-internal-loop ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
441 "Prety print a loop body. Stop after reaching a `)'.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
442 Line breaks are done before the following keywords: "
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
443 (forward-sexp 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
444 (skip-chars-forward " \n\t")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
445 (let (ch-class)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
446 ;; while not closing paren
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
447 (while (/= (setq ch-class (char-syntax (following-char))) ?\))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
448 (if (not (looking-at "for\\|repeat\\|with\\|while\\|until\\|always\\|never\\|thereis\\|collect\\|append\\|nconc\\|sum\\|count\\|maximize\\|minimize\\|if\\|when\\|else\\|unless\\|do\\W\\|initially\\|finally\\|return\\|named"))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
449 (pp-internal-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
450 (newline-and-indent)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
451 (forward-sexp 1))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
452 (skip-chars-forward " \n\t"))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
453 (up-list 1)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
454
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
455 (defun pp-internal-body-list ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
456 (let ((too-large (>= (save-excursion
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
457 (forward-sexp 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
458 (current-column))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
459 fill-column))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
460 ch-class)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
461 (down-list 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
462 (pp-internal-sexp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
463 (while (/= (setq ch-class (char-syntax (following-char))) ?\))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
464 (if too-large (newline-and-indent))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
465 (pp-internal-sexp))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
466 (up-list 1)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
467
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
468 (defun pp-internal-lambda ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
469 (forward-sexp 1) ; arguments
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
470 (pp-internal-body 't))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
471
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
472 (defun pp-internal-let ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
473 "Pretty print a let-like form.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
474 Cursor is behind funtion symbol."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
475 (down-list 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
476 (while (not (= (following-char) ?\)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
477 (if (= (following-char) ?\()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
478 (pp-internal-body-list)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
479 (forward-sexp 1))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
480 (if (not (= (following-char) ?\)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
481 (newline-and-indent)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
482 (up-list 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
483 (pp-internal-body 't))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
484
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
485 (defun pp-internal-cond ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
486 "Pretty print a cond-like form.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
487 Cursor is behind funtion symbol."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
488 (skip-chars-forward " \n\t")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
489 (while (not (= (following-char) ?\)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
490 (pp-internal-body-list)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
491 (if (not (= (following-char) ?\)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
492 (newline-and-indent)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
493 (up-list 1))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
494
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
495
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
496 (defun pp-internal-quote ()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
497 "Pretty print a quoted list.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
498 Cursor is behind the symbol quote."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
499 (skip-chars-forward " \n\t")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
500 (let ((end (point)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
501 (backward-sexp 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
502 (delete-region (point) end)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
503 (up-list -1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
504 (setq end (point))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
505 (forward-sexp 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
506 (delete-char -1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
507 (goto-char end)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
508 (delete-char 1)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
509 (insert "'")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
510 (if (= (char-syntax (following-char)) ?\()
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
511 ;; don't print it as sexp, because it could be (let ... ) or
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
512 ;; (cond ... ) or whatever.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
513 (pp-internal-list)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
514 (pp-internal-sexp))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
515
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
516
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
517 ;; Stolen form Dave Gillespies cl-extra.el
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
518 (defun pp-macroexpand-all (form &optional env)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
519 "Expand all macro calls through a Lisp FORM.
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
520 This also does some trivial optimizations to make the form prettier."
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
521 (setq form (macroexpand form env))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
522 (cond
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
523 ((not (consp form)) form)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
524 ((memq (car form) '(let let*))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
525 (if (null (nth 1 form))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
526 (pp-macroexpand-all (cons 'progn (cdr (cdr form))) env)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
527 (cons (car form)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
528 (cons (pp-macroexpand-lets (nth 1 form) env)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
529 (pp-macroexpand-body (cdr (cdr form)) env)))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
530 ((eq (car form) 'cond)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
531 (cons (car form)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
532 (mapcar (function (lambda (x) (pp-macroexpand-body x env)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
533 (cdr form))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
534 ((eq (car form) 'condition-case)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
535 (cons (car form)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
536 (cons (nth 1 form)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
537 (cons (pp-macroexpand-all (nth 2 form) env)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
538 (pp-macroexpand-lets
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
539 (cdr (cdr (cdr form))) env)))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
540 ((memq (car form) '(quote function))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
541 (if (eq (car-safe (nth 1 form)) 'lambda)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
542 (list (car form)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
543 (cons 'lambda
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
544 (cons (car (cdr (car (cdr form))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
545 (pp-macroexpand-body
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
546 (cdr (cdr (car (cdr form)))) env))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
547 form))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
548 ((memq (car form) '(defun defmacro))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
549 (cons (car form)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
550 (cons (nth 1 form)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
551 (pp-macroexpand-body (cdr (cdr form)) env))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
552 ((and (eq (car form) 'progn) (not (cdr (cdr form))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
553 (pp-macroexpand-all (nth 1 form) env))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
554 (t
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
555 (cons (car form) (pp-macroexpand-body (cdr form) env)))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
556
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
557 (defun pp-macroexpand-body (body &optional env)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
558 (mapcar (function (lambda (x) (pp-macroexpand-all x env))) body))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
559
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
560 (defun pp-macroexpand-lets (list &optional env)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
561 (mapcar (function
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
562 (lambda (x)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
563 (if (consp x) (cons (car x) (pp-macroexpand-body (cdr x) env))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
564 x))) list))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
565
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
566 (run-hooks 'pp-load-hook)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
567 (provide 'pp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
568
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents:
diff changeset
569 ;; end pp.el