Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

Find unused code in Emacs Lisp files.
https://github.com/karimaziev/elisp-scan

emacs-lisp emacs-package emacs-packages

Last synced: 4 days ago
JSON representation

Find unused code in Emacs Lisp files.

Awesome Lists containing this project

README

        

* elisp-scan

Find unused code and print reports for Emacs Lisp files.

~elisp-scan~ use mixed text search - initial "dumb" searching with ~ag~, then parses the code with elisp.

[[./demo.gif][./demo.gif]]

** Requirements

- Emacs 28.1
- ~ag~ or ~find~

** Installation

*** with straight-use-package

Put the following in your init file:

#+begin_src elisp
(use-package elisp-scan
:straight (elisp-scan
:type git
:host github
:repo "KarimAziev/elisp-scan"))
#+end_src

*** Manual

Or download the repository and add it to your ~load-path~.

#+begin_src elisp

(add-to-list 'load-path "/path/to/elisp-scan/")

(require 'elisp-scan)
#+end_src
** Usage

The most straightforward usage is to invoke transient popup ~M-x elisp-scan-menu~ and ~M-x elisp-scan-list-menu~ (in report buffers).

- ~elisp-scan-file~ Scan the Elisp file and show the report.
- ~elisp-scan-dir~ Scan elisp files in the directory and show the report.
- ~elisp-scan-project~ Scan project files and show the report.
- ~elisp-scan-all-unused-defs~ Same as ~elisp-scan-project~ but with predefined filters to show only unused items.

This command will activate =elisp-scan-report-mode= with such bindings:

| Key | Command |
|-----------+-----------------------------------------|
| =RET= | View entry |
| =D= | Remove marked entries or entry at point |
| =K= | Cancel rendering |
| =m= | Mark entry |
| =u= | Unmark entry |
| =C-c C-n= | Move to the next entry start |
| =C-c C-p= | Move to the previous entry start |
| =C-.= | Show transient menu |
| =.= | Show transient menu |
| =?= | Show transient menu |

** Other commands
- ~elisp-scan-rename-symbol~
Rename exact matches of the symbol at the point.
- ~elisp-scan-ivy-read-unused-items~
Read unused definitions of the current file with ivy. To remove one item without exiting the minibuffer, use =C-c C-d=. To remove or back up a batch of items, mark them. With the optional prefix =arg= include only the current file.

** Customizations
- ~elisp-scan-initial-filters~ Initial filters in report list mode.
- ~elisp-scan-permanent-dirs~ In which directories always check usage.
- ~elisp-scan-types-symbols~ List of symbols to check.