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.
- Emacs 28.1
ag
orfind
Put the following in your init file:
(use-package elisp-scan
:straight (elisp-scan
:type git
:host github
:repo "KarimAziev/elisp-scan"))
Or download the repository and add it to your load-path
.
(add-to-list 'load-path "/path/to/elisp-scan/")
(require 'elisp-scan)
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 aselisp-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 |
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.
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.