Function: cua-paste-pop

cua-paste-pop is an interactive and byte-compiled function defined in cua-base.el.gz.

Signature

(cua-paste-pop ARG)

Documentation

Replace a just-pasted text or rectangle with a different text.

See yank-pop for details about the default behavior. For an alternative behavior, see cua-paste-pop-rotate-temporarily.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/cua-base.el.gz
(defun cua-paste-pop (arg)
  "Replace a just-pasted text or rectangle with a different text.
See `yank-pop' for details about the default behavior.  For an alternative
behavior, see `cua-paste-pop-rotate-temporarily'."
  (interactive "P")
  (cond
   ((eq last-command 'cua--paste-rectangle)
    (undo)
    (yank arg))
   ((not cua-paste-pop-rotate-temporarily)
    (yank-pop (prefix-numeric-value arg)))
   (t
    (let ((rotate (if (consp arg) 1 (prefix-numeric-value arg))))
      (cond
       ((or (null cua-paste-pop-count)
	    (eq last-command 'yank)
	    (eq last-command 'cua-paste))
	(setq cua-paste-pop-count rotate)
	(setq last-command 'yank)
	(yank-pop cua-paste-pop-count))
       ((and (eq last-command 'cua-paste-pop) (not (consp arg)))
	(setq cua-paste-pop-count (+ cua-paste-pop-count rotate))
	(setq last-command 'yank)
	(yank-pop cua-paste-pop-count))
       (t
	(setq cua-paste-pop-count
	      (if (consp arg) (+ cua-paste-pop-count rotate -1) 1))
	(yank (1+ cua-paste-pop-count)))))
    ;; Undo rotating the kill-ring, so next C-y will
    ;; yank the original head.
    (setq kill-ring-yank-pointer kill-ring)
    (setq this-command 'cua-paste-pop))))