On Mon, 24 Aug 2020 16:38:02 +0200 Lars Ingebrigtsen wrote: > Stephen Berman writes: > >> 0. emacs -Q >> 1. C-x C-f >> ~/foo/bar/very/long/file/name/that/overflows/minibuffer/window/line/when/displayed >> >> 2. C-x C-f >> => The file name entered in step 1 appears in the minibuffer, with point >> on the "w" of "when" (i.e., column 80, the end of the visual line). >> >> If at step 2 instead of you type `M-p', then point is at the end of >> the file name in the minibuffer. This is what I expected for too. > > Yes, that's really confusing. I do get a different result than you, > though -- point is placed inside the "Find file" prompt when I hit > . :-/ That's even worse. I see that too, now. That's because at step 2 the current buffer is the one made in step one, so after the prompt includes all parent directory names. When, after step 1, I switch to another buffer and then do step 2, I see what I reported. I don't know if I accidentally left out that intermediate step in my OP or if the behavior has changed since then. As an alternative, replacing all the slashes by dashes, so it's just a long file name in ~/, and doing step 2 also puts point at the end of the visual line. >> 2017-06-01 Stephen Berman >> >> Improve navigation through minibuffer history >> >> * lisp/simple.el (previous-line-or-history-element): If the >> element extends beyond window-width, go to its logical end, >> since that is the natural target for editing history elements. >> If it consists of a single line, move by logical lines to hit >> beginning-of-buffer immediately and get the previous history >> element. Otherwise, move by visual lines. >> > > Your change makes sense, I think, but when I tried applying the two > patches, they no longer applied to Emacs 28, so I couldn't give it a > try. Could you possibly respin the patches? Thanks for taking a look at this. Here are the changes adjusted to apply to current master: