From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: [External] : Re: completing-read depricated initial-input Date: Fri, 24 Jun 2022 00:10:31 +0000 Message-ID: References: <86r13hubaw.fsf_-_@gnu.org> <86letphfke.fsf_-_@gnu.org> <86mte3lsj2.fsf_-_@gnu.org> <871qvfoce1.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24503"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Arash Esbati , Christopher Dimech , "eliz@gnu.org" , Help Gnu Emacs , "carlmarcos@tutanota.com" To: Stefan Monnier , Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 24 02:11:35 2022 Return-path: Envelope-to: geh-help-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 1o4Wv9-0006Cc-8p for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 24 Jun 2022 02:11:35 +0200 Original-Received: from localhost ([::1]:51846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4Wv7-0003z5-OP for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Jun 2022 20:11:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4WuJ-0003xB-Qs for help-gnu-emacs@gnu.org; Thu, 23 Jun 2022 20:10:43 -0400 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:26774) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4WuG-0004FU-Pd; Thu, 23 Jun 2022 20:10:43 -0400 Original-Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25NK3OFr009498; Fri, 24 Jun 2022 00:10:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=zexgJd6kSbjVE6JRk/ul2YC5b7OWE0Lt13oJrE4+0V0=; b=wMIVJU6t9AOVvO+BL4yftiNcKJ/Enmcis7+lza6dMOla1ZbvUexMKtggSvFWvhRiiqX+ lR3e2NLPI/dgwtIS1ylZ+guMtN7Nu7m9YeOnkEpISAsjpeZTnsUe4uKbFQ4qLC3IdoUY 08eNxDoC9W2fwUOpJp1ZZH1HfBiFjyoJSS2GavcvfxHq7yEsFJVDhrdq134uDzTBZiDd Z6SsDgRsDLxahCmUNaptQVLao10R6e0/EeQ00d8mmFCJYfs0ik+OylYbChHHuh9jB9sy MHFP3W8tIOn42lRhV+x76vzeLK29N1uYxRtzo3T53V0PyqvBwMGte8Zj+0NEiek4b1Ra 3Q== Original-Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gs5g24n7g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jun 2022 00:10:34 +0000 Original-Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25O00hPs010702; Fri, 24 Jun 2022 00:10:33 GMT Original-Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gtg3xwh5c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Jun 2022 00:10:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kUUymUEw9hjdtnu/TP/PKLVoNDMN19E3kJ2jMgO45SZlVp0KVa7o+kYei+Cya320obiucfMvEbtlhkfayIHa3YQa+RkfZqR80Nn6DoZzrqVbdMuLHnLFpQA5AZCR32SRnRY4IWvyOPm3cHK1GxwLm9rN6lKUHEg0GndNzqOaeqd6P2kjvsXsiWC8PYkseSrDidrJprm15ZpmHYTPWqY6D9XB4UwTpjaxP5dk43n79HEgx+Epac8i8TK+IF/OzBMEKLO+1gX7py2yO5tNfiBGf00ACeS1UPLDChQnKrOVNLsO1gX11iJdHOHt4kKn6KoJ1dBEfJj0jBTBVQJTqfj23A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zexgJd6kSbjVE6JRk/ul2YC5b7OWE0Lt13oJrE4+0V0=; b=RhkME9YszjlRufw9ZP2IUZLHYcPL+4utCiDaHdNTGveyVEI6rlx5fpiiee6DVZmz0u1atVWU4qHUOEhe3WVLwAIh88winAwylVRuPkrIe9VP3FQC5kgsTe0/27Z/XYRGMyrEE+rDKWJ3eDOT1xML90zjzivNfbSNdJNlIkoBavdA236dj95pBdJXRs6cuU4JoPrF2qbKJYtTjgs957jISQpBbjaOTIrumD7xgCS7Chw9CSWGbtxhMSk3ANyoZW1Oi6a/e1+TI129oblb9EglnoAAAn3Jb/wwZ2UCy4MVJmlr29wVLTmdBEglJhjbEllWFqwYCudh9UoUMa5/0zFdMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zexgJd6kSbjVE6JRk/ul2YC5b7OWE0Lt13oJrE4+0V0=; b=Z0DCdM1ut6eZbXvCHNp5eq7w41Er5jTIQHii9Bwfbq7XMwQc8dcpCmLaSIKkaKqgTPjzvdUMG/JqcRgBmMZPn5Hxca8lkgnx0HyOQHd2kNWrg5f/thbzQak/ykc6zgRxRbtaK4riSzmvfyQoG9X+8WCrCY9x3kcl5qhhTxQMxsQ= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by MWHPR1001MB2222.namprd10.prod.outlook.com (2603:10b6:301:2d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.18; Fri, 24 Jun 2022 00:10:31 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::581b:ae2f:16b9:80fb]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::581b:ae2f:16b9:80fb%6]) with mapi id 15.20.5373.016; Fri, 24 Jun 2022 00:10:31 +0000 Thread-Topic: [External] : Re: completing-read depricated initial-input Thread-Index: AQHYh0T65d56W0ldSEaZ/afxdWxJV61djikQ In-Reply-To: Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d0b70929-43c2-4bd9-32b0-08da5575f3c2 x-ms-traffictypediagnostic: MWHPR1001MB2222:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ItY4gkifr5rsAI68klhXu09H92Qk9Ak/tL6hF/2/5i8B7Cub6V98x6iE8uV4KmJI6si2zp6DfCVAj+9PULZaB+5J52tvNFlkD1foI4WG54VwjUJJBOv7uQ/tCaigq2AoFCUChXfNIegGAt0QnTOuCRWbj/4Eo+G171srvgOgFZLaGdFMBukythxOIeKMqfv6MMsKzmiru0FaDV2JotXP4v3e7daKF5zexa+K7AtqDAWaU1pbU5B12oqPd7E1oj/FwC7966gAQALUJ8djzE4bEt+5KqvMMKq45IRKeBXFPpK71Wkq1XZF1oC/U1kbrdk4cUMxNU9KirnDFJMXnIus2eCKUVsjKXyzUrkBB61cAv7aYITWWKJhyI8s/FP3vVFEZTdH21tsV0O8OZWP1QhguXS/CycjeDo/Rgmf1gwqsrHrrdoOkbSUsDQXSks//3EX7vEpEBAJ8z+/k83j7tqLPmSTaH0euQH+b8GR/sMi2lKPOkc5F1CwsM8JmHQHeymY5TT7OSlf3cOp2TXJ6sKALaCvd269CmLFyPoWoYQsQ9310FwDfwBemVBhDON6XFPkRYuNZ5El3YF0sLrbl8PzMOBiS1LDaIHxYcBXWVsnBsmnMI6L8hvTryQ+0AYzM6UC9uG9AQdy8B+5kDqGOXsAA9v63yEGJljmJRBY7JIYSk7l/l3EmITqFky3bm55f9XJitS//YcIm+/XxA5GxwUO3+OLREXY6m4JUW84EVvEnn0CiLToNBLdMwFLtZ68S H/DIiMkzgluW7JpYMT2N35NK/l78JYXXGSX/6s6jGt6dXs= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(396003)(366004)(39860400002)(376002)(136003)(110136005)(38100700002)(478600001)(296002)(54906003)(52536014)(26005)(44832011)(71200400001)(66446008)(316002)(86362001)(55016003)(122000001)(2906002)(38070700005)(33656002)(83380400001)(76116006)(5660300002)(8936002)(186003)(66946007)(64756008)(4326008)(41300700001)(66556008)(6506007)(66476007)(9686003)(7696005)(8676002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?9+X95jow1t5ZzuwZiT7vXeCn9wEnGN3K7623iaE2/Gjd3zfoPS26heBqrQzl?= =?us-ascii?Q?LIUTBFeK5Wdvhcg6DxnaWszvjq/OqLuE7YZxrO3MUWY5Id3P/mZxgItbLYpu?= =?us-ascii?Q?eTfRPY/QFOsM66p1oSrF+cWhne6whCJ2AaKnC53nKJaBmRQzuHOKnFRtemXz?= =?us-ascii?Q?BoxCD0ea1ACsNwtW/Y/nWdaoqdYpMmH7CbXeuoANcGy7ZK+SaV5dkclQni8E?= =?us-ascii?Q?XxPyAQpegK3hH/hfKxyeh4ZPqhHhBozUI6r7YHsGPOPRZMuiXafkq+SsCZDu?= =?us-ascii?Q?/E9tmB6+KahXdOuzkqPJArxugYiV7KgX0b74AHMN9kHZ4uN8aKtKywn3vTN+?= =?us-ascii?Q?Qg6rpnyHVDGPhbeqtFAlPSNMQcZGp3sGf5HQtxGo5bJCld2JsaZphn8IfJhX?= =?us-ascii?Q?Z2N3hY5qUnUPCy2ceHl9pOxb9I/U5KNxcCuTchxnOHGUHKRQdmUFpGMMCnw/?= =?us-ascii?Q?g99aZpYH3EU1QjJerIiYVtXmGXwS98QiLFSj03JkjpKC1Ft135kDWYYHF0sF?= =?us-ascii?Q?tmvz1lBkZ1diIl6oUKJaul3dS1DRGMYsqFe1ZllVTTr8sNkny4wcY6Z4lPUK?= =?us-ascii?Q?qDCZNw3Pasm3cKrQtcFQ480lTcoEVBqunSc1ITs5O/mi9tUxRTZxCOXpA7vU?= =?us-ascii?Q?me X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0b70929-43c2-4bd9-32b0-08da5575f3c2 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2022 00:10:31.5144 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SMWtWq9Lq+OY+1HbwsPAPa4BCgW+WnUbnPYpHd1qKAgtA0AcwN9j0MGvY294qwOFfoyHGTlvBSEp+j0j9i0uLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2222 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-23_11:2022-06-23, 2022-06-23 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=854 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206230093 X-Proofpoint-GUID: h2vrNWMQlDl2Eq6e8hirG7OpByVdCpMd X-Proofpoint-ORIG-GUID: h2vrNWMQlDl2Eq6e8hirG7OpByVdCpMd Received-SPF: pass client-ip=205.220.177.32; envelope-from=drew.adams@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, THIS_AD=1.098, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138055 Archived-At: > I haven't really followed that thread, but IMO the `initial-input` arg > should be changed into `setup-function` (so we don't have to use the > hideous `minibuffer-with-setup-function` hack) and using a string there > should be deprecated (the rare places where inserting an initial string > makes sense can use a setup-function instead). No comment on all of that. At least not until it becomes something real to worry about. ;-) > Also the prompt handling should be changed so that it automatically > inserts the default into the prompt. Doing that in a reliable and > backward compatible way is not completely straightforward, tho, so > maybe a simpler solution is to introduce a whole new function instead. >=20 > Then a user-customization could also be used to choose between the > current default (where the default is added to the prompt) or the other > option of always inserting the default as initial value (pre-selected > so it can be deleted with a quick DEL). Possible insertion of the default value, and its possible addition to the prompt, should be handled more generally than just for completion. Ideally the choice should belong mainly to users, and it should apply to pretty much all minibuffer reading functions that allow for a default value. _____ FWIW, Icicle mode handles this with user option `icicle-default-value'. When the value's non-`nil' and arg INITIAL-INPUT of minibuffer-reading functions is `nil' or "", the DEFAULT-VALUE argument can be inserted into the minibuffer as initial input. For `completing-read', `read-file-name'[*], and `read-string', if the option value is `t' then the default value is added to the prompt as a hint. Adding the default value to the prompt corresponds to a more or less conventional behavior of vanilla Emacs. But Emacs doesn't do that systematically. Instead, it hard-codes default values into prompts here and there. It's up to the particular command to decide about this - ad hoc. By design, individual Icicles commands never add the default value to a prompt themselves. Instead, option `icicle-default-value' controls the behavior. Non-`nil' and non-`t' inserts the default value into the minibuffer as the initial value. `nil' neither inserts the default value nor adds it to the prompt. (If the value is `t' or `nil', you can always use `M-n' to insert the default value manually.)=20 If you often want to use or edit the default value, then consider setting `icicle-default-value' to non-`nil' and non-`t'. If you rarely do so, then consider using `nil' or `t'. A non-`nil', non-`t' value also controls whether or not the inserted default value is preselected (as the active region), and where to leave the cursor: at its beginning or end. Preselecting the value can be useful in Delete Selection mode, because it makes it easy to replace that value by typing characters, or delete it by hitting `DEL' or `C-d'. (However, all of the initial input is deleted with `C-d' or `DEL', which is inconvenient if you just want to edit it slightly.) Summary of values: Don't insert default into minibuffer: nil - Don't add to prompt. t - Add to prompt if `completing-read', `read-file-name', or `read-string'. Do insert default into minibuffer: `insert-start' - Leave cursor at start. `insert-end' - Leave cursor at end. `preselect-start' - Preselect and put cursor at beginning. `preselect-end' - Preselect and put cursor at end. `t' is the default. (I use `insert-end'.) _____ When Icicles automatically puts the default value into the prompt, as a hint, it also replaces it there if put there already by some command, so the hint format will be systematically the same. Option `icicle-default-in-prompt-format-function' defines the format to use. By default it's this: (lambda (default) (format " (%s)" default)) Function `icicle-handle-default-for-prompt' does the work: __ (icicle-handle-default-for-prompt PROMPT DEFAULT INCLUDE) Return PROMPT, possibly changed to format or remove the DEFAULT value. Argument INCLUDE: * nil means do not include DEFAULT in prompt. Remove it if there. * non-nil means include DEFAULT, formatted according to `icicle-default-in-prompt-format-function'. In the existing PROMPT before modification, recognizes inclusion of a default value according to these possible patterns: `minibuffer-default-in-prompt-regexps' "(default ___):" "(default is ___):" " [___] " __ Icicles just reuses vanilla Emacs variable `minibuffer-default-in-prompt-regexps', which is defined for `minibuffer-electric-default-mode'. A list of regexps matching the parts of minibuffer prompts showing defaults. When 'minibuffer-electric-default-mode' is active, these regexps are used to identify the portions of prompts to elide. (`minibuffer-electric-default-mode'e tries to show a default value in a prompt only when hitting RET yields that value. If you edit the minibuffer text so it's no longer the default value, the default's removed from the prompt.) ____________________ [*]: However, for `read-file-name', if option `insert-default-directory' is non-`nil' then, to avoid duplication: * If the default value is the same as the value of `default-directory' then it's not added to the prompt. * If the default value is added to the prompt then it's first made relative to `default-directory'.