Skip to content

An Elisp minor-mode that starts Unix utilities using the minibuffer completion system

License

Notifications You must be signed in to change notification settings

lambdart/el-run

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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.

Demo

./assets/cannon.jpg

Version

  • 0.0.4 Alpha

Dependencies

Elisp

  • cl-lib
  • comint
  • seq

Tested on

Emacs26.328.0
FreeBSD12.1
OpenBSD6.8

Installation

Manually

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

Compile

  • Note: Optional but recommended.

To compile the files to the Elisp byte-compiled representation:

[at-cannon-root-directory]$ make

Usage

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 and M-x turn-off-cannon-mode RET.

That’s all! :D

Customize

  • 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.

References

  1. Dmenu
  2. El-dmenu

LICENSE

MIT

EOF

In a rich man’s house there is no place to spit but his face.

Diogenes

About

An Elisp minor-mode that starts Unix utilities using the minibuffer completion system

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published