From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Slight confusion in project-find-file Date: Tue, 14 Sep 2021 01:03:24 +0300 Message-ID: <54b5dbe5-4569-f66f-8112-d525550234cb@yandex.ru> References: <871r5sd0wa.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="18218"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 14 00:04:47 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mPu4E-0004ZK-Sb for ged-emacs-devel@m.gmane-mx.org; Tue, 14 Sep 2021 00:04:46 +0200 Original-Received: from localhost ([::1]:46336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPu4C-00009b-Vj for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Sep 2021 18:04:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPu30-0007un-TV for emacs-devel@gnu.org; Mon, 13 Sep 2021 18:03:30 -0400 Original-Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:40838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPu2y-0005hw-7L for emacs-devel@gnu.org; Mon, 13 Sep 2021 18:03:30 -0400 Original-Received: by mail-wr1-x432.google.com with SMTP id q26so16886180wrc.7 for ; Mon, 13 Sep 2021 15:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ETyJStqRCxMZE57CixIfc43fcfqiZ5ZURo1vAV0D3sU=; b=BCO9d2IWHc0kMyjFxig8ONu5rtuS040frFpXF2EqztCZicFVwBABwipFQ2O8yjWC5p WK4A9KmMCt9HAeWsdMlcT5MKfEyhuRctugDiMJiWJSk17BFo/ujk2OisrfFPkdhDGbmA OVwJedfNYJhnpdbP1bPgFXREjZ0tJVBTL2QSiA5Oomd9bSDoNyW2EzjbiUihOoaHzr9F eE6OgrOKciL6zs839sHU6BaDuGAixYM5MMTp8ogGBTIQYYLiruWYGE+53IigTNcQN/a0 Th411a+aM8KH1g7mlvvlf/6VLEU9SdJLzRUoA5dOEQF6SxdBtl3qHIart+bbiaZW6LvT u+Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ETyJStqRCxMZE57CixIfc43fcfqiZ5ZURo1vAV0D3sU=; b=TdRFot91+peMd75/7weLPFUUOaaIPiFGIqYnelQK43czAkzayv2KV68lTwpX6QW8D4 SjIo/cKinTp44kxCGTsJsq+8Z51pw+Fc/eUiXDukHPYHcWTl2HfthxaywLn2DvkjG0U9 vZcz1lBdr2UgAD/ethyM174KWRPwlSYt019B5sRgvOm5kYLDIPuzRL+CFziu+YwBCXsb EruppvSiWSe+MW5zStr4gsPsenRtICeHc15zxjPwakIdLKpjwi/cLlBG9C3zSdDEaOti xTolwKQ04RzV1o2cfw7T+sSZMFH8RP3s075BTJq8HZ8DQrRFOSK4elfe6eP71eSMZGFz PHfw== X-Gm-Message-State: AOAM5309dlLOP65fmWoxtm4ciLCnm5gW9fT0p/gB3P/OlP2hItU8a03V WAmpjXU46FXlyihB8tHUq3TTLTb9/XQ= X-Google-Smtp-Source: ABdhPJzOX5FpPlTWCrtIHiPWJVfggBcUlpvCOKcIugP39oJ+EBw2T4MU8s1WDbZHHqzXQT3C7PfTsQ== X-Received: by 2002:adf:e108:: with SMTP id t8mr14800149wrz.84.1631570605980; Mon, 13 Sep 2021 15:03:25 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id u6sm10320932wrp.0.2021.09.13.15.03.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Sep 2021 15:03:25 -0700 (PDT) In-Reply-To: <871r5sd0wa.fsf@gnus.org> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=raaahh@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-1.969, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:274669 Archived-At: Hi! On 13.09.2021 17:07, Lars Ingebrigtsen wrote: > I was looking at > > *** 'project-find-file' doesn't use the string at point as default input. > Now it's only suggested as part of the "future history". > > which comes from > > commit fa895379d6166c52b89774a9e450a94c2e429dae > Author: Dmitry Gutov > AuthorDate: Fri Aug 6 03:30:10 2021 +0300 > > Change how project-find-file's completion works > > * lisp/progmodes/project.el (project--completing-read-strict): > Allow to choose a non-existent file, with confirmation > (bug#49204). > Don't use the string at point as a "real" default, and instead > only include it in "future history": meaning, it will be inserted > on 'M-n' (bug#49865). > > And, indeed, it doesn't put anything in the default. However, I'm > getting a bit confused trying to follow the logic: > > (defun project-or-external-find-file () > "Visit a file (with completion) in the current project or external roots. > > The completion default is the filename at point, determined by > `thing-at-point' (whether such file exists or not)." > > So this says "default", but "completion default"... (And same string in > project-find-file). Also: > > @findex project-find-file > [...] > belonging to the current project, and nothing else. If there's a file > name at point, this command offers that file as the default to visit. > > However, we basically end up calling: > > (uniq-file-read "Prompt" nil nil nil "file-name") > > there "file-name" is in the DEFAULT position, but is put in the "future > history". Indeed, there is a documentation problem. Part of it is that "future history" is not a well-known/defined concept, yet it is pretty useful. Another - that future history is added to using a variable called minibuffer-default-add-function. I've tried to improve the docs in commit 5a34b65a3b, not sure by how much. See how you like the result. As far as using DEFAULT for default, it has been the previous behavior, and reasons for the change are hopefully apparent from the linked discussion. There have also been some other complaints/requests that have been resolved with that change. > Furthermore, `M-x project-find-file RET RET': > > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > expand-file-name(nil) > find-file-noselect(nil nil nil nil) > find-file(nil) > project-find-file-in(#("." 0 1 (fontified t)) ("~/src/emacs/trunk/") (vc . "~/src/emacs/trunk/")) > project-find-file() > funcall-interactively(project-find-file) > > So I think this needs a bit more updating in the doc > strings/documentation/parameter names, and perhaps a different way of > erroring out on RET. (Or even actually using the DEFAULT as a default.) This is really a bug of completing-read: returning "" on RET even if REQUIRE-MATCH is t. Probably a "feature" since the bug is decades old. I've made it loop on RET instead now, hopefully it will resolve this scenario. FWIW, I couldn't repro the wrong-type-argument error here, but the behavior was surprising nevertheless.