unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ryan C. Thompson" <rct@thompsonclan.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 19412@debbugs.gnu.org, Stefan Kangas <stefan@marxist.se>
Subject: bug#19412: 24.3; ido-write-file sometimes writes to a different directory than, it says it will
Date: Mon, 11 Jan 2021 09:28:06 -0500	[thread overview]
Message-ID: <dc86f3cf-5f00-8f0c-3c33-2963049fff2d@thompsonclan.org> (raw)
In-Reply-To: <877dojimqt.fsf@gnus.org>

On 1/11/21 9:14 AM, Lars Ingebrigtsen wrote:
> "Ryan C. Thompson" <rct@thompsonclan.org> writes:
>
>> It's been a while, but I've fixed up my patch and given it some
>> testing, and it seems to work on for me. However, in the meantime,
>> this issue has recently been "fixed" by special-casing write-file in
>> ido.el, as seen in #28513. So if you want to install my patch now,
>> you'll need to install the version attached to that thread. That
>> version reverts the other fix, since of course they are not
>> compatible, and would be redundant even if they were.
> It looks like a more thorough fix.  However:
>
> +          (minibuffer-with-setup-hook
> +              (:append
> +               (lambda ()
> +                 ;; Clear out whatever started in the minibuffer and
> +                 ;; replace it with what the user had already entered
> +                 ;; into ido.
> +                 (delete-minibuffer-contents)
> +                 (insert (abbreviate-file-name ido-current-directory))))
> +            (call-interactively this-command))))
>
> I'd be worried that this would step on other modifications the user may
> be doing from the minibuffer setup.

The only case where this would step on other minibuffer setup code is 
when that code makes modifications to the initial input in the 
minibuffer, since those modifications would be deleted and replaced. 
However, in this case I'd argue that is the correct behavior. The point 
of this code is to fall back from ido completion to standard emacs 
completion while preserving the current input. That means that any setup 
hook that modifies the initial contents of the minibuffer has *already* 
run at the start of ido completion and should not run *again* here. 
Effectively, we want to pretend that we are continuing the same 
completion session with a different completion system, even though we 
are actually starting a new completion session. And to do that, we need 
to preserve the user's current input verbatim when falling back.






  reply	other threads:[~2021-01-11 14:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 20:21 bug#19412: 24.3; ido-write-file sometimes writes to a different directory than it says it will Don Morrison
2019-11-03 22:48 ` bug#19412: 24.3; ido-write-file sometimes writes to a different directory than, " Ryan C. Thompson
2019-11-04 14:52   ` Ryan C. Thompson
2019-11-04 15:55     ` Ryan C. Thompson
2020-03-11 16:46       ` Ryan C. Thompson
2020-08-12 16:44         ` Stefan Kangas
2021-01-10 23:12           ` Ryan C. Thompson
2021-01-11 14:14             ` Lars Ingebrigtsen
2021-01-11 14:28               ` Ryan C. Thompson [this message]
2021-01-11 18:43                 ` Lars Ingebrigtsen
2021-01-11 18:50                   ` Ryan C. Thompson

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=dc86f3cf-5f00-8f0c-3c33-2963049fff2d@thompsonclan.org \
    --to=rct@thompsonclan.org \
    --cc=19412@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=stefan@marxist.se \
    /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).