Cannon is a simple library to launch Unix
commands written in
Elisp
. It mimics the beloved Dmenu
and targets Emacs
aficionados that have no desired to leave their favorite Lisp Machine
.
If you use Exwm, i.e, Emacs as your X Window Manager
this library will be a good choice to launch X11
applications,
like: mpv
, mupdf
, chromium
, empowering the user experience.
Going into detail, Cannon is a simple lightweight library
that provides executable completions candidates and handles the
process management of it, we rely on the builtin functions
completion-read, make-comint-in-buffer
to select/launch
the chosen application.
The project’s name is a little joke about launching Chrome
web
browser inside Emacs/Exwm - a heavy metal ball that causes
nightmares.
- 0.0.4 Alpha
- cl-lib
- comint
- seq
Emacs | 26.3 | 28.0 |
FreeBSD | 12.1 | |
OpenBSD | 6.8 |
Clone Cannon
repository to an arbitrary location:
$ git clone https://github.com/lambdart/cannon ~/.emacs.d/site-elisp/cannon
Add Cannon
directory to load-path
in your
Emacs initialization file (init.el
) and load it.
;; add to load-path
(add-to-list 'load-path "/replace/me/to/cannon/path")
;; load cannon feature
(require 'cannon nil t)
- Note: For a more dynamic approach:
M-x load-file RET
M-x load-library RET cannon RET
- Note: Optional but recommended.
To compile the files to the Elisp
byte-compiled representation:
[at-cannon-root-directory]$ make
M-x cannon-launch RET
, write/select an executable in the prompt and launch it
with RET
.
- Note: it’s recommend to bind
cannon-launch
function to some keybind of choice, for quick access. (mine:C-x C-l
). - Note: to enable/disable the minor mode dynamically:
M-x turn-on-cannon-mode RET
andM-x turn-off-cannon-mode RET
.
That’s all! :D
- Note: To see all the options inside Emacs and customize it,
use:
M-x customize-group RET cannon RET
.
We have a few available options to customize some aspects of cannon, even though the behavior will probably stay the same. Remember, this package was designed having vanilla Emacs in mind, so if you are missing something it’ll be necessary to properly extend it.
cannon-prompt
- String to display in the initial ‘minibuffer’ prompt (default ‘Launch: ‘).
cannon-args-prompt
- String to display in the arguments ‘minibuffer’ prompt (default ‘Args: ‘).
cannon-history-size
- A number that determines how many recently executed commands should be recorded (default 16).
cannon-switch-to-buffer-flag
- Non-nil means switch to the created process buffer (default true: t).
cannon-kill-buffer-flag
- Non-nil means automatically kill buffer when process exits. (default true: t).
cannon-cache-file
- Cache file path, where the generated (command and history) lists will be saved.
MIT
In a rich man’s house there is no place to spit but his face.
Diogenes |