From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 30 04:31:56 2024 Received: (at submit) by debbugs.gnu.org; 30 Jan 2024 09:31:56 +0000 Received: from localhost ([127.0.0.1]:34230 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUkTE-0002q7-8g for submit@debbugs.gnu.org; Tue, 30 Jan 2024 04:31:56 -0500 Received: from lists.gnu.org ([2001:470:142::17]:59274) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUkTB-0002pt-F9 for submit@debbugs.gnu.org; Tue, 30 Jan 2024 04:31:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUkSw-00005G-MF for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 04:31:39 -0500 Received: from out-176.mta1.migadu.com ([95.215.58.176]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUkSu-00062Q-CE for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 04:31:38 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1706607090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=a+ayQUZdWbahIS0yTuu/euINlyDKBtetxN1/vgsSKrQ=; b=j5PsHQ94cEpB4Y3GSthcM4p4t5sih1AG+5fs4oamhce0+QK91htOSvVIsKLIOwI1JFaatD +LyMJQ3q9ClsS51rF5okLzyV1e8FT/qCyeAOy2l9YdlRP0/WZnFLj9Af+mnnAggKbEysOC MuzwYbjEHhVH+8QB5GL61yROL0jTzmE= From: Joseph Turner To: Emacs Bugs Mailing List Subject: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument Date: Tue, 30 Jan 2024 01:00:47 -0800 X-Debbugs-Cc: Philip Kaludercic , Stefan Monnier , michael_heerdegen@web.de, Eli Zaretskii Message-ID: <8734ufyxoy.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=95.215.58.176; envelope-from=joseph@breatheoutbreathe.in; helo=out-176.mta1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Hello! With #66187 resolved (), I reexamined #66114 (), only to discover that filename completion with a functional REQUIRE-MATCH argument doesn't work as expected. To reproduce: emacs -Q on the tip of the emacs-29 branch (after commit 77f5d4d523a), run... (let ((default-directory "~/")) (read-directory-name "Clone into new or empty directory: " nil nil (lambda (dir) (or (not (file-exists-p dir)) (directory-empty-p dir))))) ...then type "/tmp/" (the whole minibuffer now reads "~//tmp") then RET. Expected: Completion does not exit, instead saying "[No match]". Actual: Completion exits, returning "/tmp/". If I delete the leading "~/" before typing "/tmp/", I get the expected result. The issue appears to be inside completion--complete-and-exit: ((functionp minibuffer-completion-confirm) (if (funcall minibuffer-completion-confirm (buffer-substring beg end)) ; Here, buffer-substring returns "~//tmp/" (funcall exit-function) (unless completion-fail-discreetly (ding) (completion--message "No match")))) Since (file-exists-p "~//tmp/") returns nil, the whole predicate returns t and the minibuffer completes "/tmp/". In completion--complete-and-exit, should (buffer-substring beg end) return only "/tmp/"? Or maybe (file-exists-p "~//tmp/") should return t? Thank you!! Joseph From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 30 08:08:34 2024 Received: (at 68815) by debbugs.gnu.org; 30 Jan 2024 13:08:34 +0000 Received: from localhost ([127.0.0.1]:34554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUnqr-0003Fk-Mo for submit@debbugs.gnu.org; Tue, 30 Jan 2024 08:08:33 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:16044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUnqm-0003FR-Cv for 68815@debbugs.gnu.org; Tue, 30 Jan 2024 08:08:33 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 27D584411A1; Tue, 30 Jan 2024 08:08:13 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1706620092; bh=ohgAeCDy5FLMKlVjheUs3wEck7qhlIEG80+HGrObjBM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=k/1r0mAsEQdUWoFqKqm6AwABx/o4zlorGFeJkSpV4vG64slq8wXw/oGJWHOJr/u4W AlCpK3JRqpKYmHXmGYiqE68H10zk8s2xCwU713Sm5EVZoUyDoZe2vCM5U9V1KfPwNy W8is1QcZ4iEWYKsJfHGZfXCm4zUEKIUaqQGAuE/bUKsjqqphrKvgeTRHG3Ci5yMGdG H8a8eqHruT56At6kwQnMFQ6s1tpwhHfehFgai/nrRQf2sxrkIM7HFDDjpC6c+6OzXF aMaDW6nMgcZo2ntCT7CexTVGvRykDnSJPRNZODwS4tL/OMrJThcLN3S1V2e//UaT3b e/bArHc6C9ecA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F3D30441278; Tue, 30 Jan 2024 08:08:11 -0500 (EST) Received: from pastel (104-222-119-131.cpe.teksavvy.com [104.222.119.131]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BCA1412062F; Tue, 30 Jan 2024 08:08:11 -0500 (EST) From: Stefan Monnier To: Joseph Turner Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument In-Reply-To: <8734ufyxoy.fsf@breatheoutbreathe.in> (Joseph Turner's message of "Tue, 30 Jan 2024 01:00:47 -0800") Message-ID: References: <8734ufyxoy.fsf@breatheoutbreathe.in> Date: Tue, 30 Jan 2024 08:08:11 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.234 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, Philip Kaludercic , 68815@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > emacs -Q on the tip of the emacs-29 branch (after commit 77f5d4d523a), ru= n... > > (let ((default-directory "~/")) > (read-directory-name "Clone into new or empty directory: " nil nil > (lambda (dir) (or (not (file-exists-p dir)) > (directory-empty-p dir))))) > > ...then type "/tmp/" (the whole minibuffer now reads "~//tmp") then RET. > > Expected: Completion does not exit, instead saying "[No match]". Ah, that good old problem about whether PRED should apply to the quoted or to the unquoted string =F0=9F=99=81 I think here the bug is in `read-directory-name` (and `read-file-name`) since their PRED arg is expected to apply to the (unquoted) file name itself (i.e. the thing that would be returned by the function), rather than to the quoted representation used in the minibuffer. They should wrap PRED so as to pass the arg through `substitute-in-file-name` (or otherwise arrange to make sure PRED is called with an unquoted file name). Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 31 01:14:09 2024 Received: (at 68815) by debbugs.gnu.org; 31 Jan 2024 06:14:09 +0000 Received: from localhost ([127.0.0.1]:37303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rV3rN-0003q8-3Y for submit@debbugs.gnu.org; Wed, 31 Jan 2024 01:14:09 -0500 Received: from out-186.mta0.migadu.com ([91.218.175.186]:56335) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rV3rK-0003pU-H4 for 68815@debbugs.gnu.org; Wed, 31 Jan 2024 01:14:07 -0500 References: <8734ufyxoy.fsf@breatheoutbreathe.in> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1706681630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1gynuNCRLaTuGRdV/GaAywWk9+Vq9k+rYnTcAltevMY=; b=iqkhDZCyxeD7RDwPrbCpjJRcIDDXG+gpytBsbWg1V05/+mH6aD+3pq8wr5/2YpcuHuo22s JXtYkL7xkecMVXRN/lkC56nI11OKpGDjwqDoTJeHNucCpmkvfMzm18nTAuID2qXS0x79K4 DKVF+8BL/tRUR8mblwx7wueaoK6Hoyg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Joseph Turner To: Stefan Monnier Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument Date: Tue, 30 Jan 2024 22:11:37 -0800 In-reply-to: Message-ID: <87ttmuhvxi.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, Philip Kaludercic , 68815@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Stefan! Stefan Monnier writes: >> emacs -Q on the tip of the emacs-29 branch (after commit 77f5d4d523a), r= un... >> >> (let ((default-directory "~/")) >> (read-directory-name "Clone into new or empty directory: " nil nil >> (lambda (dir) (or (not (file-exists-p dir)) >> (directory-empty-p dir))))) >> >> ...then type "/tmp/" (the whole minibuffer now reads "~//tmp") then RET. >> >> Expected: Completion does not exit, instead saying "[No match]". > > Ah, that good old problem about whether PRED should apply to the > quoted > or to the unquoted string =F0=9F=99=81 > > I think here the bug is in `read-directory-name` (and > `read-file-name`) > since their PRED arg is expected to apply to the (unquoted) file name > itself (i.e. the thing that would be returned by the function), rather > than to the quoted representation used in the minibuffer. > > They should wrap PRED so as to pass the arg through > `substitute-in-file-name` (or otherwise arrange to make sure PRED is > called with an unquoted file name). Thank you for the clear instructions! Does the attached patch do the right thing? If so, may it be applied to emacs-29? Joseph --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Pass-unquoted-filename-to-user-supplied-MUSTMATCH-pr.patch >From 78c7232593cc12bdf3e772df602d75a31bc4fd2a Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Tue, 30 Jan 2024 22:08:50 -0800 Subject: [PATCH] Pass unquoted filename to user-supplied MUSTMATCH predicate * lisp/minibuffer.el (read-file-name-default): Resolves bug#68815. --- lisp/minibuffer.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index faa7f543ece..1f0f3bdade3 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3353,7 +3353,13 @@ See `read-file-name' for the meaning of the arguments." (let ((ignore-case read-file-name-completion-ignore-case) (minibuffer-completing-file-name t) (pred (or predicate 'file-exists-p)) - (add-to-history nil)) + (add-to-history nil) + (require-match (if (functionp mustmatch) + (lambda (input) + (funcall mustmatch + ;; User-supplied MUSTMATCH expects an unquoted filename + (substitute-in-file-name input))) + mustmatch))) (let* ((val (if (or (not (next-read-file-uses-dialog-p)) @@ -3389,7 +3395,7 @@ See `read-file-name' for the meaning of the arguments." (read-file-name--defaults dir initial)))) (set-syntax-table minibuffer-local-filename-syntax)) (completing-read prompt 'read-file-name-internal - pred mustmatch insdef + pred require-match insdef 'file-name-history default-filename))) ;; If DEFAULT-FILENAME not supplied and DIR contains ;; a file name, split it. -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 31 08:28:21 2024 Received: (at 68815) by debbugs.gnu.org; 31 Jan 2024 13:28:21 +0000 Received: from localhost ([127.0.0.1]:37720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVAdZ-0001fx-Ah for submit@debbugs.gnu.org; Wed, 31 Jan 2024 08:28:21 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:33246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVAdX-0001fh-5t for 68815@debbugs.gnu.org; Wed, 31 Jan 2024 08:28:19 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 8F1BE4415C7; Wed, 31 Jan 2024 08:28:03 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1706707682; bh=XSqWmjeXQEIs19e1JHSo4jsID8mr+ZRtBInlBAkSfFg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ZLl7Z/pjvMbeoohoo3jJc86zl1Q01G4HNQKpuiMp7KTlt0GqRXSW6QX5ft3rVLTZk VqXvJyk1ijSmcjS/7AKihReg9MjoFMRVu8Q3jqt5O8s9MOx+5fwxnYKfYIVOcBwiSg 0ntbDPWYpzXbVTsSb6f6BC4UwBEhwW38bK9pKb8PsQfk6LcJfY+moVMwMWtdyT5bZC XwUc+Gx/k+44pjmtq52XGm0krxlUgIYYReL2sge3RGat6rn+f3C+ymxO/VHR1vkw5H s1ivNkRSWbzSg6o+uzWLUP83zeubAVpqSssGeU71bxNXVRrB5rkpNIIy4cPicd/nsA mgoSxmcWSGgMA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5FDD24402EC; Wed, 31 Jan 2024 08:28:02 -0500 (EST) Received: from pastel (104-222-119-131.cpe.teksavvy.com [104.222.119.131]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2E58F120AA9; Wed, 31 Jan 2024 08:28:02 -0500 (EST) From: Stefan Monnier To: Joseph Turner Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument In-Reply-To: <87ttmuhvxi.fsf@breatheoutbreathe.in> (Joseph Turner's message of "Tue, 30 Jan 2024 22:11:37 -0800") Message-ID: References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> Date: Wed, 31 Jan 2024 08:28:01 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.337 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, Philip Kaludercic , 68815@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> They should wrap PRED so as to pass the arg through >> `substitute-in-file-name` (or otherwise arrange to make sure PRED is >> called with an unquoted file name). > Thank you for the clear instructions! Does the attached patch do the > right thing? I theory, I think it's correct, yes. Whether the rest of the code handles it correctly OTOH is a different question. E.g. I have the impression that currently the `read-file-name-internal` completion table presumes the PRED argument takes an already-unquoted file name. Also, performance can be a concern (in many cases it makes more sense to make the caller pass the unquoted name rather than force it to quote the name only for PRED to unquote it). IOW, I think we have a bit of a mess in our hands (that's what I was meant by "good old problem" =F0=9F=99=81). > If so, may it be applied to emacs-29? Definitely not material for `emacs-29` I'm afraid. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 31 16:49:53 2024 Received: (at 68815) by debbugs.gnu.org; 31 Jan 2024 21:49:53 +0000 Received: from localhost ([127.0.0.1]:39141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVISv-0005FS-22 for submit@debbugs.gnu.org; Wed, 31 Jan 2024 16:49:53 -0500 Received: from out-177.mta1.migadu.com ([95.215.58.177]:19871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVISr-0005FF-Qb for 68815@debbugs.gnu.org; Wed, 31 Jan 2024 16:49:50 -0500 References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1706737778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GHiJWxdDXgYaD+SRJUji+DH7QAich2QjgYY/sBO4KWY=; b=IFjqGBbmP2fR7kEyjpkjY5tPZyyvmRkt4nUbubTQIGGS3d/Qn7ITKULFPGJlM4ESajAfmi rivtyhsvssk5ltaYWkA0NfIV7kMAjtQPKDQNVmhSyhpfHt6LQ4lvOBqDRwJMphQn45r+vs seF+oFv9RkjQJYovj5daXmC+fJ7t/9c= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Joseph Turner To: Stefan Monnier Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument Date: Wed, 31 Jan 2024 11:33:31 -0800 In-reply-to: Message-ID: <875xz98975.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, Philip Kaludercic , 68815@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier writes: >>> They should wrap PRED so as to pass the arg through >>> `substitute-in-file-name` (or otherwise arrange to make sure PRED is >>> called with an unquoted file name). >> Thank you for the clear instructions! Does the attached patch do the >> right thing? > > I theory, I think it's correct, yes. > > Whether the rest of the code handles it correctly OTOH is a different > question. E.g. I have the impression that currently the > `read-file-name-internal` completion table presumes the PRED argument > takes an already-unquoted file name. What other code would this patch affect? I see that `completion--file-name-table' uses `substitute-in-file-name', but I don't understand how this patch would affect completion table. > Also, performance can be a concern (in many cases it makes more sense > to make the caller pass the unquoted name rather than force it to quote > the name only for PRED to unquote it). The REQUIRE-MATCH function is only called once when the user attempts to exit the minibuffer. Would you please explain the performance concern? Thank you! Joseph From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 31 17:07:05 2024 Received: (at 68815) by debbugs.gnu.org; 31 Jan 2024 22:07:05 +0000 Received: from localhost ([127.0.0.1]:39152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVIjY-0005le-Sy for submit@debbugs.gnu.org; Wed, 31 Jan 2024 17:07:05 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVIjX-0005l8-So for 68815@debbugs.gnu.org; Wed, 31 Jan 2024 17:07:04 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 67F8610009F; Wed, 31 Jan 2024 17:06:48 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1706738807; bh=L9rQAWWQIIcii50rCAQyCjtUF4YHtAbzH5DnqqbyJ3o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=VBSVbJiU/1AKDGk1BdFrtcLO7qaHbX0+uHbR/8/N7Nu601lJdUXl+UzKb76GIA0/n RaIixuR/18bPp9GWqPFChWZljGGzVusnv7ROHyrAZL8+VLBXF26mZdfZQihhF7bZCY kruzmj5ZJTu0nktdxDeXkfE6Buat38TVZOBip2f9R3W9K7jZ5zTmV6kZ6zv632lp8k Izbm/BRU1AUz/rLKkFIHBtyy18bcAwXWHVq49T/G6S5KOYpOX3rVhS/wTmzDt2B13+ lAtF+GwtI2+QsWbfi5oXscotOudCn1P0W4k31v+5kPvrR50zo0waVMBgRuXhclOMTx q+/9Z89pVT1vQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 704D6100068; Wed, 31 Jan 2024 17:06:47 -0500 (EST) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 60E19120B6C; Wed, 31 Jan 2024 17:06:47 -0500 (EST) From: Stefan Monnier To: Joseph Turner Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument In-Reply-To: <875xz98975.fsf@breatheoutbreathe.in> (Joseph Turner's message of "Wed, 31 Jan 2024 11:33:31 -0800") Message-ID: References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> <875xz98975.fsf@breatheoutbreathe.in> Date: Wed, 31 Jan 2024 17:05:30 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.204 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, Philip Kaludercic , 68815@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> Also, performance can be a concern (in many cases it makes more sense >> to make the caller pass the unquoted name rather than force it to quote >> the name only for PRED to unquote it). > > The REQUIRE-MATCH function is only called once when the user attempts to > exit the minibuffer. Would you please explain the performance concern? Oh, sorry, I got confused. Indeed, you're wrapping the REQUIRE-MATCH arg, not the PRED arg I was ranting about. Duh! It would be OK for `emacs-29`, indeed. Eli? Stefan? Any objection? In the mean time, could you update the docs to clarify the behavior. E.g. currently the docstring of `read-file-name` says: - a function, which will be called with the input as the argument. [...] which could be understood to suggest it really receives the contents of the minibuffer (i.e. the quoted file name) rather than the value we'd extract from it (the unquoted file name). Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 31 17:37:34 2024 Received: (at 68815) by debbugs.gnu.org; 31 Jan 2024 22:37:34 +0000 Received: from localhost ([127.0.0.1]:39195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVJD3-0006bp-So for submit@debbugs.gnu.org; Wed, 31 Jan 2024 17:37:34 -0500 Received: from out-174.mta1.migadu.com ([2001:41d0:203:375::ae]:61783) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVJD1-0006be-89 for 68815@debbugs.gnu.org; Wed, 31 Jan 2024 17:37:32 -0500 References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> <875xz98975.fsf@breatheoutbreathe.in> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1706740639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=G6NP5s2Z5qrnEZJK7ioGejECDd/aDFazWNcdAW+pYug=; b=N7F9GF9FjDxfiOY5tkpyN++FGL9hDvIX+qpbcEtTZWolc/aJFs8mGEcwAcFPZe3otxlipV rOfLdhBB09hm1VzyNkLn9bSZ53KDltacFbDt1Hk2LH5PXJxCEMUZCtlJKmeyXFr8TGEbSS lNOr80kzGKCaP8g2U/GdHwyvqpPUCa0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Joseph Turner To: Stefan Monnier Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument Date: Wed, 31 Jan 2024 14:34:22 -0800 In-reply-to: Message-ID: <87sf2d6sf8.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, Philip Kaludercic , 68815@debbugs.gnu.org, Eli Zaretskii , stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Stefan Monnier writes: >>> Also, performance can be a concern (in many cases it makes more sense >>> to make the caller pass the unquoted name rather than force it to quote >>> the name only for PRED to unquote it). >> >> The REQUIRE-MATCH function is only called once when the user attempts to >> exit the minibuffer. Would you please explain the performance concern? > > Oh, sorry, I got confused. Indeed, you're wrapping the REQUIRE-MATCH > arg, not the PRED arg I was ranting about. Duh! > > It would be OK for `emacs-29`, indeed. Eli? Stefan? Any objection? Great! I've CC'd Stefan as well in this email. > In the mean time, could you update the docs to clarify the behavior. > E.g. currently the docstring of `read-file-name` says: > > - a function, which will be called with the input as the > argument. [...] > > which could be understood to suggest it really receives the contents of > the minibuffer (i.e. the quoted file name) rather than the value we'd > extract from it (the unquoted file name). Please see the attached patch. Thanks! Joseph --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Pass-unquoted-filename-to-user-supplied-MUSTMATCH-pr.patch >From 208c7abff97f842057540fa2dfacd99808f17015 Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Tue, 30 Jan 2024 22:08:50 -0800 Subject: [PATCH] Pass unquoted filename to user-supplied MUSTMATCH predicate * lisp/minibuffer.el (read-file-name-default): Pass REQUIRE-MATCH argument through substitute-in-file-name. * lisp/minibuffer.el (read-file-name): Update docstring. Resolves bug#68815. --- lisp/minibuffer.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index faa7f543ece..a9e3ec937f9 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3262,9 +3262,10 @@ Fourth arg MUSTMATCH can take the following values: input, but she needs to confirm her choice if she called `minibuffer-complete' right before `minibuffer-complete-and-exit' and the input is not an existing file. -- a function, which will be called with the input as the - argument. If the function returns a non-nil value, the - minibuffer is exited with that argument as the value. +- a function, which will be called with a single argument, the + input unquoted by `substitute-in-file-name', which see. If the + function returns a non-nil value, the minibuffer is exited with + that argument as the value. - anything else behaves like t except that typing RET does not exit if it does non-null completion. @@ -3353,7 +3354,13 @@ See `read-file-name' for the meaning of the arguments." (let ((ignore-case read-file-name-completion-ignore-case) (minibuffer-completing-file-name t) (pred (or predicate 'file-exists-p)) - (add-to-history nil)) + (add-to-history nil) + (require-match (if (functionp mustmatch) + (lambda (input) + (funcall mustmatch + ;; User-supplied MUSTMATCH expects an unquoted filename + (substitute-in-file-name input))) + mustmatch))) (let* ((val (if (or (not (next-read-file-uses-dialog-p)) @@ -3389,7 +3396,7 @@ See `read-file-name' for the meaning of the arguments." (read-file-name--defaults dir initial)))) (set-syntax-table minibuffer-local-filename-syntax)) (completing-read prompt 'read-file-name-internal - pred mustmatch insdef + pred require-match insdef 'file-name-history default-filename))) ;; If DEFAULT-FILENAME not supplied and DIR contains ;; a file name, split it. -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 31 17:45:00 2024 Received: (at 68815) by debbugs.gnu.org; 31 Jan 2024 22:45:00 +0000 Received: from localhost ([127.0.0.1]:39199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVJKF-0006mO-Uy for submit@debbugs.gnu.org; Wed, 31 Jan 2024 17:45:00 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:56710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVJKD-0006mB-VP for 68815@debbugs.gnu.org; Wed, 31 Jan 2024 17:44:58 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-55c2cf644f3so366571a12.1 for <68815@debbugs.gnu.org>; Wed, 31 Jan 2024 14:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706741082; x=1707345882; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=b8IvdOVcf905Mkam08NDuaK4Sk/Jw3JZ+h/iuDqsGlM=; b=ZZrEUcTOuiyl/77yP3M0wZqS4ze4cCDM+7tMCqFru7eaXZSLTwwClH7iygP6nLsBln 2kZREbvaycC8h+yvc837Wr9GzonSzFMYf5s8BJ6AaAy3AVo0NcKSL0a9NryCEjdD7A4s NUOcm3EhKWiVTg9s9W7Bav8g0sSfOHBis1ClJRYBPWXDwFfSHZaTtG0bqGk8eE9vbs9i LufW7WnuyMkr/uQvGT1Qj896BYaJ1yciV93N9PyZwwO1OKHmV4fMyi6oEhvASpYazYHR EVNH83yqHxA8qNOdv+H3H4DKVf9RgrW3+dI7JCtQs7rnKvIkRbALufUqf/fHVAdSZGT4 QJPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706741082; x=1707345882; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=b8IvdOVcf905Mkam08NDuaK4Sk/Jw3JZ+h/iuDqsGlM=; b=UuLCUaw41jMcZO1sS/AFWclk4PyYnRTCTllHY6wDtBHCmXdbGkaVW3PFpy0oGkwLXI OVafMSa2BwOy7R2AyVZDuSsX/fmSexiDuMTYj4MDoqfkkgQRFm+F5Ad0LUvkdt4P93oZ /dWCLjDUT4yXLCGjzobTSnBENVXIZPAl7GnKbnIuQ+c+KvwSQ6hCnYNLx9CvmDER6xqz GfCKTZP0JbHNQttqKuCgmhaPIaek/XtYJFaipZCTJUVD4tXSxU9+3V6cxij5oR5nO0oi E6QogD/OcUqXP0ApLTutUQUdGLweIHtFeHylky9DGuM3D2NG6WEkNEhMHWsBUPoFPhZ3 qEIw== X-Gm-Message-State: AOJu0YyIPFGVk7Vt0J8VvcG5cObFWIwPHGPeEGOrsv/Bnw93dCbAOZ8/ XzQIaG74H79NzODVsLhW/vyCoHx5jetu+0e1bDaNJrmCheJfG9P2hgdgqtqj3ACujK3zAjV3CyJ CMy7vz7bWTPHnlOuZxLUzCr0v4K4= X-Google-Smtp-Source: AGHT+IF2YYR7D4n+jmyve073Y3TGhzXpYLYrxO0mbumUZ0ZRTc/ImoDrS2EoEmKnKwprUOJiJfIBnsxaljKoS9bTREI= X-Received: by 2002:a50:cd1b:0:b0:55d:2ecf:eb1b with SMTP id z27-20020a50cd1b000000b0055d2ecfeb1bmr2166365edi.1.1706741082262; Wed, 31 Jan 2024 14:44:42 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 31 Jan 2024 17:44:41 -0500 From: Stefan Kangas In-Reply-To: References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> <875xz98975.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Date: Wed, 31 Jan 2024 17:44:41 -0500 Message-ID: Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument To: Stefan Monnier , Joseph Turner Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, Philip Kaludercic , 68815@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > It would be OK for `emacs-29`, indeed. Eli? Stefan? Any objection? None here. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 01 01:59:46 2024 Received: (at 68815) by debbugs.gnu.org; 1 Feb 2024 06:59:46 +0000 Received: from localhost ([127.0.0.1]:40105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVR33-00067c-O2 for submit@debbugs.gnu.org; Thu, 01 Feb 2024 01:59:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVR31-00067Q-Iu for 68815@debbugs.gnu.org; Thu, 01 Feb 2024 01:59:44 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVR2j-000462-UD; Thu, 01 Feb 2024 01:59:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=kHEXvv/4yBq+jzk6TtNtn1iPfrpUfY0ZsUI1P6fHH9g=; b=ONLKlh4TyJc/ wQ4s/HQeZ03kyAaUa1E9RRtrkErmPgldLf98cnNZhrJTkn6hxE0gVXEUxyNK1XVXIbTx+Juu4s5wW gs1+Ox3Z5AkYlvy+BEo64ygzIBeMFA9EoLNm09yM+NzAE4tD5CpUlpVUAH/CfAu13+yr/Kc7/d+a1 CyCtR1K4RhCcuChf+3pePVmn5AmJX4VxTkQoZbPY49MqRzVeVxqIIPvTk+i7GGsKeH4MEdiz+OZRL sJC3JImG2j+R9B02i3EXa+JXsJ3ej2NktStnF4+mfO+mUQyBcmCJoH3nFPMlb1LypTcsZfJxcB/Qt wLZazFmQOQmOys1SOHtOPw==; Date: Thu, 01 Feb 2024 08:59:24 +0200 Message-Id: <86jzno1xgz.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Wed, 31 Jan 2024 17:05:30 -0500) Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> <875xz98975.fsf@breatheoutbreathe.in> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, philipk@posteo.net, 68815@debbugs.gnu.org, joseph@breatheoutbreathe.in X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: 68815@debbugs.gnu.org, Philip Kaludercic , > michael_heerdegen@web.de, Eli Zaretskii > Date: Wed, 31 Jan 2024 17:05:30 -0500 > > >> Also, performance can be a concern (in many cases it makes more sense > >> to make the caller pass the unquoted name rather than force it to quote > >> the name only for PRED to unquote it). > > > > The REQUIRE-MATCH function is only called once when the user attempts to > > exit the minibuffer. Would you please explain the performance concern? > > Oh, sorry, I got confused. Indeed, you're wrapping the REQUIRE-MATCH > arg, not the PRED arg I was ranting about. Duh! > > It would be OK for `emacs-29`, indeed. Eli? Stefan? Any objection? I don't mind, but please note that I'm not sure there will be any further 29.x releases. > In the mean time, could you update the docs to clarify the behavior. Yes, please. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 01 02:06:02 2024 Received: (at 68815) by debbugs.gnu.org; 1 Feb 2024 07:06:02 +0000 Received: from localhost ([127.0.0.1]:40109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVR97-0006II-Ko for submit@debbugs.gnu.org; Thu, 01 Feb 2024 02:06:02 -0500 Received: from out-176.mta0.migadu.com ([2001:41d0:1004:224b::b0]:48326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVR94-0006Hz-8r for 68815@debbugs.gnu.org; Thu, 01 Feb 2024 02:05:59 -0500 References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> <875xz98975.fsf@breatheoutbreathe.in> <86jzno1xgz.fsf@gnu.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1706771141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UlCh8AN1iP5f8x0Ps9XA+L5JUujHAbkqkW/Zb52RaDs=; b=mYjq45hpRR40ST+iQsyT3XU41kIWvEBcnt4I7Z5wIM6iCD50/7HliWsKhj7CyKECj3e0V7 hI6MP50OqvgglMotklf9RBNoeF1+y6NEXxdxXqhk0MvEywyq/rlZSVrH7i8nnXaOxW/fNQ 6q2o/uwMfol2neZEZPfbKUggAcS4QOQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Joseph Turner To: Eli Zaretskii Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument Date: Wed, 31 Jan 2024 23:04:59 -0800 In-reply-to: <86jzno1xgz.fsf@gnu.org> Message-ID: <87cytg7jge.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, philipk@posteo.net, 68815@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Stefan Monnier >> Cc: 68815@debbugs.gnu.org, Philip Kaludercic , >> michael_heerdegen@web.de, Eli Zaretskii >> Date: Wed, 31 Jan 2024 17:05:30 -0500 >> >> >> Also, performance can be a concern (in many cases it makes more sense >> >> to make the caller pass the unquoted name rather than force it to quote >> >> the name only for PRED to unquote it). >> > >> > The REQUIRE-MATCH function is only called once when the user attempts to >> > exit the minibuffer. Would you please explain the performance concern? >> >> Oh, sorry, I got confused. Indeed, you're wrapping the REQUIRE-MATCH >> arg, not the PRED arg I was ranting about. Duh! >> >> It would be OK for `emacs-29`, indeed. Eli? Stefan? Any objection? > > I don't mind, but please note that I'm not sure there will be any > further 29.x releases. Good to know. What is the purpose of keeping the emacs-29 branch, then? >> In the mean time, could you update the docs to clarify the behavior. > > Yes, please. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 01 02:40:13 2024 Received: (at 68815) by debbugs.gnu.org; 1 Feb 2024 07:40:13 +0000 Received: from localhost ([127.0.0.1]:40179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVRgC-0007DX-QY for submit@debbugs.gnu.org; Thu, 01 Feb 2024 02:40:13 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:47118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVRgA-0007DD-JR for 68815@debbugs.gnu.org; Thu, 01 Feb 2024 02:40:11 -0500 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-556c3f0d6c5so687165a12.2 for <68815@debbugs.gnu.org>; Wed, 31 Jan 2024 23:40:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706773194; x=1707377994; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=uYsYQx+mIf6yqC0ddDIpcRLcosFJkL3M6VSVpeyARi4=; b=nS9MURZ+1tyEQv6rd7YLoqBpuxEVFuLfSqPR+4fmirbKj5le8kIQbePhlglaPIxS6W GOF9Dx3UZzr46G9Q7pTVBE93guFkmx4YcIsdJkFKnv3Fo7ImFVjs/TIUc7cI6HViRf2U qhdD0KHWaoO/DM9V/RRzRxkJiz39vCTi5GAe7Y18xka9ZwzWl/2DYOC9GnhOic5C0uOg ECG+cm9MldydUjibiaEnKyhNBz5/CGtJE1PtpP0C92Vlwe+YlAvnDQ/3kCy3AMW+yZlP 1eTAsaMZOxjxqzmC+E7ZdH7ZvTwkUmGtk6Tn5tehfrQndMEBQ0fQ2ykcj8f0n/qXUExH wvsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706773194; x=1707377994; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uYsYQx+mIf6yqC0ddDIpcRLcosFJkL3M6VSVpeyARi4=; b=Q1yC7Ttwavgf+ewmf4fcsZa1bUetHwhLJ5YroxNk13Fvsph74zzk33EXc7tD//GUCr SRF1r7cNODHfS5+SmicteLBZbX++2112oWhWV1+/YdQg/d5mDnosnBhReT4PiS+YPVv9 kzThEgfzXb0FDabosYzq3B/UOdtuky9MPH8UltskrKlpk1PbD/T/v9hXjcwVXMg5058L IpSKeARPVOn+zhCld4TAx8vVYEQU093gCK4C/is3sqh8VIhkEGTnRBiWG30EdGGyiouX 7h6CKsSO1gWsrL/FbAGQo/fFE/16yeFdCEHA30LwWEVxtpeQJV7VvpUIxIlVZEX2Y1Mt Wurg== X-Gm-Message-State: AOJu0Yx3H93RYOrK4nai2mYyAZ2FpWuxCkFB5ZX/5uW+NKnqm62ahnBq QPvcIAbeJbp0V9JLRLF0n8zN/A/dovZOGx89tSnWV2a7DofZpFgptQ69UzlsL6VTh3NbIdlh3Ni 7jShY6XYPF3Efkal7Bkgwbt+OQwE= X-Google-Smtp-Source: AGHT+IFNCq+7DfioSkC7zCjK7shVN51jSbuB3ezS1tE0CfN7TL869DbA046zJdy8qKhcaDL40+/cyxRr2qAKgbNlqe8= X-Received: by 2002:a05:6402:695:b0:55f:2821:553a with SMTP id f21-20020a056402069500b0055f2821553amr986015edy.13.1706773194406; Wed, 31 Jan 2024 23:39:54 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 31 Jan 2024 23:39:52 -0800 From: Stefan Kangas In-Reply-To: <87cytg7jge.fsf@breatheoutbreathe.in> References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> <875xz98975.fsf@breatheoutbreathe.in> <86jzno1xgz.fsf@gnu.org> <87cytg7jge.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Date: Wed, 31 Jan 2024 23:39:52 -0800 Message-ID: Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument To: Joseph Turner , Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, philipk@posteo.net, 68815@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > What is the purpose of keeping the emacs-29 branch, then? It'll be useful in case we do decide to release 29.3. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 01 03:00:30 2024 Received: (at 68815) by debbugs.gnu.org; 1 Feb 2024 08:00:30 +0000 Received: from localhost ([127.0.0.1]:40184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVRzp-00027T-R0 for submit@debbugs.gnu.org; Thu, 01 Feb 2024 03:00:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVRzk-00027D-MQ for 68815@debbugs.gnu.org; Thu, 01 Feb 2024 03:00:28 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVRzT-00085s-DT; Thu, 01 Feb 2024 03:00:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=NEO46Xg+MkkVNOeSo1SrZJs5HCBbAYNwW3SAq3TyIXI=; b=jQIG6VyQ6TpS o/aDX27vdb/jBKIabO1K4ZiUgvjd3FcojSi+rhon0Zde5nKauvAxhXMhYZ6zKX3siB2gXXkQfMK84 S6ikzZC/TUE33NrN0leBOiZCjbA+IzOglW523mszJh7qs3pSzfDb4QyVquf0eCZ+VpLdviDxdsGgj M7EPeoeIycEBTjXDF6nA725ZpYyTZcpItMqM3+9V3kGDUaYt4hmXZ0Fomjs1iLSuTyldIJ7c8BknC 0TCHI4v+mJ0lIF5qpUaj6/EHqUr9+paoAagxnDetiUAN2f31joU6ifNKXg8V/9kRouS2MmHpUwZ0D 6OLPh586kmNXa1VHjF33iw==; Date: Thu, 01 Feb 2024 09:59:57 +0200 Message-Id: <86bk901uo2.fsf@gnu.org> From: Eli Zaretskii To: Joseph Turner In-Reply-To: <87cytg7jge.fsf@breatheoutbreathe.in> (message from Joseph Turner on Wed, 31 Jan 2024 23:04:59 -0800) Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> <875xz98975.fsf@breatheoutbreathe.in> <86jzno1xgz.fsf@gnu.org> <87cytg7jge.fsf@breatheoutbreathe.in> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, philipk@posteo.net, 68815@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Joseph Turner > Cc: Stefan Monnier , 68815@debbugs.gnu.org, > philipk@posteo.net, michael_heerdegen@web.de > Date: Wed, 31 Jan 2024 23:04:59 -0800 > > > Eli Zaretskii writes: > > >> From: Stefan Monnier > >> Cc: 68815@debbugs.gnu.org, Philip Kaludercic , > >> michael_heerdegen@web.de, Eli Zaretskii > >> Date: Wed, 31 Jan 2024 17:05:30 -0500 > >> > >> >> Also, performance can be a concern (in many cases it makes more sense > >> >> to make the caller pass the unquoted name rather than force it to quote > >> >> the name only for PRED to unquote it). > >> > > >> > The REQUIRE-MATCH function is only called once when the user attempts to > >> > exit the minibuffer. Would you please explain the performance concern? > >> > >> Oh, sorry, I got confused. Indeed, you're wrapping the REQUIRE-MATCH > >> arg, not the PRED arg I was ranting about. Duh! > >> > >> It would be OK for `emacs-29`, indeed. Eli? Stefan? Any objection? > > > > I don't mind, but please note that I'm not sure there will be any > > further 29.x releases. > > Good to know. What is the purpose of keeping the emacs-29 branch, then? I'm not sure we will NOT release further 29.x versions, either. There could be some urgent issue that justifies another release, for example. My point is that the motivation for backporting improvements and fixes from master and for installing non-essential fixes on the release branch is supposed to go down, since we keep the branch active only for some unanticipated contingencies. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 01 17:26:59 2024 Received: (at 68815) by debbugs.gnu.org; 1 Feb 2024 22:26:59 +0000 Received: from localhost ([127.0.0.1]:43303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVfWN-0005Vi-6v for submit@debbugs.gnu.org; Thu, 01 Feb 2024 17:26:59 -0500 Received: from out-183.mta0.migadu.com ([2001:41d0:1004:224b::b7]:34678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVfWJ-0005VQ-4r for 68815@debbugs.gnu.org; Thu, 01 Feb 2024 17:26:58 -0500 References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> <875xz98975.fsf@breatheoutbreathe.in> <86jzno1xgz.fsf@gnu.org> <87cytg7jge.fsf@breatheoutbreathe.in> <86bk901uo2.fsf@gnu.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1706826398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RssCR7iubW3oera3YVDZ0mmNhB0m7274WdYhlF5DKWY=; b=k3TysuyUbseRMJ4tACr9itj23DK3lSayCadXx1TQmntPJvGKCbcEsLAMZEHYwR2oSgMS4r cOxny6nMROcYgZCuAGaeoyXvzZMJ9+ypox+OnkgFwUoklSBT7U5RCYYFRa9zZQFxT4z3aX ddPhcE4SlH/L1GSllmsMZticNHi4NF8= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Joseph Turner To: Eli Zaretskii Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument Date: Thu, 01 Feb 2024 14:26:18 -0800 In-reply-to: <86bk901uo2.fsf@gnu.org> Message-ID: <87eddv4y92.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68815 Cc: michael_heerdegen@web.de, philipk@posteo.net, 68815@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Joseph Turner >> Cc: Stefan Monnier , 68815@debbugs.gnu.org, >> philipk@posteo.net, michael_heerdegen@web.de >> Date: Wed, 31 Jan 2024 23:04:59 -0800 >> >> >> Eli Zaretskii writes: >> >> >> From: Stefan Monnier >> >> Cc: 68815@debbugs.gnu.org, Philip Kaludercic , >> >> michael_heerdegen@web.de, Eli Zaretskii >> >> Date: Wed, 31 Jan 2024 17:05:30 -0500 >> >> >> >> >> Also, performance can be a concern (in many cases it makes more sense >> >> >> to make the caller pass the unquoted name rather than force it to quote >> >> >> the name only for PRED to unquote it). >> >> > >> >> > The REQUIRE-MATCH function is only called once when the user attempts to >> >> > exit the minibuffer. Would you please explain the performance concern? >> >> >> >> Oh, sorry, I got confused. Indeed, you're wrapping the REQUIRE-MATCH >> >> arg, not the PRED arg I was ranting about. Duh! >> >> >> >> It would be OK for `emacs-29`, indeed. Eli? Stefan? Any objection? >> > >> > I don't mind, but please note that I'm not sure there will be any >> > further 29.x releases. >> >> Good to know. What is the purpose of keeping the emacs-29 branch, then? > > I'm not sure we will NOT release further 29.x versions, either. There > could be some urgent issue that justifies another release, for > example. > > My point is that the motivation for backporting improvements and fixes > from master and for installing non-essential fixes on the release > branch is supposed to go down, since we keep the branch active only > for some unanticipated contingencies. Thank you for explaining. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 06 16:09:20 2024 Received: (at 68815-done) by debbugs.gnu.org; 6 Feb 2024 21:09:20 +0000 Received: from localhost ([127.0.0.1]:55243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXSgp-00043X-W8 for submit@debbugs.gnu.org; Tue, 06 Feb 2024 16:09:20 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXSgm-00043K-W0 for 68815-done@debbugs.gnu.org; Tue, 06 Feb 2024 16:09:09 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A3A5A10009E; Tue, 6 Feb 2024 16:08:49 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1707253728; bh=WNiGILHO22fZb7DpPFV9ekTyEB98WcM1NsN0WEeWKP8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=aR0RIOy8GRo4W+WAf5qNGgCGGWd1R+SGTsBTJaaX6N+cgTe3mg4pu5R07OvKSu2+5 ap1+3RQXjSVv4N40uYjBtnVJfSvbnyiUwCUH1ViCZScvaqmGtsZh28ZEH5Oz9VlCBA wuhK0N4LiOMGgMmKdN8H6z8MYKznv1VGBJLIRF5f1Q9kKL+4w4TzcPrfRJyvUVaS+t 1SvE2SEeTG78NGkg0iIaClR8psExaKPgSb73uCtxh41O8pCTy8N+HUr2DvbotKewFE 3aJOh7OFlXnGIKkA27PItsRVaAAP54vfUwFvE5j7X/MbbrOMB71whWQObze5ZCqk9f 2JZFkEeO3cslg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B4F62100054; Tue, 6 Feb 2024 16:08:48 -0500 (EST) Received: from pastel (69-165-153-17.dsl.teksavvy.com [69.165.153.17]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 44663120234; Tue, 6 Feb 2024 16:08:48 -0500 (EST) From: Stefan Monnier To: Joseph Turner Subject: Re: bug#68815: Unexpected behavior with read-file-name and functional REQUIRE-MATCH argument In-Reply-To: <87sf2d6sf8.fsf@breatheoutbreathe.in> (Joseph Turner's message of "Wed, 31 Jan 2024 14:34:22 -0800") Message-ID: References: <8734ufyxoy.fsf@breatheoutbreathe.in> <87ttmuhvxi.fsf@breatheoutbreathe.in> <875xz98975.fsf@breatheoutbreathe.in> <87sf2d6sf8.fsf@breatheoutbreathe.in> Date: Tue, 06 Feb 2024 16:08:47 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.284 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 68815-done Cc: michael_heerdegen@web.de, Philip Kaludercic , Eli Zaretskii , 68815-done@debbugs.gnu.org, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Please see the attached patch. Thanks, Joseph, pushed to `emacs-29`, Stefan From unknown Fri Sep 05 20:37:04 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 06 Mar 2024 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator