From 49e01d85ed6a6e4c95d43b6eeb4f32c7daa319a7 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 25 Jan 2021 19:14:22 +0200 Subject: [PATCH] Don't move point to the prompt in previous-line-or-history-element (bug#46033) * lisp/simple.el (previous-line-or-history-element): Avoid moving point to the prompt. --- lisp/simple.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 8d4e4a7a6bb..c878fdab921 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2476,7 +2476,10 @@ previous element of the minibuffer history in the minibuffer." (current-column))))) (condition-case nil (with-no-warnings - (previous-line arg)) + (previous-line arg) + ;; Avoid moving point to the prompt + (when (< (point) (minibuffer-prompt-end)) + (signal 'beginning-of-buffer nil))) (beginning-of-buffer ;; Restore old position since `line-move-visual' moves point to ;; the beginning of the line when it fails to go to the previous line. -- 2.39.5