emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: substitute-command-keys does not preserve text properties


From: Kim F. Storm
Subject: Re: substitute-command-keys does not preserve text properties
Date: Wed, 09 Nov 2005 12:17:35 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Richard M. Stallman" <address@hidden> writes:

>     If you pass a string with text properties through substitute-command-keys,
>     the returned string does not preserve the text properties of the original
>     string if any command keys were substituted.  If no substitutions were
>     made, properties are preserved (I guess the original string is returned).
>
>     This behaviour may be ok, but it is not documented.
>
> I think it is not worth changing the behavior; could you document it?
>

The doc string was actually wrong about always returning a new string.
Here is a patch:

*** doc.c       09 Sep 2005 12:19:01 +0200      1.115
--- doc.c       09 Nov 2005 12:16:27 +0100      
***************
*** 735,749 ****
  DEFUN ("substitute-command-keys", Fsubstitute_command_keys,
         Ssubstitute_command_keys, 1, 1, 0,
         doc: /* Substitute key descriptions for command names in STRING.
! Return a new string which is STRING with substrings of the form \\=\\[COMMAND]
! replaced by either:  a keystroke sequence that will invoke COMMAND,
! or "M-x COMMAND" if COMMAND is not on any keys.
  Substrings of the form \\=\\{MAPVAR} are replaced by summaries
  \(made by describe-bindings) of the value of MAPVAR, taken as a keymap.
  Substrings of the form \\=\\<MAPVAR> specify to use the value of MAPVAR
  as the keymap for future \\=\\[COMMAND] substrings.
  \\=\\= quotes the following character and is discarded;
! thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ 
into the output.  */)
       (string)
       Lisp_Object string;
  {
--- 735,752 ----
  DEFUN ("substitute-command-keys", Fsubstitute_command_keys,
         Ssubstitute_command_keys, 1, 1, 0,
         doc: /* Substitute key descriptions for command names in STRING.
! Substrings of the form \\=\\[COMMAND] replaced by either: a keystroke
! sequence that will invoke COMMAND, or "M-x COMMAND" if COMMAND is not
! on any keys.
  Substrings of the form \\=\\{MAPVAR} are replaced by summaries
  \(made by describe-bindings) of the value of MAPVAR, taken as a keymap.
  Substrings of the form \\=\\<MAPVAR> specify to use the value of MAPVAR
  as the keymap for future \\=\\[COMMAND] substrings.
  \\=\\= quotes the following character and is discarded;
! thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ 
into the output.
! 
! Returns original STRING if no substitutions were made.  Othwerwise,
! a new string, without any text properties, is returned.  */)
       (string)
       Lisp_Object string;
  {


-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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