If Casual is installed using package-install, then you can use casual-init to setup support for Ediff.
By default, casual-init will setup support for Ediff via the hook function casual-ediff-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-ediff-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 Ediff, this can be controlled via the customizable variable casual-ediff-add-extra-keybindings (default t).
Users who want a more granular install of Casual modules can invoke the hook function of interest in their Emacs initialization file.
(casual-ediff-init)
For users who have manually installed Casual outside of package-install, the following guidance is offered.
The primary interface for Casual Ediff is the Transient menu casual-ediff-tmenu. It is autoloaded ((elisp)Autoload) so if Casual is installed via package-install ((emacs)Package Installation) then casual-ediff-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.
(require 'casual-ediff) ; load all dependencies including `ediff'
(casual-ediff-install) ; run this to enable Casual Ediff
(add-hook 'ediff-keymap-setup-hook
(lambda ()
(keymap-set ediff-mode-map "C-o" #'casual-ediff-tmenu)))
If lazy loading of the ediff package is desired then try using eval-after-load:
(eval-after-load 'ediff
(progn
(casual-ediff-install)
(add-hook 'ediff-keymap-setup-hook
(lambda ()
(keymap-set ediff-mode-map "C-o" #'casual-ediff-tmenu)))))
If the current buffer is loaded with a version-controlled file, then the difference between that buffer’s content with its most recent commit can be seen with the command casual-ediff-revision. It is often convenient to bind this command. Shown below is an example of such a binding.
(keymap-global-set "<f15>" #'casual-ediff-revision)
Users who wish to call casual-ediff-revision via mouse can use the command casual-ediff-revision-from-menu. An example of its use is shown in the source example below (note this is a code fragment).
(easy-menu-add-item
menu nil
["Ediff revision…"
casual-ediff-revision-from-menu
:visible (and (bound-and-true-p buffer-file-name)
(vc-registered (buffer-file-name)))
:help "Ediff this file with revision"])
Casual Ediff recommends the following variables be set as follows:
| Variable | Value |
|---|---|
| ediff-keep-variants | nil |
| ediff-window-setup-function | ediff-setup-windows-plain |
| ediff-split-window-function | split-window-horizontally |