Function: evil-append-register

evil-append-register is a byte-compiled function defined in evil-common.el.

Signature

(evil-append-register REGISTER TEXT)

Documentation

Append TEXT to the contents of REGISTER.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-append-register (register text)
  "Append TEXT to the contents of REGISTER."
  (let ((content (get-register register)))
    (set-register
     register
     (cond
      ((not content) text)
      ;; if the register does not contain a string treat it as a vector
      ((not (stringp content)) (vconcat content text))
      ;; some non-trivial yank-handler -> always switch to line handler
      ((or (text-property-not-all
            0 (length content) 'yank-handler nil content)
           (text-property-not-all
            0 (length text) 'yank-handler nil text))
       ;; ensure complete lines
       (setq text
             (concat
              content
              (and (> (length content) 0)
                   (/= (aref content (1- (length content))) ?\n)
                   "\n")
              text
              (and (> (length text) 0)
                   (/= (aref text (1- (length text))) ?\n)
                   "\n")))
       (put-text-property 0 (length text) 'yank-handler '(evil-yank-line-handler)
                          text)
       text)
      (t (concat content text))))))