5.8.1 CSV Install

Simplified Install

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

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

Manual Install

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

The primary interface for Casual CSV is the Transient menu casual-csv-tmenu. It is autoloaded ((elisp)Autoload) so if Casual is installed via package-install ((emacs)Package Installation) then casual-csv-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 secondary binding M-m for this purpose, but can be changed to user preference. Note that casual-csv-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-csv) ; load all dependencies including `csv'
(keymap-set csv-mode-map "M-m" #'casual-csv-tmenu)

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

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

Additional Configuration

While not required, the following configuration is recommended for working with CSV files.

;; disable line wrap
(add-hook 'csv-mode-hook
          (lambda ()
            (visual-line-mode -1)
            (toggle-truncate-lines 1)))

;; auto detect separator
(add-hook 'csv-mode-hook #'csv-guess-set-separator)
;; turn on field alignment
(add-hook 'csv-mode-hook #'csv-align-mode)