emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 5f5fe27: Treat help strings like other doc strings


From: Paul Eggert
Subject: [Emacs-diffs] master 5f5fe27: Treat help strings like other doc strings
Date: Sun, 02 Aug 2015 21:58:19 +0000

branch: master
commit 5f5fe275ec54194a9293690ffee3d425026ac14b
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Treat help strings like other doc strings
    
    * doc/lispref/text.texi (Special Properties), etc/NEWS: Document this.
    * lisp/epa.el (epa--select-keys): Remove no-longer-needed calls to
    substitute-command-keys.
    * src/keyboard.c (show_help_echo, parse_menu_item): Call
    substitute-command-keys on the help string before displaying it.
---
 doc/lispref/text.texi |    6 ++++--
 etc/NEWS              |    8 ++++++++
 lisp/epa.el           |    6 ++----
 src/keyboard.c        |   12 +++++++++---
 4 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index acf7234..e63e634 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -3472,8 +3472,10 @@ function called to display help strings.  These may be 
@code{help-echo}
 properties, menu help strings (@pxref{Simple Menu Items},
 @pxref{Extended Menu Items}), or tool bar help strings (@pxref{Tool
 Bar}).  The specified function is called with one argument, the help
-string to display.  Tooltip mode (@pxref{Tooltips,,, emacs, The GNU Emacs
-Manual}) provides an example.
+string to display, which is passed through
address@hidden before being given to the function; see
address@hidden in Documentation}.  Tooltip mode (@pxref{Tooltips,,, emacs,
+The GNU Emacs Manual}) provides an example.
 @end defvar
 
 @node Format Properties
diff --git a/etc/NEWS b/etc/NEWS
index 4ab80f5..85df716 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -886,6 +886,7 @@ when signaling a file error.  For example, it now reports 
"Permission
 denied" instead of "permission denied".  The old behavior was problematic
 in languages like German where downcasing rules depend on grammar.
 
++++
 ** substitute-command-keys now replaces quotes.
 That is, it converts documentation strings' quoting style as per the
 value of the new custom variable ‘help-quote-translation’: ?‘ means
@@ -1008,6 +1009,7 @@ directory at point.
 *** New macros `thread-first' and `thread-last' allow threading a form
     as the first or last argument of subsequent forms.
 
++++
 ** Documentation strings now support quoting with curved single quotes
 ‘like-this’ in addition to the old style with grave accent and
 apostrophe `like-this'.  The new style looks better on today's displays.
@@ -1019,6 +1021,12 @@ key works) by typing ‘A-[’ and ‘A-]’.  As described 
above under
 string quotes.
 
 +++
+** show-help-function's arg is converted via substitute-command-keys
+before being passed to the function.  Help strings, help-echo
+properties, etc. can therefore contain command key escapes and
+quotation marks.
+
++++
 ** Time-related changes:
 
 *** Time conversion functions now accept an optional ZONE argument
diff --git a/lisp/epa.el b/lisp/epa.el
index f6d6045..a02f1e9 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -462,14 +462,12 @@ If ARG is non-nil, mark the key."
       (widget-create 'link
                     :notify (lambda (&rest _ignore) (abort-recursive-edit))
                     :help-echo
-                    (substitute-command-keys
-                     "Click here or \\[abort-recursive-edit] to cancel")
+                    "Click here or \\[abort-recursive-edit] to cancel"
                     "Cancel")
       (widget-create 'link
                     :notify (lambda (&rest _ignore) (exit-recursive-edit))
                     :help-echo
-                    (substitute-command-keys
-                     "Click here or \\[exit-recursive-edit] to finish")
+                    "Click here or \\[exit-recursive-edit] to finish"
                     "OK")
       (insert "\n\n")
       (epa--insert-keys keys)
diff --git a/src/keyboard.c b/src/keyboard.c
index 91cca8e..5f86675 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2139,7 +2139,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, 
Lisp_Object object,
   if (STRINGP (help) || NILP (help))
     {
       if (!NILP (Vshow_help_function))
-       call1 (Vshow_help_function, help);
+       call1 (Vshow_help_function, Fsubstitute_command_keys (help));
       help_echo_showing_p = STRINGP (help);
     }
 }
@@ -7720,7 +7720,8 @@ parse_menu_item (Lisp_Object item, int inmenubar)
       /* Maybe help string.  */
       if (CONSP (item) && STRINGP (XCAR (item)))
        {
-         ASET (item_properties, ITEM_PROPERTY_HELP, XCAR (item));
+         ASET (item_properties, ITEM_PROPERTY_HELP,
+               Fsubstitute_command_keys (XCAR (item)));
          start = item;
          item = XCDR (item);
        }
@@ -7781,7 +7782,12 @@ parse_menu_item (Lisp_Object item, int inmenubar)
                    return 0;
                }
              else if (EQ (tem, QChelp))
-               ASET (item_properties, ITEM_PROPERTY_HELP, XCAR (item));
+               {
+                 Lisp_Object help = XCAR (item);
+                 if (STRINGP (help))
+                   help = Fsubstitute_command_keys (help);
+                 ASET (item_properties, ITEM_PROPERTY_HELP, help);
+               }
              else if (EQ (tem, QCfilter))
                filter = item;
              else if (EQ (tem, QCkey_sequence))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]