From 15c57fc4cc031cc6aca7eabd74706538fd6bfa22 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 3 Jun 2021 23:54:30 +0300 Subject: [PATCH] * lisp/simple.el (read-from-kill-ring): Fix the case of 'M-y M-p' (bug#48478) Don't use offsets for read-from-kill-ring-history when kill-ring-yank-pointer points to the last element of kill-ring. --- lisp/simple.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 6d216f74d91..a0adaff431e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5742,7 +5742,8 @@ PROMPT is a string to prompt with." (complete-with-action action completions string pred))) nil nil nil (if history-pos - (cons 'read-from-kill-ring-history (1+ history-pos)) + (cons 'read-from-kill-ring-history + (if (zerop history-pos) history-pos (1+ history-pos))) 'read-from-kill-ring-history))))) (defcustom yank-from-kill-ring-rotate t -- 2.39.2