Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/karimaziev/prettier-elisp

Minor mode to format emacs lisp code
https://github.com/karimaziev/prettier-elisp

emacs

Last synced: 4 days ago
JSON representation

Minor mode to format emacs lisp code

Awesome Lists containing this project

README

        

#+OPTIONS: ^:nil tags:nil num:nil

* About

A minor mode for formatting Emacs Lisp code.

[[./prettier-elisp-demo.gif]]

* Table of Contents :TOC_2_gh:QUOTE:
#+BEGIN_QUOTE
- [[#about][About]]
- [[#requirements][Requirements]]
- [[#installation][Installation]]
- [[#with-use-package-and-straightel][With use-package and straight.el]]
- [[#manual-installation][Manual installation]]
- [[#usage][Usage]]
- [[#customization][Customization]]
#+END_QUOTE

* Requirements

| Name | Version |
|-------+---------|
| Emacs | 27.1 |

* Installation

** With use-package and straight.el
#+begin_src elisp :eval no
(use-package prettier-elisp
:straight (prettier-elisp
:type git
:host github
:repo "KarimAziev/prettier-elisp")
:hook ((emacs-lisp-mode . prettier-elisp-mode)))
#+end_src

** Manual installation

Download the source code and put it in a location of your choice, e.g., into =~/.emacs.d/prettier-elisp/=:

#+begin_src shell :eval no
git clone https://github.com/KarimAziev/prettier-elisp.git ~/.emacs.d/prettier-elisp/
#+end_src

Add the downloaded directory to the load path:

#+begin_src elisp :eval no
(add-to-list 'load-path "~/.emacs.d/prettier-elisp/")
(require 'prettier-elisp)
#+end_src

* Usage

- =M-x prettier-elisp-mode= - Toggle automatic formatting of the current definition before saving the buffer.
- =M-x prettier-elisp-buffer-mode= - Toggle automatic formatting of the whole buffer before saving.
- =M-x prettier-elisp= - Manually format the current function definition.
- =M-x prettier-elisp-buffer= - Manually format the entire buffer.

* Customization

#+begin_quote
[!NOTE]

You may also want to adjust the value of the =fill-column= variable.
#+end_quote

- ~prettier-elisp-buffer-post-format-hooks~ - Hooks to run after formatting the whole buffer.
- ~prettier-elisp-pre-format-hooks~ - Hooks to run before formatting.