From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron Newsgroups: gmane.emacs.devel Subject: Re: master 0023891e842: Support hints in the :repeat keyword of defvar-keymap for repeat-mode Date: Tue, 07 May 2024 19:13:10 +0200 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 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13110"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Juri Linkov , emacs-devel To: JD Smith Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 07 19:14: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 1s4OOG-0003Dn-EC for ged-emacs-devel@m.gmane-mx.org; Tue, 07 May 2024 19:14:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4ONS-0003gU-2V; Tue, 07 May 2024 13:13:18 -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 1s4ONP-0003fp-N5 for emacs-devel@gnu.org; Tue, 07 May 2024 13:13:15 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s4ONO-0008Qs-4t for emacs-devel@gnu.org; Tue, 07 May 2024 13:13:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1715101993; bh=/PnT8IYa04J+r0Jv8N7EExJuebkeEbqAGWpTkQdEh3Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Qp9AP9IVYg6+VOlU6wl2HAFn7iuqf8CAca1nLG/waqE5bL1QZ0Tc1AYQJcC9lpEu1 NMRz7FTMMgC68iDpDC9Hh7JDJ3LriFc4enTyKJrE0SV9LoIc0g5+zUcPi1qqYeLofh IMc2nscOmOKjPQY7eyfrls1cNBzzW5UCFhkmA3J4FnR0okNfnUeKKNcbL4CKKmNP/r Y+4b701c5R3gYhqZKJ8r6Sx3humW1Cp2rVfvO1Jk2ea6f093PZ/xHhIlNlOYGZJNsq ouVpDwQcNcCoy15GLAaKn9gGs3TwyX/e1b4vBZeawsvO5ZpAxCD5ck3ivmSNdYYizv ancDzWcvltcTQ== In-Reply-To: (JD Smith's message of "Tue, 7 May 2024 07:56:15 -0400") Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.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, SPF_HELO_PASS=-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:318963 Archived-At: JD Smith writes: >>> 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. Well spotted. How about something like the diff below? > 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. IIUC, the "connector character" in this example is the colon, right? If so, in read-multiple-choice we use a space as the connector character, do you think a colon is preferable? diff --git a/lisp/repeat.el b/lisp/repeat.el index 412afc35ba7..efca965a533 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -558,14 +558,13 @@ repeat-echo-message-string (format-message "Repeat with %s%s" (mapconcat (lambda (key-cmd) - (let* ((key (car key-cmd)) - (cmd (cdr key-cmd)) - (hint (when (symbolp cmd) - (get cmd 'repeat-hint)))) - (substitute-command-keys - (format "\\`%s'%s" - (key-description (vector key)) - (if hint (format ":%s" hint) ""))))) + (let ((key (car key-cmd)) + (cmd (cdr key-cmd))) + (if-let ((hint (and (symbolp cmd) + (get cmd 'repeat-hint)))) + (cdr (rmc--add-key-description (list key hint))) + (propertize (key-description (vector key)) + 'face 'read-multiple-choice-face)))) keys ", ") (if repeat-exit-key (substitute-command-keys