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.bugs Subject: bug#70576: [PATCH] `repeat-echo-message-string': support repeat keymap "hints" Date: Sun, 28 Apr 2024 08:45:19 -0400 Message-ID: References: <45C35B69-6DA8-4212-BD87-50B2A3959A86@gmail.com> <86h6fo3e7e.fsf@mail.linkov.net> <86cyqaezhc.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=_816F47B3-3BCE-41B4-9AB6-003C31D9EC95" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38584"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70576@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 28 14:46:01 2024 Return-path: Envelope-to: geb-bug-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 1s13ur-0009mC-3x for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Apr 2024 14:46:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s13uc-0003r1-3t; Sun, 28 Apr 2024 08:45:46 -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 1s13uY-0003ql-Om for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 08:45:43 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s13uY-0001JZ-HD for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 08:45:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s13ur-0000r5-Ju for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 08:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: JD Smith Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Apr 2024 12:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70576 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70576-submit@debbugs.gnu.org id=B70576.17143083603281 (code B ref 70576); Sun, 28 Apr 2024 12:46:01 +0000 Original-Received: (at 70576) by debbugs.gnu.org; 28 Apr 2024 12:46:00 +0000 Original-Received: from localhost ([127.0.0.1]:50252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s13up-0000qr-RS for submit@debbugs.gnu.org; Sun, 28 Apr 2024 08:46:00 -0400 Original-Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]:60498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s13um-0000qh-WB for 70576@debbugs.gnu.org; Sun, 28 Apr 2024 08:45:58 -0400 Original-Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-36a17999886so16280975ab.0 for <70576@debbugs.gnu.org>; Sun, 28 Apr 2024 05:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714308332; x=1714913132; darn=debbugs.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=MSnF+pELIq3jWiHyvCpXIqvscNlVq6H37AqU8We/+Pk=; b=h5/BPzlu+2x/yl9Wrn89+9j/hpReP4KJAdqi/xXlXgvzYEZtIUMmjsi9okF8d7+5HN 6vTrXYYGjJiJ03wbt9C2qmJBDh2N2uWPKHxTSInBkrDmNJY80C/VFHwMu2zDjzT/GwfP sU3Z2SS4hNjJD+EbD7ZPFUyWLsZqXCBHrBAniWbpePsYV8VQINnYCFuGFa74+Wh1aJ8P zPbqCrV9FjpoeE8gJuhV/folpTZNtvud96kochdibc2a79VNgRnBuZ43d1d5Ng0nD4uY XoLRB1UPT9ohJN1frtumZ9TxTkT7mF1PmfeRj0X74zOqBQbU4kWu3w8y9j4TsugliBR3 9oqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714308332; x=1714913132; 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=MSnF+pELIq3jWiHyvCpXIqvscNlVq6H37AqU8We/+Pk=; b=gvd6gIMcTY6itj3dszTsFySd2RjntT8Kvq8dJXcswsgTRT1s/2axNPkhm1ASGrhcGV +ohz4QntHKZkgStT/iGRujJq1SU02JRETvzchtgTZVS2n8t4i/EaRd418E5tb9sYdO0A 0bicopaf9rnoxuyldXUKLqf8os8gtWRchA7PQhrSacQenpf6biJ9aomYT7n3a+QFI09V BICTeLsDiSl71gkj0w0PF1vPNOE0ilCX+zO8iXzAr1zyZJSmhvRvSHdR+x/rBdJfe5pF 4j0c74v3n6MmHdafm5+n5hU6WvS3+ERz/AZwojQfmYBAlvF24HSjXQMd2xsuPQOBuKNp LrGg== X-Gm-Message-State: AOJu0YzGTKjCDAgSEGSlRVwEHE7MCbTItfNMpHHGJfXjV1k9BO/+XdtD Y1zK/f1W09cZwmyi4NVu3Fqsb3YUfhXWDo9HMcceCys/Pt+TFU4n X-Google-Smtp-Source: AGHT+IE6x3QojzIDUYrLvJ98SuwNzDDbcRyl6XviCHijDr0hwM8Y8oU7QvQEZeKWI9NOvgVBjkgyrA== X-Received: by 2002:a05:6e02:214c:b0:36c:c9f:ccd0 with SMTP id d12-20020a056e02214c00b0036c0c9fccd0mr9478394ilv.17.1714308330586; Sun, 28 Apr 2024 05:45:30 -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 dk8-20020a0566384bc800b00484a3e77318sm6601978jab.58.2024.04.28.05.45.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Apr 2024 05:45:30 -0700 (PDT) In-Reply-To: <86cyqaezhc.fsf@mail.linkov.net> X-Mailer: Apple Mail (2.3774.500.171.1.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:284088 Archived-At: --Apple-Mail=_816F47B3-3BCE-41B4-9AB6-003C31D9EC95 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Apr 28, 2024, at 2:58=E2=80=AFAM, Juri Linkov = wrote >> Of course a new wrapper macro could also be developed to ease this. >> Do you anticipate any specific issues? >=20 > Here is what I recommend to do to simplify the definition of hints for = users. >=20 > Like there can be a list of enter and exit commands in = 'defvar-keymap': >=20 > :repeat =E2=80=98(:enter (commands ...) :exit (commands ...))=E2=80=99 >=20 > the same list could be used for hints: >=20 > :repeat =E2=80=98(:enter (commands ...) :exit (commands ...) :hints = ((command . hint) ...))=E2=80=99 >=20 > This should be easier to document and to understand by users than > a special syntax of cons for binding and the requirement to add :name. Though it will require repetition and thus be subject to = changed-here-but-not-there errors, this does look good and nicely groups = the information under :repeat. So this should work for all commands in = the keymap: > (defvar-keymap expreg-repeat-map > :doc "Repeat map for `expreg' actions." > :repeat '(:hints ((expreg-expand . "expand") (expreg-contract . = "contract"))) > "\\" 'expreg-expand > "|" 'expreg-contract) If a hint is missing for a command, it should just have its key = mentioned. It looks like your idea would require changes to = defvar-keymap. Do you want to propose a patch? We'd need some way to = pass the hints in; perhaps the macro could set a property on the command = symbol as you initially proposed.= --Apple-Mail=_816F47B3-3BCE-41B4-9AB6-003C31D9EC95 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Apr 28, 2024, at 2:58=E2=80=AFAM, Juri Linkov = <juri@linkov.net> wrote
Of course a new wrapper macro could also be = developed to ease this.
Do you anticipate any specific = issues?

Here is = what I recommend to do to simplify the definition of hints for = users.

Like there can be a list = of enter and exit commands in 'defvar-keymap':

 :repeat =E2=80=98(:enter (commands = ...) :exit (commands ...))=E2=80=99

the = same list could be used for hints:

 :repeat =E2=80=98(:enter (commands ...) :exit = (commands ...) :hints ((command . hint) ...))=E2=80=99

This should be easier to document and to = understand by users than
a = special syntax of cons for binding and the requirement to add = :name.

Though it will require = repetition and thus be subject to changed-here-but-not-there errors, = this does look good and nicely groups the information under :repeat. =  So this should work for all commands in the = keymap:

(defvar-keymap = expreg-repeat-map
   :doc "Repeat map for `expreg' = actions."
   :repeat '(:hints ((expreg-expand . = "expand") (expreg-contract . "contract")))
   "\\" 'expreg-expand
   "|" =  'expreg-contract)

If a hint = is missing for a command, it should just have its key mentioned. =  It looks like your idea would require changes to defvar-keymap. =  Do you want to propose a patch?  We'd need some way to pass = the hints in; perhaps the macro could set a property on the command = symbol as you initially proposed.
= --Apple-Mail=_816F47B3-3BCE-41B4-9AB6-003C31D9EC95--