From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2GFSADjLHWMWTwEAbAwnHQ (envelope-from ) for ; Sun, 11 Sep 2022 13:49:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id gGpMADjLHWPKfAEAauVa8A (envelope-from ) for ; Sun, 11 Sep 2022 13:49:12 +0200 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 A2233E28E for ; Sun, 11 Sep 2022 13:49:11 +0200 (CEST) Received: from localhost ([::1]:47938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXLSY-0002b4-AK for larch@yhetil.org; Sun, 11 Sep 2022 07:49:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXLQq-0002Yc-P9 for emacs-orgmode@gnu.org; Sun, 11 Sep 2022 07:47:24 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:46651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXLQo-0005J4-Pp for emacs-orgmode@gnu.org; Sun, 11 Sep 2022 07:47:24 -0400 Received: by mail-pf1-x42a.google.com with SMTP id c198so6005651pfc.13 for ; Sun, 11 Sep 2022 04:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date; bh=vv+HcOA1t7GK43kmvIpKxrEjFFwGHlumfacH062DV30=; b=b1Ghsy6M1qK68LYN4It5tXO8YimJWAxzJbvbkfKUjWYjxB81cKpeDqR1IQflFFQYLi NKjOmBMgMJIhHnRnQ/mpjOSCxLpjZMfjICdZZ8y1aEbyuwhUIN3je+EP0t9TwhMk8Y8D BAVDeyiCF824SwH3CEP9sgWOi5+9+1rOp4oblWQLpdKiKJbzWjUnbAwHLk9xGmIMy4FN 5hvt1ubQqlRG7ZVBnf7+lNPgkgiKX4QkOLesDrdILdm0AG7GrQdu0TXCInH/JpYJGXHA 8uMPJPv/IZrTrobFkGAKi157f5uj3jjLwyQDlQFSUmIRj2MzyynpK0yjP6zCJTeADy+2 Dglg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=vv+HcOA1t7GK43kmvIpKxrEjFFwGHlumfacH062DV30=; b=Oi8ANZwRKQ6f3MxYwDwNyOEvu0JXdDwNwR7KCRi88l2dRPkZIsy5ASEnv9rsquqCsm 76+yT5OvSFtHD0LlX3HdfRo4A50A37HOwVPB98CfY3VAjlBzwkE+D84lZWWox7nVk2YM XgIldU1mKzRGMYk6a8Q9c04esK7ZpWjmV6Qzoay72efRU0d9IHCODsjZVDSpyvLRJgvZ 4qCN+yCzHYZ70mWqUq/MyyfNhYdAdA7CwBc9jdfJVRM2JQ1tE9rd1d9FKmbNU1urcrYJ 9goDICLUyhOA66nyA/nAWlPj5x810A4YaW9zr6vtMjH0R2DpSVTgveLR+XHCPusrPhlZ 3utA== X-Gm-Message-State: ACgBeo3mfZaZSkVVrCUHi89VYvjVhtfR2YCZDu9LcOCOU3VkcHovuYuV HNj4OgjiWiurdlgrVBXKWzQ= X-Google-Smtp-Source: AA6agR4u14NSNDmFTVNJeiu66uZSmeZMi0Lwq4jXiCyrhodqg6xQtM1gFIftoxmpV5KqDfKLRayymQ== X-Received: by 2002:a05:6a02:194:b0:439:5e8:d307 with SMTP id bj20-20020a056a02019400b0043905e8d307mr218074pgb.78.1662896841113; Sun, 11 Sep 2022 04:47:21 -0700 (PDT) Received: from localhost ([2409:8a70:2bc:c850:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id y11-20020aa79aeb000000b0053605d5e1adsm3169484pfp.206.2022.09.11.04.47.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Sep 2022 04:47:20 -0700 (PDT) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] ol.el: Restore complete by description for insert link In-Reply-To: References: Date: Sun, 11 Sep 2022 19:48:09 +0800 Message-ID: <87mtb6w2rq.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=yantar92@gmail.com; helo=mail-pf1-x42a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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-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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1662896951; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vv+HcOA1t7GK43kmvIpKxrEjFFwGHlumfacH062DV30=; b=XjOoflqeWQdac//llIUrOr7ykslyIW+uxlsFUBtchRaP/Q/oenysXKIWvep4c0Eq+3cPRk +Mlvzv0qasXqZnSUdg5D3MxhgNqZYc7+26MSpt4tWuZUwVJAYiP4cyhZ/bKClsvFhJ++JH 6qqHEJco+OwHbhzd2YHV0Tw94AyGzJ4vjYaZbVlFr8A+ldwcDRcnZJ43iN1at7i3ZXsOlg wC3JVXWRJkCESQNZ2LgQSwRHcZWk0BznrRuBRhcn/f/luU8IwVY/swjthl+ehCran202ij RQ/Z8OPOVtQkfnzcIFptqu7K8rD/RLsg9f4UoOdpUGiWNxoyvVPba+6brQvDyA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662896951; a=rsa-sha256; cv=none; b=mGsA9iwLbTLbCqSi/PBfo3WIRCnZ9JOYZt2vJKatYLHA2hi3/9vRjUhg4J7XoyzjwXghrq vYCIaryCRg11nBE+2eGCbKpZrqPRD5YxR4WtgJNZql16M5YwqADnG9fKYlSUuDu2O8+ItU IxoAd2aMJq1aX7D/B+gBcQsg7/M2GXk0hUfKDs9L/MAQ3jWvEMdMNpiVqh6XfD303KvSmy D7nuUJHHxiUW7IWYVRC75wKN+B2bChXTQIf70gsVSbnW5pzWmCxtDHLl5VCSIbNQe9meiw pwfQWuajEGWiCf+9MLtCJktimqUbjHn/sR4bHnr/OTSU3V0PXlIFJJ4SITrgdw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=b1Ghsy6M; 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: -3.30 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=b1Ghsy6M; 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: A2233E28E X-Spam-Score: -3.30 X-Migadu-Scanner: scn1.migadu.com X-TUID: kzRxaCGRjjNM Max Nikulin writes: > I believe that descriptions as completion options were removed because > ido signals an error when nil is passed inside completion list. I > consider it as a bug in ido (at least in Emacs-27), but even when > `completing-read-default' is used, it causes appearance of undesired > "nil" option. No description is a frequent case for links. This sounds reasonable. In general, there should be no need to care which completion backend is used by Emacs - they should all plug into `completing-read' without anything special to be done on Org side. The only exception is possible not-yet-fixed bugs in earlier Emacs versions. However, workaround for such issues should be clearly marked by a comment in the code and removed once the problematic Emacs version support is dropped. > So I am attaching a patch to restore completion of link targets by their > description, nil descriptions are filtered out. Thanks! Applied onto main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0432f4fe6ba9b07c17ac555beab1527d8f844234 > The change is caused by the auto-desc local variable in > `org-insert-link', its usage is rather strange and confusing currently. > Despite with this patch descriptions are restored, I believe that > logic related to auto-desc should be removed, anyway it was broken for > 10 years. I am unsure in which thread the next change should be discussed. To be frank, org-insert-link should be eventually refactored or at least better commented. This is one of the "old" functions in Org mode and its code style is not ideal. I think that the best approach to fix this and similar functions will be discussing/documenting the overall design of the Org link storage/completion. We can then work towards removing inconsistencies and subtle bugs in the code. Now, even not all the functionality of org-insert-link is described in its docstring (like re-using selected region). -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92