1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
Code:
(lambda ()
(emacs-lisp-mode)
(let ((code (read (current-buffer))))
(erase-buffer)
(pp-emacs-lisp-code code)
(untabify (point-min) (point-max))))
Name: code-formats1
=-=
(defun foo (bar)
"Yes."
(let ((a 1)
(b 2))
(zot 1 2 (funcall bar 2))))
=-=-=
Name: code-formats2
=-=
(defun pp-emacs-lisp-code (sexp)
"Insert SEXP into the current buffer, formatted as Emacs Lisp code."
(require 'edebug)
(let ((start (point))
(standard-output (current-buffer)))
(pp--insert-lisp sexp)
(insert "\n")
(goto-char start)
(indent-sexp)))
=-=-=
Name: code-formats3
=-=
(defun foo (bar)
"Yes."
(let ((a 1)
(b 2))
(zot-zot-zot-zot-zot-zot 1 2 (funcall
bar-bar-bar-bar-bar-bar-bar-bar-bar-bar
2))))
=-=-=
Name: code-formats4
=-=
(defun foo (bar)
"Yes."
(let ((a 1)
(b 2)
foo bar zotfoo bar zotfoo bar zotfoo bar zotfoo bar zotfoo bar zotfoo
bar zot)
(zot 1 2 (funcall bar 2))))
=-=-=
Name: code-formats5
=-=
(defgroup pp ()
"Pretty printer for Emacs Lisp."
:prefix "pp-"
:group 'lisp)
=-=-=
Name: code-formats6
=-=
(defcustom pp-escape-newlines t
"Value of `print-escape-newlines' used by pp-* functions."
:type 'boolean
:group 'pp)
=-=-=
Name: code-formats7
=-=
(defun pp (object &optional stream)
(princ (pp-to-string object) (or stream standard-output)))
=-=-=
Name: code-formats8
=-=
(defun pp-eval-expression (expression)
"Evaluate EXPRESSION and pretty-print its value.
Also add the value to the front of the list in the variable `values'."
(interactive (list (read--expression "Eval: ")))
(message "Evaluating...")
(let ((result (eval expression lexical-binding)))
(values--store-value result)
(pp-display-expression result "*Pp Eval Output*")))
=-=-=
Name: code-formats9
=-=
(lambda ()
(interactive)
1)
=-=-=
Name: code-formats10
=-=
(funcall foo (concat "zot" (if (length> site 0) site
"bar")
"+"
(string-replace " " "+" query)))
=-=-=
Name: code-formats11
=-=
(lambda ()
[(foo bar) (foo bar)])
=-=-=
Name: code-formats12
=-=
(global-set-key (kbd "s-x") #'kill-region)
=-=-=
Name: code-formats13
=-=
'("a")
=-=-=
Name: code-formats14
=-=
'("a" . "b")
=-=-=
|