unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57906: [PATCH] Add face help-key-binding in help-char echo
@ 2022-09-18  9:40 Stefan Kangas
  2022-09-18 10:12 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Kangas @ 2022-09-18  9:40 UTC (permalink / raw)
  To: 57906

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

Severity: minor

For the sake of consistency, I think we should use the
`help-key-binding' face to the "?" key in the message that shows up when
typing `C-h' and waiting.  Please see the attached patch.

[-- Attachment #2: 0001-Add-face-help-key-binding-in-help-char-echo.patch --]
[-- Type: text/x-diff, Size: 1896 bytes --]

From 65a39b7a544ee028a1e6153bd7e6b86d32d2f3e9 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Sun, 18 Sep 2022 11:29:52 +0200
Subject: [PATCH] Add face help-key-binding in help-char echo

* src/keyboard.c (echo_add_key): Add help-key-binding face to the
"?" key in 'help-char' echo.
(syms_of_keyboard) <Qhelp_key_binding>: New DEFSYM.
---
 src/keyboard.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/keyboard.c b/src/keyboard.c
index ca51c80da0..0a84047435 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -499,27 +499,19 @@ echo_add_key (Lisp_Object c)
 			STRING_MULTIBYTE (name), 1);
     }
 
+  Lisp_Object new_string = make_string (buffer, ptr - buffer);
   if ((NILP (echo_string) || SCHARS (echo_string) == 0)
       && help_char_p (c))
     {
-      static const char text[] = " (Type ? for further options)";
-      int len = sizeof text - 1;
-
-      if (size - (ptr - buffer) < len)
-	{
-	  ptrdiff_t offset = ptr - buffer;
-	  size += len;
-	  buffer = SAFE_ALLOCA (size);
-	  ptr = buffer + offset;
-	}
-
-      memcpy (ptr, text, len);
-      ptr += len;
+      AUTO_STRING (str, " (Type ? for further options)");
+      AUTO_LIST2 (props, Qface, Qhelp_key_binding);
+      Fadd_text_properties (make_fixnum (7), make_fixnum (8), props, str);
+      new_string = concat2 (new_string, str);
     }
 
   kset_echo_string
     (current_kboard,
-     concat2 (echo_string, make_string (buffer, ptr - buffer)));
+     concat2 (echo_string, new_string));
   SAFE_FREE ();
 }
 
@@ -12098,6 +12090,8 @@ syms_of_keyboard (void)
 	       doc: /* Message displayed by `normal-top-level'.  */);
   Vinternal__top_level_message = regular_top_level_message;
 
+  DEFSYM (Qhelp_key_binding, "help-key-binding");
+
   /* Tool-bars.  */
   DEFSYM (QCimage, ":image");
   DEFSYM (Qhelp_echo, "help-echo");
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#57906: [PATCH] Add face help-key-binding in help-char echo
  2022-09-18  9:40 bug#57906: [PATCH] Add face help-key-binding in help-char echo Stefan Kangas
@ 2022-09-18 10:12 ` Lars Ingebrigtsen
  2022-10-05 13:40   ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-18 10:12 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 57906

Stefan Kangas <stefankangas@gmail.com> writes:

> For the sake of consistency, I think we should use the
> `help-key-binding' face to the "?" key in the message that shows up when
> typing `C-h' and waiting.  Please see the attached patch.

Makes sense to me.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#57906: [PATCH] Add face help-key-binding in help-char echo
  2022-09-18 10:12 ` Lars Ingebrigtsen
@ 2022-10-05 13:40   ` Stefan Kangas
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Kangas @ 2022-10-05 13:40 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 57906

close 57906 29.1
thanks

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> For the sake of consistency, I think we should use the
>> `help-key-binding' face to the "?" key in the message that shows up when
>> typing `C-h' and waiting.  Please see the attached patch.
>
> Makes sense to me.

Thanks, pushed (commit 9449e0740c).





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-05 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-18  9:40 bug#57906: [PATCH] Add face help-key-binding in help-char echo Stefan Kangas
2022-09-18 10:12 ` Lars Ingebrigtsen
2022-10-05 13:40   ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).