From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Ryan C. Thompson" Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <0a0e748b-e809-d1e9-e52a-a3d846635fe6@thompsonclan.org> <2c4460c3-ad84-b706-189e-07429a3b2500@thompsonclan.org> <1f98bdf5-2da4-10b6-57f0-bdc0964a6df9@thompsonclan.org> <877dojimqt.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3541"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Cc: 19412@debbugs.gnu.org, Stefan Kangas To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 11 15:29:24 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kyyCC-0000nB-Ca for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 15:29:24 +0100 Original-Received: from localhost ([::1]:35678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyyCA-0000oz-OQ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 09:29:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyyBp-0000om-UP for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 09:29:01 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44656) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kyyBp-0005X2-Nk for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 09:29:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kyyBp-0003KJ-KM for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 09:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Ryan C. Thompson" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jan 2021 14:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19412 X-GNU-PR-Package: emacs Original-Received: via spool by 19412-submit@debbugs.gnu.org id=B19412.161037529912733 (code B ref 19412); Mon, 11 Jan 2021 14:29:01 +0000 Original-Received: (at 19412) by debbugs.gnu.org; 11 Jan 2021 14:28:19 +0000 Original-Received: from localhost ([127.0.0.1]:56202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyyB9-0003JI-CN for submit@debbugs.gnu.org; Mon, 11 Jan 2021 09:28:19 -0500 Original-Received: from mail-io1-f46.google.com ([209.85.166.46]:33378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyyB5-0003J2-B0 for 19412@debbugs.gnu.org; Mon, 11 Jan 2021 09:28:18 -0500 Original-Received: by mail-io1-f46.google.com with SMTP id w18so18028754iot.0 for <19412@debbugs.gnu.org>; Mon, 11 Jan 2021 06:28:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thompsonclan-org.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=IrdENmKvh3Ks6LRLsAH0wFEHfPSMiSQBV9aA0jwJYCU=; b=nuiH4w24DKrvEQd/JksqT4BZiCbAMZ0AwQKqobOR6ucWJBInHF08cqv0PWY/NlTOS8 vCoQhvZ6FYFWUjKBhfqHrXtSCeV/OSU9lF0VOPmmfaHhliYRQomDJZLzpOLaWYzTapED yhXYoLSP9jMP+0Do1yyUFlXRtWd0oIztGdsMJf8i3boFF+WR4YJeBdXtUd94EdAw0gsD VuZKoCYtMWUxztmKMPmgBkLATsMwxwfpKV/YGmyEbjjGoLyRZQq80w0C7AcznW09vwK0 nSjbv3xUWGxlnmuKMlR4lhl024e5dISlkxH/Xepgx3o7j5rowNcHfiaFQUhLCsQiqSMI 4yGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=IrdENmKvh3Ks6LRLsAH0wFEHfPSMiSQBV9aA0jwJYCU=; b=i8QKSVDg6U51nYaYMdNAcWw27/dYIHPts9hKZ38NjPQrjcO6PXizOl074WmwCAJr0N E6lcrftu9bvXfo96mwMU5IKi/i/7KWZFN3jYjrh2bhiDG4MXxK1p336ViQN5HYGEEBAV mcxHBhhmOi0PxCbCARvZ6oWDg9WXGovyA7M8l1cjsxCw1ixUaRqon97xFxACI//3lYV8 Bz4tV7nY1FPxeOBQzqz3USTx8yvfZhxAP6EaSEMhk7t7JTyjE7yYjAHbbo4Gas73pypP 1fML2wQUwkjSeiX8p3dPpohnrWAwxLO2edNhxar00ezQD3jiuwQ6fyvkOkVXQUbFw8/l CO5w== X-Gm-Message-State: AOAM533nyfphMrlWp5FLNd3RNJj9aqhAeYJzWiNXSQfPojkrIWDNLv3r YZezK7XCAqwScGFeBD3RdjbgJsXhDLs43B4v X-Google-Smtp-Source: ABdhPJyK7gHLaPIcVGqRXibxza1fc6mfrVMlGnfg3+DFfsILRRvckPMIcC9vpy9rM+4cM5lSUyL0Xw== X-Received: by 2002:a6b:c8cb:: with SMTP id y194mr14659889iof.69.1610375289266; Mon, 11 Jan 2021 06:28:09 -0800 (PST) Original-Received: from urania.local (c-76-116-193-120.hsd1.nj.comcast.net. [76.116.193.120]) by smtp.gmail.com with ESMTPSA id t14sm11561495iof.23.2021.01.11.06.28.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Jan 2021 06:28:08 -0800 (PST) In-Reply-To: <877dojimqt.fsf@gnus.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197697 Archived-At: On 1/11/21 9:14 AM, Lars Ingebrigtsen wrote: > "Ryan C. Thompson" 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.