Function: kotl-mode:yank-pop
kotl-mode:yank-pop is an interactive and byte-compiled function
defined in kotl-mode.el.
Signature
(kotl-mode:yank-pop ARG)
Documentation
Replace just-yanked stretch of killed text with a different stretch.
This command is allowed only immediately after a yank or a yank-pop.
At such a time, the region contains a stretch of reinserted
previously-killed text. yank-pop deletes that text and inserts in its
place a different stretch of killed text.
With no argument, the previous kill is inserted. With argument N, insert the Nth previous kill. If N is negative, this is a more recent kill.
The sequence of kills wraps around, so that after the oldest one comes the newest one.
When this command inserts killed text into the buffer, it honors
yank-excluded-properties and yank-handler as described in the
doc string for insert-for-yank-1, which see.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kotl-mode.el
(defun kotl-mode:yank-pop (arg)
"Replace just-yanked stretch of killed text with a different stretch.
This command is allowed only immediately after a `yank' or a `yank-pop'.
At such a time, the region contains a stretch of reinserted
previously-killed text. `yank-pop' deletes that text and inserts in its
place a different stretch of killed text.
With no argument, the previous kill is inserted.
With argument N, insert the Nth previous kill.
If N is negative, this is a more recent kill.
The sequence of kills wraps around, so that after the oldest one
comes the newest one.
When this command inserts killed text into the buffer, it honors
`yank-excluded-properties' and `yank-handler' as described in the
doc string for `insert-for-yank-1', which see."
(interactive "*p")
(if (not (eq last-command 'kotl-mode:yank))
(error "Previous command was not a yank"))
(setq this-command 'kotl-mode:yank)
(unless arg
(setq arg 1))
(let ((inhibit-read-only t)
(before (< (point) (mark t))))
(if before
(funcall (or yank-undo-function 'delete-region) (point) (mark t))
(funcall (or yank-undo-function 'delete-region) (mark t) (point)))
(set-marker (mark-marker) (point) (current-buffer))
(let* ((yank-text (current-kill arg))
(indent (kcell-view:indent))
(indent-str (make-string indent ?\ )))
;; Convert all occurrences of newline to newline + cell indent.
;; Then insert into buffer.
(insert-for-yank (replace-regexp-in-string
"[\n\r]" (concat "\\&" indent-str) yank-text)))
;; Set the window start back where it was in the yank command,
;; if possible.
(set-window-start (selected-window) yank-window-start t)
(when before (kotl-mode:exchange-point-and-mark)))
nil)