From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.devel Subject: Re: master 0023891e842: Support hints in the :repeat keyword of defvar-keymap for repeat-mode Date: Tue, 7 May 2024 07:56:15 -0400 Message-ID: References: <171463246897.31562.10434330482523385662@vcs2.savannah.gnu.org> <20240502064749.54E89C1F9D4@vcs2.savannah.gnu.org> <86cypyi1b3.fsf@mail.linkov.net> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_9F62473F-662A-4727-823F-0502AD599C84" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29857"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Juri Linkov , Eshel Yaron Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 07 13:57:08 2024 Return-path: Envelope-to: ged-emacs-devel@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 1s4JRU-0007Wl-4p for ged-emacs-devel@m.gmane-mx.org; Tue, 07 May 2024 13:57:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4JQu-0002jD-L8; Tue, 07 May 2024 07:56:32 -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 1s4JQs-0002it-Bw for emacs-devel@gnu.org; Tue, 07 May 2024 07:56:30 -0400 Original-Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s4JQq-0007W5-8N for emacs-devel@gnu.org; Tue, 07 May 2024 07:56:29 -0400 Original-Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-de462f3d992so3656627276.2 for ; Tue, 07 May 2024 04:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715082984; x=1715687784; darn=gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=chw+00g13XBT1Z783k5d6K50au0Zrht//4mEhYg+YC4=; b=VqP7TDZNOJOsCQDNnvPMYrNImMS8tJUId5u81bSsaPSLT9EMEYvqt1zL2dKVfbtu0B sgCLkIFCNXkVRHRNLS7T0FIxANNldZy84bT2qEo/R0JyTAVc6MDmkL614AUw+83aqSL7 e+i4moX1/9ue2ZQr11KF+8GBCDfZBQab55n5xnnA9pdMW3Rw8eCK1HYSYxlnf1ao00O6 NISVwK5uq7C1wj35lzofyp+XVBnexuqbDxCc0zUYXZQWx8bqkrSj5gBX9jfLhyTx6xn0 q5UBafiq65iME9lrRdr215mTljRqRbW+XanFCGoYpEGP/E5YcNJhIjlYxN5hQPTYr13/ NuVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715082984; x=1715687784; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=chw+00g13XBT1Z783k5d6K50au0Zrht//4mEhYg+YC4=; b=cukzl9F+0dZx/yLcYcry6bAyOvq1zPlxPR1nQywPZwIx/3sSboeQcnMIfrBflEcztW CYYyvQRnZIAEsMKSZeRx/8aUe8iIUjDNKkSd5dKQRSbMBl1QX0Llnuao3eoFu4MSIEQC zXc/GLhbnl48WjuiajSSIQRzbCgPyYLkoItHudeo5i120shSeVWLW3RgHR3RdBXaTqXR szV09SFvZ39W/xm0S0skge97ZI8F7me10M04fg7/eZh7zVT8bTU01XzLvnvClaVuBt3G s1TmwAHyt3NUHXjAnT6NBe0RXd0V+xMgzNSR7k1F10NYCFiJZClaQxM59+ziLX6IuS++ x0wA== X-Gm-Message-State: AOJu0YzaroJLi4l1CrVfgJmK/XYLb1ITgB9jX5CUL2wUbXoIeJ/N4LVM XOJaBKMELC/4OHBFfgVg7tR6567u4XXv2GHy7bebEZ/LafGFpWTI X-Google-Smtp-Source: AGHT+IHsmfJNyxyVklpXzb29sDWOY6Jp4+REVU+vAsbLVpWOd7pwDlDVHkwElNPaSto0JL/pytRKAw== X-Received: by 2002:a25:d0d8:0:b0:de5:f817:abe9 with SMTP id h207-20020a25d0d8000000b00de5f817abe9mr13476990ybg.51.1715082984158; Tue, 07 May 2024 04:56:24 -0700 (PDT) Original-Received: from smtpclient.apple (cm-24-53-187-34.buckeyecom.net. [24.53.187.34]) by smtp.gmail.com with ESMTPSA id en15-20020a05622a540f00b004377f87147bsm6327482qtb.69.2024.05.07.04.56.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2024 04:56:22 -0700 (PDT) In-Reply-To: <86cypyi1b3.fsf@mail.linkov.net> X-Mailer: Apple Mail (2.3774.500.171.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::b2a; envelope-from=jdtsmith@gmail.com; helo=mail-yb1-xb2a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318934 Archived-At: --Apple-Mail=_9F62473F-662A-4727-823F-0502AD599C84 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 7, 2024, at 2:27=E2=80=AFAM, Juri Linkov = wrote: >=20 >> The need to repeat the name of the command in order to specify its = label >> ("hint") makes the keymap definition twice as long and prone to = errors. >> For example, after adding "hints" to one of my keymaps I got: >> [...] >> I don't have a great idea for an alternative interface off the top of = my >> head, but if there's a way to avoid this duplication I think it would = be >> a significant improvement. The original patch = re-used the (STRING . DEFN) menu form of key bindings to avoid such = duplication, but was deemed too confusing for users. > Unfortunately, duplication can be removed only at the cost of > complicating the definitions of bindings that would be more > hard to learn for users, and therefore will remain prone to errors. >=20 >> Lastly, it could be nice to make the appearance of the prompt more in >> line with the read-multiple-choice prompt, which is conceptually very >> similar. Crucially, if the key is a character that occurs in the = label, >> it's better, IMO, to highlight the first occurrence of that character = in >> the label (as r-m-c does) than to prefix the label with that = character. >> We can reuse rmc--add-key-description for that purpose, as follows: >=20 > Nice idea. A small problem is that when hints are not used, > it inserts an extra space between the character and comma. > But this is so minor that you could push the patch > if you think it's not worth making code more complex > by using rmc only when hints are specified. That will save some space. Remember though that many times the key will = not appear in the hint. In that case it would be nice to have a = connector character of some kind, e.g. `|':expreg. --Apple-Mail=_9F62473F-662A-4727-823F-0502AD599C84 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On May 7, 2024, at 2:27=E2=80=AFAM, Juri Linkov = <juri@linkov.net> wrote:

The need to repeat the name of the command in order to = specify its label
("hint") makes the keymap definition twice as long = and prone to errors.
For example, after adding "hints" to one of my = keymaps I got:
[...]
I don't have a great idea for an alternative = interface off the top of my
head, but if there's a way to avoid this = duplication I think it would be
a significant = improvement.

The&= nbsp;original = patch re-used the (STRING . DEFN) menu form of key bindings to = avoid such duplication, but was deemed too confusing for = users.

Unfortunately, = duplication can be removed only at the cost of
complicating the = definitions of bindings that would be more
hard to learn for users, = and therefore will remain prone to errors.

Lastly, it could be nice to make the appearance of the = prompt more in
line with the read-multiple-choice prompt, which is = conceptually very
similar.  Crucially, if the key is a character = that occurs in the label,
it's better, IMO, to highlight the first = occurrence of that character in
the label (as r-m-c does) than to = prefix the label with that character.
We can reuse = rmc--add-key-description for that purpose, as = follows:

Nice idea.  A small problem is that = when hints are not used,
it inserts an extra space between the = character and comma.
But this is so minor that you could push the = patch
if you think it's not worth making code more complex
by = using rmc only when hints are = specified.

That will save = some space.  Remember though that many times the key will not = appear in the hint. In that case it would be nice to have a connector = character of some kind, e.g. = `|':expreg.

= --Apple-Mail=_9F62473F-662A-4727-823F-0502AD599C84--