Function: avy-kill-ring-save-whole-line

avy-kill-ring-save-whole-line is an interactive and natively compiled function defined in avy.el.

Signature

(avy-kill-ring-save-whole-line ARG)

Documentation

Select line and save the whole selected line as if killed, but don’t kill it.

This command is similar to avy-kill-whole-line, except that it saves the line(s) as if killed, but does not kill it(them).

With a numerical prefix ARG, kill ARG line(s) starting from the selected line. If ARG is negative, kill backward.

If ARG is zero, kill the selected line but exclude the trailing newline.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/015952xhg9b72ira1qyjvb30bn11jiv3-emacs-packages-deps/share/emacs/site-lisp/elpa/avy-20241101.1357/avy.el
;;;###autoload
(defun avy-kill-ring-save-whole-line (arg)
  "Select line and save the whole selected line as if killed, but don’t kill it.

This command is similar to `avy-kill-whole-line', except that it
saves the line(s) as if killed, but does not kill it(them).

With a numerical prefix ARG, kill ARG line(s) starting from the
selected line.  If ARG is negative, kill backward.

If ARG is zero, kill the selected line but exclude the trailing
newline."
  (interactive "P")
  (let ((initial-window (selected-window)))
    (avy-with avy-kill-ring-save-whole-line
      (let* ((start (avy--line)))
        (if (not (numberp start))
            (user-error "Fail to select the line to kill")
          (save-excursion
            (let ((kill-read-only-ok t)
                  (buffer-read-only t))
              (goto-char start)
              (kill-whole-line arg))))))
    (select-window initial-window)))