GNU bug report logs - #23254
25.0.90; substitute-command-keys does not preserve text properties

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Sat, 9 Apr 2016 18:59:01 UTC

Severity: normal

Found in version 25.0.90

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23254 in the body.
You can then email your comments to 23254 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23254; Package emacs. (Sat, 09 Apr 2016 18:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Pit--Claudel <clement.pitclaudel <at> live.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 09 Apr 2016 18:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.90; substitute-command-keys does not preserve text properties
Date: Sat, 9 Apr 2016 14:58:29 -0400
[Message part 1 (text/plain, inline)]
In Emacs 25, substitute-command-keys removes text properties of strings containing quotes:

> In Emacs 25:
(substitute-command-keys (propertize "`a'" 'prop 'val))
"‘a’"

> In Emacs 24.5:
(substitute-command-keys (propertize "`a'" 'prop 'val))
#("`a'" 0 3 (prop val))

As Eli pointed out on the mailing list,

> Anything that is substituted has its test properties removed:
> 
>   (substitute-command-keys (propertize "\\[forward-char]" 'prop 'val))
>    => "C-f"
> 
> The above is from Emacs 24.5.
> 
> I think patches are welcome to reinstate the properties.

This is an issue in particular for docstrings:

(defcustom my/pretty/set/option nil
  "Demo text properties in customize."
  :group 'emacs
  :type `(set (const :tag ,(concat (propertize "Title of option 1 (bold on both 24.5 and 25)" 'face '(:weight bold))
                                   "\n   "
                                   (propertize "Docs of option 1, in a smaller font on both 24.5 and 25." 'face '(:height 0.9))))
              (const :tag ,(concat (propertize "Title of option 2 (`bold' on 24.5 but not 25)" 'face '(:weight bold))
                                   "\n   "
                                   (propertize "Docs of option 2, in a smaller font on 24.5, but not 25." 'face '(:height 0.9))))))

This example uses text properties on `:tag's to make the customize buffer more readable. This works fine in GNU Emacs 24.5, but it stopped working on master (and emacs-25), because of substitute-command-keys replacing quotes and as a side effect dropping text properties.

Clément.

[signature.asc (application/pgp-signature, attachment)]

Added indication that bug 23254 blocks19759 Request was from Dmitry Gutov <dgutov <at> yandex.ru> to control <at> debbugs.gnu.org. (Sun, 10 Apr 2016 23:34:01 GMT) Full text and rfc822 format available.

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Thu, 14 Apr 2016 15:29:01 GMT) Full text and rfc822 format available.

Notification sent to Clément Pit--Claudel <clement.pitclaudel <at> live.com>:
bug acknowledged by developer. (Thu, 14 Apr 2016 15:29:01 GMT) Full text and rfc822 format available.

Message #12 received at 23254-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: 23254-done <at> debbugs.gnu.org
Subject: Re: 25.0.90; substitute-command-keys does not preserve text properties
Date: Thu, 14 Apr 2016 08:28:25 -0700
[Message part 1 (text/plain, inline)]
Although substitute-command-keys has never kept text properties when it 
makes a change, it is annoying that merely substituting quotes strips 
the properties, so I installed the attached patch into emacs-25 to fix 
this particular problem. Thanks for reporting it.
[0001-substitute-command-keys-keeps-quotes-text-props.patch (application/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23254; Package emacs. (Thu, 14 Apr 2016 15:41:02 GMT) Full text and rfc822 format available.

Message #15 received at 23254 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 23254 <at> debbugs.gnu.org
Cc: clement.pitclaudel <at> live.com, eggert <at> cs.ucla.edu
Subject: Re: bug#23254: 25.0.90;
 substitute-command-keys does not preserve text properties
Date: Thu, 14 Apr 2016 11:36:47 -0400
Paul Eggert wrote:

> Although substitute-command-keys has never kept text properties when

http://debbugs.gnu.org/17052




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 May 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 95 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.