Skip to content

conao3/ppp.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://raw.githubusercontent.com/conao3/files/master/blob/headers/png/ppp.el.png https://img.shields.io/github/license/conao3/ppp.el.svg?style=flat-square https://img.shields.io/github/tag/conao3/ppp.el.svg?style=flat-square https://github.com/conao3/ppp.el/workflows/Main%20workflow/badge.svg https://img.shields.io/codacy/grade/62a36f4f04524d5e8c758440e8071c45.svg?logo=codacy&style=flat-square https://img.shields.io/badge/patreon-become%20a%20patron-orange.svg?logo=patreon&style=flat-square https://img.shields.io/badge/twitter-@conao__3-blue.svg?logo=twitter&style=flat-square https://img.shields.io/badge/chat-on_slack-blue.svg?logo=slack&style=flat-square

Table of Contents

Description

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.

Install

Below install snippet using leaf.el

(leaf ppp :ensure t)

Usage

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.

Customize

(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)

Information

Donation

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!

https://c5.patreon.com/external/logo/become_a_patron_button.png

Community

All feedback and suggestions are welcome!

You can use github issues, but you can also use Slack if you want a more casual conversation.

Contribution

We welcome PR!

Require tools for testing

  • cask
    • install via brew
      brew install cask
              
    • manual install
      cd ~/
      hub clone cask/cask
      export PATH="$HOME/.cask/bin:$PATH"
              

Running test

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

Migration

ppp v1.0 to ppp v2.0

Define ppp-minimum-warning-level-alist instead of ppp-minimum-warning-level-base

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.

License

General Public License Version 3 (GPLv3)
Copyright (c) Naoya Yamashita - https://conao3.com
https://github.com/conao3/ppp.el/blob/master/LICENSE

Author

Contributors

About

Extended pretty printer for Emacs Lisp

Resources

License

Stars

Watchers

Forks

Packages

No packages published