From dfe79a8185bb1374e09096f81aba865adb33359f Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 21 May 2021 21:18:09 +0300 Subject: [PATCH] * lisp/simple.el (yank-from-kill-ring): Fix kill-ring-yank-pointer (bug#48478) --- lisp/simple.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index f139555dd34..2a90a076315 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5772,9 +5772,8 @@ When called from Lisp, insert STRING like `insert-for-yank' does." (insert-for-yank string) (when yank-from-kill-ring-rotate (let ((pos (seq-position kill-ring string))) - (setq kill-ring-yank-pointer - (or (and pos (nthcdr pos kill-ring)) - kill-ring)))) + (when pos + (setq kill-ring-yank-pointer (nthcdr pos kill-ring))))) (if (consp arg) ;; Swap point and mark like in `yank' and `yank-pop'. (goto-char (prog1 (mark t) -- 2.39.5