Function: kill-append

kill-append is a byte-compiled function defined in simple.el.gz.

Signature

(kill-append STRING BEFORE-P)

Documentation

Append STRING to the end of the latest kill in the kill ring.

If BEFORE-P is non-nil, prepend STRING to the kill instead. If interprogram-cut-function is non-nil, call it with the resulting kill. If kill-append-merge-undo is non-nil, remove the last undo boundary in the current buffer.

View in manual

Probably introduced at or before Emacs version 22.1.

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun kill-append (string before-p)
  "Append STRING to the end of the latest kill in the kill ring.
If BEFORE-P is non-nil, prepend STRING to the kill instead.
If `interprogram-cut-function' is non-nil, call it with the
resulting kill.
If `kill-append-merge-undo' is non-nil, remove the last undo
boundary in the current buffer."
  (let ((cur (car kill-ring)))
    (kill-new (if before-p (concat string cur) (concat cur string))
              (or (= (length cur) 0)
                  (null (get-text-property 0 'yank-handler cur)))))
  (when (and kill-append-merge-undo (not buffer-read-only))
    (let ((prev buffer-undo-list)
          (next (cdr buffer-undo-list)))
      ;; Find the next undo boundary.
      (while (car next)
        (pop next)
        (pop prev))
      ;; Remove this undo boundary.
      (when prev
        (setcdr prev (cdr next))))))