Function: csv-kill-fields
csv-kill-fields is an interactive and natively compiled function
defined in csv-mode.el.
Signature
(csv-kill-fields FIELDS BEG END)
Documentation
Kill specified fields of each line in the region.
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.
The fields are stored for use by csv-yank-fields. Fields can be
specified in any order but are saved in increasing index order.
Ignore blank and comment lines.
When called interactively, a prefix argument specifies a single field, otherwise prompt for a field list, which may include ranges in the form m-n, where m < n and n defaults to the last field index if omitted.
When called non-interactively, FIELDS is a single field index or a list of field indices, with ranges specified as (m.n) or (m), and BEG and END specify the region to process.
Key Bindings
csv-mode-map C-c C-k
Source Code
;; Defined in /nix/store/3gmjnyw9n226b7k7jamikx980vf8267p-emacs-packages-deps/share/emacs/site-lisp/elpa/csv-mode-1.27/csv-mode.el
(defun csv-kill-fields (fields beg end)
"Kill specified fields of each line in the region.
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.
The fields are stored for use by `csv-yank-fields'. Fields can be
specified in any order but are saved in increasing index order.
Ignore blank and comment lines.
When called interactively, a prefix argument specifies a single field,
otherwise prompt for a field list, which may include ranges in the form
m-n, where m < n and n defaults to the last field index if omitted.
When called non-interactively, FIELDS is a single field index or a
list of field indices, with ranges specified as (m.n) or (m), and BEG
and END specify the region to process."
;; (interactive "*P\nr")
(interactive (csv-interactive-args 'multiple))
(barf-if-buffer-read-only)
;; Kill the field(s):
(setq csv-killed-fields nil)
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char (point-min))
(if (or (cdr fields) (consp (car fields)))
(csv-kill-many-columns fields)
(csv-kill-one-column (car fields)))))
(setq csv-killed-fields (nreverse csv-killed-fields)))