Function: csv-header-line

csv-header-line is an interactive and natively compiled function defined in csv-mode.el.

Signature

(csv-header-line &optional USE-CURRENT-LINE)

Documentation

Set/unset the header line.

If the optional prefix arg USE-CURRENT-LINE is nil, use the first line as the header line. If there is already a header line, then unset the header line.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/3gmjnyw9n226b7k7jamikx980vf8267p-emacs-packages-deps/share/emacs/site-lisp/elpa/csv-mode-1.27/csv-mode.el
(defun csv-header-line (&optional use-current-line)
  "Set/unset the header line.
If the optional prefix arg USE-CURRENT-LINE is nil, use the first line
as the header line.
If there is already a header line, then unset the header line."
  (interactive "P")
  (if csv--header-line
      (progn
        (delete-overlay csv--header-line)
        (setq csv--header-line nil)
        (kill-local-variable 'header-line-format))
    (save-excursion
      (unless use-current-line (goto-char (point-min)))
      (setq csv--header-line (make-overlay (line-beginning-position)
                                           (line-end-position)
                                           nil nil t))
      (overlay-put csv--header-line 'modification-hooks
                   '(csv--header-flush)))
    (csv--header-flush)
    ;; These are introduced in Emacs 29.
    (unless (boundp 'header-line-indent)
      (setq-local header-line-indent ""
                  header-line-indent-width 0))
    (setq header-line-format
          '("" header-line-indent (:eval (csv--header-string))))))