Function: evil-yank-lines

evil-yank-lines is a byte-compiled function defined in evil-common.el.

Signature

(evil-yank-lines BEG END &optional REGISTER YANK-HANDLER)

Documentation

Save the lines in the region BEG and END into the kill-ring.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-yank-lines (beg end &optional register yank-handler)
  "Save the lines in the region BEG and END into the kill-ring."
  (let ((text (filter-buffer-substring beg end))
        (yank-handler (list (or yank-handler #'evil-yank-line-handler)
                            nil
                            t)))
    ;; Ensure the text ends with a newline. This is required
    ;; if the deleted lines were the last lines in the buffer.
    (when (or (zerop (length text))
              (/= (aref text (1- (length text))) ?\n))
      (setq text (concat text "\n")))
    (put-text-property 0 (length text) 'yank-handler yank-handler text)
    (when register
      (evil-set-register register text))
    (when evil-was-yanked-without-register
      (evil-set-register ?0 text)) ; "0 register contains last yanked text
    (unless (eq register ?_)
      (kill-new text))))