unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 46033@debbugs.gnu.org
Cc: laszlomail@protonmail.com
Subject: bug#46033: up arrow in query replace should not step into the prompt
Date: Sat, 23 Jan 2021 19:24:50 +0200	[thread overview]
Message-ID: <87ft2rd1ot.fsf@mail.linkov.net> (raw)
In-Reply-To: <7sIywf2TKUTDST-QQJyKZzPIwKN6sUQuyb-1ReWQ09vPjrZwcAjSu-HOEwWJIAOio4ugVvqEYVcRFwMEJxN6rAitsq6Sf-dQkWQ67jHybfI=@protonmail.com> (laszlomail's message of "Fri, 22 Jan 2021 14:16:38 +0000")

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

>> This is a feature: it allows you to scroll through the text shown in
>> the minibuffer, in case you want to edit it. Use M-p to go directly
>> to the previous history.
>
> I understand it's a feature, but as you see in the picture the prompt is
> empty, and the full default replacement is visible.
>
> In this case arrow should retrieve the previous history, instead of going
> into the prompt, because there is nothing to scroll.

Thanks for the well justified request.  This patch avoids moving point
to the prompt on the rightful assumption that most of the time the users
would not want to edit read-only text:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: avoid-minibuffer-prompt.patch --]
[-- Type: text/x-diff, Size: 627 bytes --]

diff --git a/lisp/simple.el b/lisp/simple.el
index 0355ac863a..f5fe366f69 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2476,7 +2476,10 @@ previous-line-or-history-element
 			 (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.

  reply	other threads:[~2021-01-23 17:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 13:21 bug#46033: up arrow in query replace should not step into the prompt laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-22 13:55 ` Eli Zaretskii
2021-01-22 14:16   ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 17:24     ` Juri Linkov [this message]
2021-01-23 17:46       ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 18:34         ` Juri Linkov
2021-01-23 18:53           ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-25 17:14             ` Juri Linkov
2021-01-27 18:10               ` Juri Linkov
2021-01-22 18:44   ` Lars Ingebrigtsen
2021-01-22 18:52     ` Eli Zaretskii
2021-01-23 17:35       ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 18:17         ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 18:30           ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 18:33             ` laszlomail--- via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ft2rd1ot.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=46033@debbugs.gnu.org \
    --cc=laszlomail@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).