5.17.1 IBuffer Install

Simplified Install

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

By default, casual-init will setup support for IBuffer via the hook function casual-ibuffer-init which is included in the customizable variable casual-init-hook.

Use the command customize-variable on casual-init-hook to control inclusion of casual-ibuffer-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 IBuffer, this can be controlled via the customizable variable casual-ibuffer-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-ibuffer-init)

Manual Install

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

The primary interface for Casual IBuffer is the Transient menu casual-ibuffer-tmenu. It is autoloaded ((elisp)Autoload) so if Casual is installed via package-install ((emacs)Package Installation) then casual-ibuffer-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-ibuffer) ; load all dependencies including `ibuffer'
(keymap-set ibuffer-mode-map "C-o" #'casual-ibuffer-tmenu)

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

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

Additional Bindings and Configuration

Like Casual Dired (Dired), it is convenient to have the menus for filtering and sorting bound as well. Listed below shows an example of binding casual-ibuffer-filter-tmenu and casual-ibuffer-sortby-tmenu to F and s respectively.

(keymap-set ibuffer-mode-map "F" #'casual-ibuffer-filter-tmenu)
(keymap-set ibuffer-mode-map "s" #'casual-ibuffer-sortby-tmenu)

Use these keybindings to configure IBuffer to be consistent with keybindings used by Casual IBuffer.

(keymap-set ibuffer-mode-map "{" #'ibuffer-backwards-next-marked)
(keymap-set ibuffer-mode-map "}" #'ibuffer-forward-next-marked)
(keymap-set ibuffer-mode-map "[" #'ibuffer-backward-filter-group)
(keymap-set ibuffer-mode-map "]" #'ibuffer-forward-filter-group)
(keymap-set ibuffer-mode-map "$" #'ibuffer-toggle-filter-group)

While not necessary for Casual IBuffer, enabling hl-line-mode and binding mouse clicks in IBuffer adds to a more comfortable IBuffer experience. Also, adding ibuffer-auto-mode to ibuffer-mode-hook will enable auto-updating.

(require 'hl-line)
(require 'mouse)
(add-hook 'ibuffer-mode-hook #'hl-line-mode)
(add-hook 'ibuffer-mode-hook #'ibuffer-auto-mode)
(keymap-set ibuffer-mode-map "<double-mouse-1>" #'ibuffer-visit-buffer)
(keymap-set ibuffer-mode-map "M-<double-mouse-1>" #'ibuffer-visit-buffer-other-window)