Function: csv-sort-fields
csv-sort-fields is an interactive and natively compiled function
defined in csv-mode.el.
Signature
(csv-sort-fields FIELD BEG END)
Documentation
Sort lines in region lexicographically by the ARGth field of each line.
If not set, the region defaults to the CSV records around point.
Fields are separated by csv-separators and null fields are allowed anywhere.
Field indices increase from 1 on the left or decrease from -1 on the right.
A prefix argument specifies a single field, otherwise prompt for field index.
Ignore blank and comment lines. The variable sort-fold-case
determines whether alphabetic case affects the sort order.
When called non-interactively, FIELD is a single field index;
BEG and END specify the region to sort.
Key Bindings
csv-mode-map C-c C-s
Source Code
;; Defined in /nix/store/3gmjnyw9n226b7k7jamikx980vf8267p-emacs-packages-deps/share/emacs/site-lisp/elpa/csv-mode-1.27/csv-mode.el
(defun csv-sort-fields (field beg end)
"Sort lines in region lexicographically by the ARGth field of each line.
If not set, the region defaults to the CSV records around point.
Fields are separated by `csv-separators' and null fields are allowed anywhere.
Field indices increase from 1 on the left or decrease from -1 on the right.
A prefix argument specifies a single field, otherwise prompt for field index.
Ignore blank and comment lines. The variable `sort-fold-case'
determines whether alphabetic case affects the sort order.
When called non-interactively, FIELD is a single field index;
BEG and END specify the region to sort."
;; (interactive "*P\nr")
(interactive (csv-interactive-args 'single))
(barf-if-buffer-read-only)
(csv-sort-fields-1 field beg end
(lambda () (csv-sort-skip-fields field) nil)
(lambda () (skip-chars-forward csv--skip-chars))))