From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id kD3QFggFdWWkYwEA9RJhRA:P1 (envelope-from ) for ; Sun, 10 Dec 2023 01:23:36 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kD3QFggFdWWkYwEA9RJhRA (envelope-from ) for ; Sun, 10 Dec 2023 01:23:36 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=QtJX1kqk; 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"; dmarc=pass (policy=quarantine) header.from=me.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1702167816; 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=d+c6nDNGcvgBsNn6aplLEUxsSXP0RzVHcRkphcNZ3zU=; b=qbjGZXc0+1qA0QlyuOXMJ1gDWLrXK+Kdvza4WtkcApGUBQIx59boie7LdfbpGE32q+Goyw az1xDnO2piV50K/f+4qwX7LhuW1ym0VUPlBsOEt2yNYBNqfHNGRDdyOxjA8LPyfNX79l9f eJpqPADwvM0YKFN5jTdsjj0mKTNQjWTS+E8wSgv08P0TzJs82z9HU01UEaTuD63CnpFgc2 iqV7YcofvOd8yQ/EcP5JLji3O06wPdVDeCk3CZC5AW1z3d4fdH73mN788Mj3vQrdYlB3yc QwwXxvTMn32TlHP/mqs1uJflHrjC4ljEkgn11T8csuIC8c9TfOsmyN2iDgOLbg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b=QtJX1kqk; 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"; dmarc=pass (policy=quarantine) header.from=me.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1702167816; a=rsa-sha256; cv=none; b=EScEdkwuJ+N60Cjo1Ay0nF386YyxeXgA/Z5wRDsInnvP9kMiYgfWglaztc81D3UGmABwev efn4RJ+fjRMtwFrpP5PfkdTL/xMgYGgYTHYEtl+3sGq35CVwLm79W4tWbo4QO52DiJaLfz rYOYsJSd/NeIrX1OrA3lqB6h4WcJuM4A0Z2KN7qaK7k+IYyUY0h8dJF1ZwoSliMT66GFmN /YztKbiaOaOGXw74fpmwxBAeFPbKGFnB5wx7gzaYXWPEWHvwiYktd08ag0FzlGF4aBEUFE yQYf6L8wTv5gTtJINNtqZoNf7Aofn4X8K4l2oahibQnKkmc8rMqiHu8dijdGgA== 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 C7F24376C5 for ; Sun, 10 Dec 2023 01:23:35 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rC7aj-0007XZ-1O; Sat, 09 Dec 2023 19:22:41 -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 1rC7ag-0007X7-S0 for emacs-orgmode@gnu.org; Sat, 09 Dec 2023 19:22:38 -0500 Received: from mr85p00im-ztdg06011201.me.com ([17.58.23.181]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rC7ae-0000yN-VJ for emacs-orgmode@gnu.org; Sat, 09 Dec 2023 19:22:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1702167752; bh=d+c6nDNGcvgBsNn6aplLEUxsSXP0RzVHcRkphcNZ3zU=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=QtJX1kqkL4XoOxV8fQMFFIiBhDk7r55IP4P0M+EDePdAzBMsAjEHNZZAvWBZ0QiDe cokCZ/jLLGZ0yfD+2Db0BKu3wdw+ZHlDZXQ2SAiX6d7cC5ZpZ9Azx0cy+E9NOAi3W2 2SU4cf9ktYxSRyB35nPS8HL2/SSBZBpOeAyB+3ElJCrtLU0nEumUzhiDAGS5NzP0rR h3rDuPaCaJipBKzodXLccNUXceJGSZCzk22uMMaBKync0wDzGgAjHNeI3sAhnelE/o wTvTJHISUQ8NYuM2m0AAIJJA48OaPWEp/a7mSugvwB9Mtb/7iW86mui5RsrxxFAhZn 4l6X4e7lqtKwQ== Received: from Rudolfs-MacBook-Air.local (mr38p00im-dlb-asmtp-mailmevip.me.com [17.57.152.18]) by mr85p00im-ztdg06011201.me.com (Postfix) with ESMTPSA id 465AC9603DA; Sun, 10 Dec 2023 00:22:31 +0000 (UTC) From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= To: Ihor Radchenko Cc: Salih Muhammed , emacs-orgmode@gnu.org Subject: Re: Consider removing newlines from org-insert-link help message In-Reply-To: <87fs25bhmv.fsf@localhost> References: <87o7gxbx66.fsf@gmx.com> <87h6mpfrk2.fsf@localhost> <87h6moncj6.fsf@gmx.com> <87fs25bhmv.fsf@localhost> Date: Sun, 10 Dec 2023 01:22:27 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Proofpoint-ORIG-GUID: t7EPzvTbf2CfL_j39g2mXLUIdWwaapeX X-Proofpoint-GUID: t7EPzvTbf2CfL_j39g2mXLUIdWwaapeX X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.425,18.0.816,17.11.62.513.0000000_definitions?= =?UTF-8?Q?=3D2022-01-18=5F01:2022-01-14=5F01,2022-01-18=5F01,2021-12-02?= =?UTF-8?Q?=5F01_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=780 mlxscore=0 clxscore=1015 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2312100001 Received-SPF: pass client-ip=17.58.23.181; envelope-from=salutis@me.com; helo=mr85p00im-ztdg06011201.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -9.58 X-Spam-Score: -9.58 X-Migadu-Queue-Id: C7F24376C5 X-Migadu-Scanner: mx10.migadu.com X-TUID: /c9Y4lp/qB2R --=-=-= Content-Type: text/plain Ihor Radchenko writes: > Patches welcome. Please, see the attached patch. > I see no obvious downsides. May as well. Done. > Currently, the minibuffer message is simply "Link: ". "Insert link:" > is also ok. Done. > Maybe "Press" rather than "Type". I went with "Type" to match other Emacs commands. > We may, but the default link might sometimes be long. Not sure how it > will look like. All right, you be the judge. Personally, I find this UI less disorienting, as opposed to the unclear comment about RET in the *Org Links* buffer. And it makes sense, given I see the "VERB NOUN [default CANDIDATE]: " constantly, all throughout in Emacs. > AFAIK, this is already done. We already use `completing-read'. The UI > is there historically and in addition to the normal Emacs completion. Gotcha! (It is quite confusing when using e.g. Vertico, but if we are optimizing for the default Emacs completion system, then it makes sense.) Rudy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-link-Prettify-org-insert-link.patch >From 7bc8e913af0972f0d6119e45d4ecaf80835f2277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Sun, 10 Dec 2023 00:51:31 +0100 Subject: [PATCH] org-link: Prettify 'org-insert-link' * lisp/ol.el (org-insert-link): Update the UI with text that is (1) shorter, to avoid line breaks, (2) more standard, to match other Emacs commands, and (3) more readable, with propertized key bindings. Also, show the default link in the minibuffer, as seen elsewhere in Emacs. --- lisp/ol.el | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index e684b9504..49499e932 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1866,16 +1866,34 @@ non-interactively, don't allow to edit the default description." (org-link--fontify-links-to-this-file) (org-switch-to-buffer-other-window "*Org Links*") (with-current-buffer "*Org Links*" - (erase-buffer) - (insert "Insert a link. -Use TAB to complete link prefixes, then RET for type-specific completion support\n") - (when org-stored-links - (insert "\nStored links are available with / or M-p/n \ -\(most recent with RET):\n\n") - (insert (mapconcat #'org-link--prettify - (reverse org-stored-links) - "\n"))) - (goto-char (point-min))) + (read-only-mode 1) + (let ((inhibit-read-only t) + ;; FIXME Duplicate: Also in 'ox.el'. + (propertize-help-key + (lambda (key) + ;; Add `face' *and* `font-lock-face' to "work + ;; reliably in any buffer", per a comment in + ;; `help--key-description-fontified'. + (propertize key + 'font-lock-face 'help-key-binding + 'face 'help-key-binding)))) + (erase-buffer) + (insert + (apply 'format + (cons "Type %s to complete link type, then %s to complete destination.\n" + (mapcar propertize-help-key + (list "TAB" "RET"))))) + (when org-stored-links + (insert (apply 'format + (cons "\nStored links accessible with %s/%s or %s/%s are:\n\n" + (mapcar propertize-help-key + (list "" "" + "M-p" "M-n" + "RET"))))) + (insert (mapconcat #'org-link--prettify + (reverse org-stored-links) + "\n")))) + (goto-char (point-min))) (when (get-buffer-window "*Org Links*" 'visible) (let ((cw (selected-window))) (select-window (get-buffer-window "*Org Links*" 'visible)) @@ -1890,7 +1908,11 @@ Use TAB to complete link prefixes, then RET for type-specific completion support org-link--insert-history))) (setq link (org-completing-read - "Link: " + (concat "Insert link" + (if-let ((default (caar org-stored-links))) + (format " [default %s]" default) + "") + ": ") (append (mapcar (lambda (x) (concat x ":")) all-prefixes) (mapcar #'car org-stored-links) -- 2.39.3 (Apple Git-145) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 "Music is the mathematics of the sense, mathematics is the music of the reason." -- James Joseph Sylvester, 1814-1897 Rudolf Adamkovi=C4=8D [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia --=-=-=--