/common-lisp-modes.el

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

common-lisp-modes-mode.el

common-lisp-modes-mode (clmm for short) is a minor mode that can be used to enable functionality that is common across many lisps via a common hook. The idea is to set all common features via the common-lisp-modes-mode-hook and then enable common-lisp-modes-mode in a major mode hook for a given lisp mode. For REPL-specific features that may not be wanted in source code editing buffers, this package also provides a common-repl-modes-mode.

Install this package either by using something like straight.el or manually putting region-bindings.el to your load path. Then require the package and enable the mode globally, or use use-package:

(use-package common-lisp-modes)

Rationale

Unfortunately, the lisp-mode is made specifically for editing Common Lisp code, so all other lisp modes mostly inherit from prog-mode. This makes it harder to enable common features, because prog-mode-hook is too broad for enabling something like paredit, and other lisp-related packages. There are also various REPL-related modes that mostly inherit from comint-mode, but comint is used for non-lisp stuff as well, which makes the comint-mode-hook not feasible as well.

So, instead of repeating all common hooks for every lisp, these can be set as a part of common-lisp-modes-mode-hook, and common-lisp-modes-mode can be added to a major mode hook instead.

Usage

One can set paredit and isayt-mode to the common-lisp-modes-mode-hook, and then turn common-lisp-modes-mode in a major mode hook for a given lisp:

(add-hook 'common-lisp-modes-mode-hook 'paredit-mode)
(add-hook 'common-lisp-modes-mode-hook 'isayt-mode)

Now, these modes can be enabled by simply enabling clmm:

(dolist (hook '(common-lisp-mode-hook
                clojure-mode-hook
                cider-repl-mode
                racket-mode-hook
                eshell-mode-hook
                eval-expression-minibuffer-setup-hook))
  (add-hook hook 'common-lisp-modes-mode))

Contributing

Please do. Read the contribution guide for more information.