From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id EIugKCakG2LE7QAAgWs5BA (envelope-from ) for ; Sun, 27 Feb 2022 17:17:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id APUCJiakG2LycAEA9RJhRA (envelope-from ) for ; Sun, 27 Feb 2022 17:17:42 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3D650469E7 for ; Sun, 27 Feb 2022 17:17:42 +0100 (CET) Received: from localhost ([::1]:49108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOMEv-0006vR-6E for larch@yhetil.org; Sun, 27 Feb 2022 11:17:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOMDX-0006YB-Sn for emacs-orgmode@gnu.org; Sun, 27 Feb 2022 11:16:16 -0500 Received: from [2607:f8b0:4864:20::541] (port=34747 helo=mail-pg1-x541.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOMDV-0007bh-72 for emacs-orgmode@gnu.org; Sun, 27 Feb 2022 11:16:14 -0500 Received: by mail-pg1-x541.google.com with SMTP id 139so9412832pge.1 for ; Sun, 27 Feb 2022 08:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=D2mN/mg1u+PeXlHfPEc7osmoJy1qiZBaJLbXM77lWYI=; b=HLqCQ59PZ0LF2PpnsFWOeneeQ7cLIXJxlnM0WSLJC1D/vVDzQsSJpTYTb1yl11eYAA MtGauiA62V+j4Txh7BvyGe+F0uWzQzxhTHi4TBVmN1IhiMJYu3vEjl0hiY6e8b+fTJty PZNPkyEOQ+jGKpw8KW/qJ6+hGMAAIF8j9RD5/eQjtRxcST0UjER6qIGE10LA3dHb/avP mRsYIGH9Ie03AkKWjQfuw9HsDUj8Qp8K2MNHfb2RlSFi8erCxc5M3ZpJN/c/JjLm8vgY KQWQ0dSog5Ng29OpFBYZyEF9CM57cvgaVV7IhdDG88MuRAJ4U4n47t3UOwvfKOz8/bc/ rxSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=D2mN/mg1u+PeXlHfPEc7osmoJy1qiZBaJLbXM77lWYI=; b=IcQv5nxWMbqroeey3d8x2x5wskS+0Ssqeu19GnM/pbu1gCRoUEWNYIGDZdU9MkqvQz czjS7ibKrWdYdTYpan1XTYujcZM7CRLoG/wrtC7f6yLKhefucj05kgQD27GTQxKHw3/m dAG+st5491mUBdMobwc+MwD/Ws281rXJe4g9ryZccfjIhIutwcUpSTWfon84Ar0diUoh UY8XUe6Y2RHkpZDB5F8Uwl7y82gmueF+egFidIvS8dAK3mzQiaadFw+0IkHZVPQMwhkn 8hiiALyRRBYV9UtTDhm4JTXN3ctZTWbWxp0DKIvYNrt7t36utaQCi2+2OUMd4ljSzXaZ NCNw== X-Gm-Message-State: AOAM533LBqL/nC3FWRWFf6HarvuDXmI3kkSHFD6XAxFiHkzlyeBipSAH ynbFi+G4YWzqLT8p5rk1vZjLxOF86kk= X-Google-Smtp-Source: ABdhPJwqLuRfXkxOc+K+REwYjdUL9kaf7MwlxCC8/MuNYmMd/nHwSsT9LXjU7WjO295N3XOhKI5w8Q== X-Received: by 2002:a63:3142:0:b0:373:a5f1:82bb with SMTP id x63-20020a633142000000b00373a5f182bbmr14288104pgx.163.1645978569736; Sun, 27 Feb 2022 08:16:09 -0800 (PST) Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id d3-20020a056a00244300b004bc9397d3d0sm10127309pfj.103.2022.02.27.08.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Feb 2022 08:16:09 -0800 (PST) From: Visuwesh To: Max Nikulin Subject: Re: [BUG] org-insert-link should use DEFAULT in read-string when asking for description References: <87sfs7jafo.fsf@gmail.com> <87h78lk917.fsf@gmail.com> Date: Sun, 27 Feb 2022 21:46:02 +0530 In-Reply-To: (Max Nikulin's message of "Sun, 27 Feb 2022 17:48:45 +0700") Message-ID: <877d9g5lq5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::541 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::541; envelope-from=visuweshm@gmail.com; helo=mail-pg1-x541.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.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, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645978662; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=D2mN/mg1u+PeXlHfPEc7osmoJy1qiZBaJLbXM77lWYI=; b=HcIUy9o3XR2vYfTFQiDhNLed8cvxwBBTfox9bFldGuClx15JjPL6q/+S8nLAvfb1JuSLA4 KYlvpW8NVAT2TgnvDFQ3fx3/HWVJVzZ+XCA7XZNruFGq0y7K6rO2mC8gXx7k3zgFMC4Lko 782OafjGMRPmLUYy3CfOa+xJ1Sy9mpTf3Oqb0rv1o3s8mdTJ7kveqgLyrdVWlHHM8pkUTy FG95qtOx7FvLGd3SNNbYBtf2pIM0Fayko8A4G6PpW1s3uCj7oo0c4VsDQSSU5E7CxrH9lT UbuaSyHk4TcazJ/oim6/YTrj9ThkUiQIq2OhjHcMQ4kvQyGSknawCmcPKoGNbg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645978662; a=rsa-sha256; cv=none; b=B4E6SKTI2s5XGBskorAqi7f4tqgTHA37eBAp74neLX7TtiaGJ1AA4oEeKktHQe4tdeO1a8 VJkAvhk0qcFVM73ufTRcBwvvN6VY3hszniar0/CDPDjCuA1TMlEgGKFgdn6jNyRxU+OSLn zUBl8t/vUpaamHhBvQbf/plQR4doPsGv+cSWq4sVNG/EK8rpMHWK/IWGxoGidR1P07kGr9 fRcI50voYts03414tbsWq8z1ing3L7WDIreX1D5gHpBq8Uy0f0LvozAHDFow6HcJZXBHO8 DyFJy1kCrkb2zS+cDZKCQaV6YUc7b6d3ZeJsV9U7iMc0c70LuYoW88Iyr/JHwg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=HLqCQ59P; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -9.61 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=HLqCQ59P; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 3D650469E7 X-Spam-Score: -9.61 X-Migadu-Scanner: scn0.migadu.com X-TUID: Vtln99Fe5m0+ [ Please keep me in the CCs since I don't follow the list. ] [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81, =E0=AE=AA=E0=AE=BF= =E0=AE=AA=E0=AF=8D=E0=AE=B0=E0=AE=B5=E0=AE=B0=E0=AE=BF 27 2022] Max Nikulin= wrote: > On 26/02/2022 21:16, Visuwesh wrote: >> [=E0=AE=9A=E0=AE=A9=E0=AE=BF, =E0=AE=AA=E0=AE=BF=E0=AE=AA=E0=AF=8D=E0=AE= =B0=E0=AE=B5=E0=AE=B0=E0=AE=BF 26 2022] Max Nikulin wrote: >>=20 >>> Are you suggesting replacing >>> (read-string "rs-initial: " "Some initial") >>> by >>> (read-string "rs-default: " nil nil "Some default") >>> ? >> Yes, exactly. > > However you agreed that it would be regression since empty description > use case would be impossible. > No. It is impossible to do it using read-string, but it is possible to do it by writing a function that calls read-from-minibuffer (and I gave an example of a function that does this). >> I admit that I forgot about this but Emacs can be made to not translate >> empty string to the default argument if you DTRT when calling >> `read-from-minibuffer' (and `read-shell-command' does this). If writing >> a new function just to get this functionality is too much, then I guess > > `read-shell-command' still has INITIAL argument and it is used by > various callers (vc, grep). In addition, unlike for link description, > I do not see any point in empty shell command (e.g. in vim :! allows > to see output of previous shell command). So `read-shell-command' may > behave quite differently. > Two things: 1. I dislike grep's behaviour. However, I understand why grep behaves the way it does. It makes far more sense to use the INITIAL argument in grep, but I don't see the same for org-insert-link. [ In grep, you rarely ever need to change the initial input. ] 2. The reason why I cited read-shell-command does not have anything to do with the usefulness of empty string (or shell command). I merely wanted to point out that you can have BOTH the DEFAULT argument (and no INITIAL), and can make the empty string a valid output from the function (i.e., without getting substituted by the DEFAULT argument). I hope (2) makes sense. I'm struggling to word it. > Current way to ask for link description has the following properties: > - Almost no action (just RET) if the user happy with suggested > description. Default description is provided with hope that it is > the most convenient option. > - It is possible to erase everything and to get a link with no descriptio= n. > - The user is free to replace default description with arbitrary > alternative text. > > It is unclear for me how to tame `read-from-minibuffer' to get equally > convenient behavior using DEFAULT argument instead of formally > deprecated INITIAL one. > Please read the docstring of read-from-minibuffer. You would be better served by reading it than me replicating it here. And I gave read-shell-command as an example so others could study the function. In essence, you can get the old behaviour (1) but you need to type M-n beforehand. Its one more key but it is far better than the current behaviour since it is consistent with rest of the Emacs ecosystem (see below also). >> I can live with the current behaviour, but this inconsistency is an >> annoyance since I end up with garbled link names, which I only notice >> _afterwards_. > > Sorry, but I have not figured out what particular problem you met. Inconsistency is the problem. org-insert-link breaks my muscle memory. I am not sure if you use the default completion system, but if you do, org-insert-link sticks out by being intrusive. With every command I use, when I know that the DEFAULT argument will be of no use, I simply start typing. However, with org-insert-link I have to clear the input _first_ then start typing. This never happens elsewhere, even in grep (which you cite as an example)!