GNU ELPA - csv-mode

csv-mode

Description
Major mode for editing comma/char separated values
Latest
csv-mode-1.23.tar (.sig), 2024-Jan-15, 90.0 KiB
Maintainer
<emacs-devel@gnu.org>
Website
https://elpa.gnu.org/packages/csv-mode.html
Browse repository
CGit or Gitweb
Badge

To install this package from Emacs, use package-install or list-packages.

Full description

This package implements CSV mode, a major mode for editing records
in a generalized CSV (character-separated values) format.  It binds
files with prefix ".csv" to `csv-mode' (and ".tsv" to `tsv-mode') in
`auto-mode-alist'.

In CSV mode, the following commands are available:

- C-c C-s (`csv-sort-fields') and C-c C-n (`csv-sort-numeric-fields')
  respectively sort lexicographically and numerically on a
  specified field or column.

- C-c C-r (`csv-reverse-region') reverses the order.  (These
  commands are based closely on, and use, code in `sort.el'.)

- C-c C-k (`csv-kill-fields') and C-c C-y (`csv-yank-fields') kill
  and yank fields or columns, although they do not use the normal
  kill ring.  C-c C-k can kill more than one field at once, but
  multiple killed fields can be yanked only as a fixed group
  equivalent to a single field.

- `csv-align-mode' keeps fields visually aligned, on-the-fly.
  It truncates fields to a maximum width that can be changed per-column
  with `csv-align-set-column-width'.
  Alternatively, C-c C-a (`csv-align-fields') aligns fields into columns
  and C-c C-u (`csv-unalign-fields') undoes such alignment;
  separators can be hidden within aligned records (controlled by
  `csv-invisibility-default' and `csv-toggle-invisibility').

- C-c C-t (`csv-transpose') interchanges rows and columns.  For
  details, see the documentation for the individual commands.

- `csv-set-separator' sets the CSV separator of the current buffer,
  while `csv-guess-set-separator' guesses and sets the separator
  based on the current buffer's contents.
  `csv-guess-set-separator' can be useful to add to the mode hook
  to have CSV mode guess and set the separator automatically when
  visiting a buffer:

    (add-hook 'csv-mode-hook 'csv-guess-set-separator)

CSV mode can recognize fields separated by any of several single
characters, specified by the value of the customizable user option
`csv-separators'.  CSV data fields can be delimited by quote
characters (and must if they contain separator characters).  This
implementation supports quoted fields, where the quote characters
allowed are specified by the value of the customizable user option
`csv-field-quotes'.  By default, the both commas and tabs are considered
as separators and the only field quote is a double quote.
These user options can be changed ONLY by customizing them, e.g. via M-x
customize-variable.

CSV mode commands ignore blank lines and comment lines beginning
with the value of the buffer local variable `csv-comment-start',
which by default is #.  The user interface is similar to that of
the standard commands `sort-fields' and `sort-numeric-fields', but
see the major mode documentation below.

The global minor mode `csv-field-index-mode' provides display of
the current field index in the mode line, cf. `line-number-mode'
and `column-number-mode'.  It is on by default.

See also:

the standard GNU Emacs 21 packages align.el, which will align
columns within a region, and delim-col.el, which helps to prettify
columns in a text region or rectangle;

csv.el by Ulf Jasper <ulf.jasper at web.de>, which provides
functions for reading/parsing comma-separated value files and is
available at http://de.geocities.com/ulf_jasper/emacs.html (and in
the gnu.emacs.sources archives).

Old versions

csv-mode-1.22.tar.lz2023-Feb-0820.4 KiB
csv-mode-1.21.tar.lz2022-Jun-2420.2 KiB
csv-mode-1.20.tar.lz2022-May-1320.1 KiB
csv-mode-1.19.tar.lz2022-Apr-0818.6 KiB
csv-mode-1.18.tar.lz2021-Dec-2718.5 KiB
csv-mode-1.17.tar.lz2021-Dec-0118.4 KiB
csv-mode-1.16.tar.lz2021-Sep-1018.4 KiB
csv-mode-1.15.tar.lz2021-Feb-2318.4 KiB
csv-mode-1.14.tar.lz2020-Dec-0920.2 KiB
csv-mode-1.13.tar.lz2020-Dec-0620.2 KiB
csv-mode-1.12.tar.lz2020-Feb-1620.1 KiB
csv-mode-1.10.el.lz2019-Oct-2219.3 KiB
csv-mode-1.9.el.lz2019-Sep-2417.0 KiB
csv-mode-1.8.el.lz2019-Sep-1815.0 KiB
csv-mode-1.7.el.lz2017-Dec-0514.8 KiB
csv-mode-1.6.el.lz2016-Apr-2214.1 KiB
csv-mode-1.5.el.lz2015-Jul-0914.0 KiB
csv-mode-1.4.el.lz2015-May-2513.9 KiB
csv-mode-1.3.el.lz2015-Apr-1613.9 KiB
csv-mode-1.2.el.lz2013-Apr-2513.9 KiB

News

Since 1.21:
- New command `csv-insert-column'.
- New config var `csv-align-min-width' for `csv-align-mode'.
- New option `csv-confirm-region'.

Since 1.9:
- `csv-align-mode' auto-aligns columns dynamically (on screen).

Before that:
Begun on 15 November 2003 to provide lexicographic sorting of
simple CSV data by field and released as csv.el.  Facilities to
kill multiple fields and customize separator added on 9 April 2004.
Converted to a major mode and renamed csv-mode.el on 10 April 2004,
partly at the suggestion of Stefan Monnier <monnier at
IRO.UMontreal.CA> to avoid conflict with csv.el by Ulf Jasper.
Field alignment, comment support and CSV mode customization group
added on 1 May 2004.  Support for index ranges added on 6 June
2004.  Multiple field separators added on 12 June 2004.
Transposition added on 22 June 2004.  Separator invisibility added
on 23 June 2004.