5.6.1 Compile Install

Simplified Install

If Casual is installed using package-install, then you can use casual-init to setup support for Compile and Grep.

By default, casual-init will setup support for Compile via the hook function casual-compile-init which is included in the customizable variable casual-init-hook. The same goes for the hook function casual-grep-init.

Use the command customize-variable on casual-init-hook to control inclusion of casual-compile-init via a checkbox interface.

Refer to the Simplified Install (Install) section for more detail on customizing casual-init.

Casual makes opinionated decisions on the keybindings used in its menus. Such opinions are extended from said menus to the keymap(s) of a particular mode. For Compile, this can be controlled via the customizable variable casual-compile-add-extra-keybindings (default t). For Grep, this can be controlled via the customizable variable casual-grep-add-extra-keybindings (default t).

Hook Install

Users who want a more granular install of Casual modules can invoke the hook function of interest in their Emacs initialization file.

(casual-compile-init)
(casual-grep-init)

Manual Install

For users who have manually installed Casual outside of package-install, the following guidance is offered.

The primary interface for Casual Compile is the Transient menu casual-compile-tmenu. It is autoloaded ((elisp)Autoload) so if Casual is installed via package-install ((emacs)Package Installation) then casual-compile-tmenu can be invoked via execute-extended-command (M-x) without need for modifying your Emacs initialization file.

That said, Casual is designed with the intent of using a common (key)binding across multiple modes to lower cognitive load. This document uses the binding C-o for this purpose, but can be changed to user preference.

There are many ways to configure this binding. Shown below is a straightforward implementation:

(require 'casual-compile) ; load all dependencies including `compile', `grep'
(keymap-set compilation-mode-map "C-o" #'casual-compile-tmenu)
(keymap-set grep-mode-map "C-o" #'casual-compile-tmenu)

If lazy loading of the compile package is desired then try using eval-after-load:

(eval-after-load 'compile
  (keymap-set compile-mode-map "C-o" #'casual-compile-tmenu))

(eval-after-load 'grep
  (keymap-set grep-mode-map "C-o" #'casual-compile-tmenu))

Additional Bindings

casual-compile-tmenu deviates from the default bindings of compilation-mode-map as shown in the table below to support using a single key on an ‘en.US’ keyboard.

Default BindingCasual BindingCommand
M-pkcompilation-previous-error
M-njcompilation-next-error
M-{[compilation-previous-file
M-}]compilation-next-file
C-oocompilation-display-error

The following keybindings are recommended to support consistent behavior between compilation-mode-map and casual-compile-tmenu.

(keymap-set compilation-mode-map "k" #'compilation-previous-error)
(keymap-set compilation-mode-map "j" #'compilation-next-error)
(keymap-set compilation-mode-map "o" #'compilation-display-error)
(keymap-set compilation-mode-map "[" #'compilation-previous-file)
(keymap-set compilation-mode-map "]" #'compilation-next-file)

Similar treatment for grep-mode-map can be done.

(keymap-set grep-mode-map "k" #'compilation-previous-error)
(keymap-set grep-mode-map "j" #'compilation-next-error)
(keymap-set grep-mode-map "o" #'compilation-display-error)
(keymap-set grep-mode-map "[" #'compilation-previous-file)
(keymap-set grep-mode-map "]" #'compilation-next-file)