5.2.1 BibTeX Install

Simplified Install

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

By default, casual-init will setup support for BibTeX via the hook function casual-bibtex-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-bibtex-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 BibTeX, this can be controlled via the customizable variable casual-bibtex-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-bibtex-init)

Manual Install

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

The primary interface for Casual BibTeX is the Transient menu casual-bibtex-tmenu. It is autoloaded ((elisp)Autoload) so if Casual is installed via package-install ((emacs)Package Installation) then casual-bibtex-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 common (key)bindings across multiple modes to lower cognitive load. This document uses the secondary binding M-m for this purpose, but can be changed to user preference. Note that casual-bibtex-tmenu is intended to be used in conjunction with casual-editkit-main-tmenu. (EditKit Install).

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

(require 'casual-bibtex) ; load all dependencies including `bibtex'
(keymap-set bibtex-mode-map "M-m" #'casual-bibtex-tmenu)

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

(eval-after-load 'bibtex
  (keymap-set bibtex-mode-map "M-m" #'casual-bibtex-tmenu))

Additional Bindings

casual-bibtex-tmenu is opinionated in making editing and navigation commands emulate a form-based interface (form-based interface) in a bibtex-mode window. The following keybindings are recommended to support consistent behavior between bibtex-mode-map and casual-bibtex-tmenu.

(add-hook 'bibtex-mode-hook 'hl-line-mode)

(keymap-set bibtex-mode-map "<TAB>" #'bibtex-next-field)
(keymap-set bibtex-mode-map "<backtab>" #'previous-line)

(keymap-set bibtex-mode-map "C-n" #'bibtex-next-field)
(keymap-set bibtex-mode-map "M-n" #'bibtex-next-entry)
(keymap-set bibtex-mode-map "M-p" #'bibtex-previous-entry)

(keymap-set bibtex-mode-map "<prior>" #'bibtex-previous-entry)
(keymap-set bibtex-mode-map "<next>" #'bibtex-next-entry)

(keymap-set bibtex-mode-map "C-c C-o" #'bibtex-url)
(keymap-set bibtex-mode-map "C-c C-c" #'casual-bibtex-fill-and-clean)

(keymap-set bibtex-mode-map "<clear>" #'bibtex-empty-field)
(keymap-set bibtex-mode-map "M-<clear>" #'bibtex-kill-field)
(keymap-set bibtex-mode-map "M-DEL" #'bibtex-kill-field)