From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function Date: Tue, 03 Oct 2023 23:25:18 -0700 Message-ID: <8734yq52em.fsf@breatheoutbreathe.in> References: <87r0mni6m1.fsf@breatheoutbreathe.in> <87bkdq3nw6.fsf@web.de> <875y3yx221.fsf@breatheoutbreathe.in> <87pm260wh9.fsf@web.de> <87v8bx48ww.fsf@breatheoutbreathe.in> <87msx8sbpv.fsf@web.de> <87bkdoh1gy.fsf@breatheoutbreathe.in> <83y1gpyysv.fsf@gnu.org> <871qebph9p.fsf@breatheoutbreathe.in> <83ttr66hxy.fsf@gnu.org> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32112"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael_heerdegen@web.de, philipk@posteo.net, 66187@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 04 08:26:54 2023 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 1qnvLQ-00080Z-Qd for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Oct 2023 08:26:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnvLL-0002Pp-Oz; Wed, 04 Oct 2023 02:26:47 -0400 Original-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 1qnvLJ-0002GD-0R for bug-gnu-emacs@gnu.org; Wed, 04 Oct 2023 02:26:45 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qnvLI-0006os-L3 for bug-gnu-emacs@gnu.org; Wed, 04 Oct 2023 02:26:44 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qnvLa-00036U-6M for bug-gnu-emacs@gnu.org; Wed, 04 Oct 2023 02:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Oct 2023 06:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66187 X-GNU-PR-Package: emacs Original-Received: via spool by 66187-submit@debbugs.gnu.org id=B66187.169640081211909 (code B ref 66187); Wed, 04 Oct 2023 06:27:02 +0000 Original-Received: (at 66187) by debbugs.gnu.org; 4 Oct 2023 06:26:52 +0000 Original-Received: from localhost ([127.0.0.1]:41334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qnvLP-000360-Lh for submit@debbugs.gnu.org; Wed, 04 Oct 2023 02:26:52 -0400 Original-Received: from out-206.mta0.migadu.com ([91.218.175.206]:32203) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qnvLM-00035r-R2 for 66187@debbugs.gnu.org; Wed, 04 Oct 2023 02:26:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1696400789; 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=HtVuCKb2YYx/2+NQ61Dlz7OQBRAK+UhWjJpBRFkPU8s=; b=DvYnec7wRWQkqLHY0uH282WxuH7o/L4qAlwIZn6Zc4vvs3op9NawF+COxkmIJm4/gn++QJ vQKSkW4Vlc2QakXmSQFOG+EOkpocjv3oDdyyjtm72uLzleZGPpKHMSaXPAEGTR7ZeGJx8b 0bf3Hp/96ljRHnu1HPS44EqsWe960Zs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <83ttr66hxy.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:271763 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Joseph Turner >> Cc: michael_heerdegen@web.de, philipk@posteo.net, 66187@debbugs.gnu.org >> Date: Tue, 03 Oct 2023 13:43:56 -0700 >> >> >> Eli Zaretskii writes: >> >> > This is okay, except that we do document the other arguments. So why >> > not just copy/paste the description of MUSTMATCH from read-file-name >> > to read-directory-name instead? >> >> The read-file-name docstring for MUSTMATCH is lengthy, and duplicating >> it will mean that if read-file-name changes, we'll need to remember to >> change the docstring of read-directory-name. > > That's true, but it doesn't sound like a grave problem to me. We have > the same duplication elsewhere, so this isn't a precedent. Moreover, > when a doc string is long and complicated, asking the reader to read > part of it elsewhere is also quite a hassle. > > So I still think duplication is the lesser evil here. Thanks for the explanation! See patch. Joseph --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-MUSTMATCH-description-in-read-directory-name-doc.patch >From 3a653d681083d8d14d2d2437cb3f405dd7f07f04 Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Tue, 26 Sep 2023 18:01:27 -0700 Subject: [PATCH] Fix MUSTMATCH description in read-directory-name docstring * lisp/files.el (read-directory-name): Copy from read-file-name description, replacing "file" with "directory". --- lisp/files.el | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index b72f141c0ee..c31cb13653e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -817,8 +817,23 @@ non-empty string that was inserted by this function. If the user exits with an empty minibuffer, this function returns an empty string. (This can happen only if the user erased the pre-inserted contents or if `insert-default-directory' is nil.) -Fourth arg MUSTMATCH non-nil means require existing directory's name. - Non-nil and non-t means also require confirmation after completion. + +Fourth arg MUSTMATCH can take the following values: +- nil means that the user can exit with any input. +- t means that the user is not allowed to exit unless + the input is (or completes to) an existing directory. +- `confirm' means that the user can exit with any input, but she needs + to confirm her choice if the input is not an existing directory. +- `confirm-after-completion' means that the user can exit with any + 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 directory. +- 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. +- anything else behaves like t except that typing RET does not exit if it + does non-null completion. + Fifth arg INITIAL specifies text to start with. DIR should be an absolute directory name. It defaults to the value of `default-directory'." -- 2.41.0 --=-=-=--