Extended pretty printer for Emacs Lisp.
Builtin pp.el function princ
and return its string.
When I use these functions in *scratch*
, return value is redundant.
See this example or eval this by C-j
in *scratch*
on your hand.
(pp '(mapcar
(lambda (str)
(message str))
(buffer-list)))
(mapcar
(lambda
(str)
(message str))
(buffer-list))
"(mapcar
(lambda
(str)
(message str))
(buffer-list))
"
(pp '(:plist-key1 value1 :plist-key2 value2 :plist-key3 value3))
(:plist-key1 value1 :plist-key2 value2 :plist-key3 value3)
"(:plist-key1 value1 :plist-key2 value2 :plist-key3 value3)
"
This ppp.el is return values via only princ
.
If you want those string, you can use with-output-to-string
.
This is proper way in Lisp convention.
(But we have prepareted *-to-string
macros,
so you want formatted string, you can use those macros!)
Below snippet is typical example ppp.el usage in *scratch
.
(ppp-sexp '(mapcar
(lambda (str)
(message str))
(buffer-list)))
(mapcar
(lambda (str)
(message str))
(buffer-list))
nil
(ppp-plist '(:plist-key1 value1 :plist-key2 value2 :plist-key3 value3))
(:plist-key1 value1
:plist-key2 value2
:plist-key3 value3)
nil
(ppp-plist-to-string '(:plist-key1 value1 :plist-key2 value2 :plist-key3 value3))
"(:plist-key1 value1
:plist-key2 value2
:plist-key3 value3)
"
And ppp.el have below functions so if you can use proper function to fit your Lisp data structure.
- ppp-sexp
- ppp-macroexpand
- ppp-macroexpand-all
- ppp-list
- ppp-plist
- ppp-alist
- ppp-symbol-function
- ppp-symbol-value
Additionaly, ppp.el output well format than pp.el in many cases.
Please see lambda
argument place in above example.
Below install snippet using leaf.el
(leaf ppp :ensure t)
Just use below functions/macros.
- ppp-sexp
- ppp-macroexpand
- ppp-macroexpand-all
- ppp-list
- ppp-plist
- ppp-alist
- ppp-symbol-function
- ppp-symbol-value
- ppp-debug
And those *-to-string
macros.
(defcustom ppp-escape-newlines t
"Value of `print-escape-newlines' used by ppp-* functions."
:type 'boolean
:group 'ppp)
(defcustom ppp-debug-buffer-template "*PPP Debug buffer - %s*"
"Buffer name for `ppp-debug'."
:group 'ppp
:type 'string)
(defcustom ppp-minimum-warning-level-alist '((t . :warning))
"Minimum level for `ppp-debug'.
The key is package symbol.
The value should be either :debug, :warning, :error, or :emergency.
The value its key is t, is default minimum-warning-level value."
:group 'ppp
:type 'sexp)
I love OSS and I am dreaming of working on it as full-time job.
With your support, I will be able to spend more time at OSS!
All feedback and suggestions are welcome!
You can use github issues, but you can also use Slack if you want a more casual conversation.
We welcome PR!
- cask
- install via brew
brew install cask
- manual install
cd ~/ hub clone cask/cask export PATH="$HOME/.cask/bin:$PATH"
- install via brew
Below operation flow is recommended.
make # Install git-hooks in local .git
git branch [feature-branch] # Create branch named [feature-branch]
git checkout [feature-branch] # Checkout branch named [feature-branch]
# <edit loop>
emacs ppp.el # Edit something you want
make test # Test package via multi version Emacs
git commit -am "brabra" # Commit (auto-run test before commit)
# </edit loop>
hub fork # Create fork at GitHub
git push [user] [feature-branch] # Push feature-branch to your fork
hub pull-request # Create pull-request
Please use ppp-minimum-warning-level-alist
instead of ppp-minimum-warning-level-base
.
Setting the default warning level and declaring new variables for each package didn’t work well with the Elisp byte compiler. The new method uses alist to manage alert levels for each package, so you can manage them in a more familiar and convenient way.
General Public License Version 3 (GPLv3) Copyright (c) Naoya Yamashita - https://conao3.com https://github.com/conao3/ppp.el/blob/master/LICENSE
- Naoya Yamashita (conao3)