all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23254: 25.0.90; substitute-command-keys does not preserve text properties
@ 2016-04-09 18:58 Clément Pit--Claudel
  2016-04-14 15:28 ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Clément Pit--Claudel @ 2016-04-09 18:58 UTC (permalink / raw
  To: 23254


[-- Attachment #1.1: Type: text/plain, Size: 1609 bytes --]

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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* bug#23254: 25.0.90; substitute-command-keys does not preserve text properties
  2016-04-09 18:58 bug#23254: 25.0.90; substitute-command-keys does not preserve text properties Clément Pit--Claudel
@ 2016-04-14 15:28 ` Paul Eggert
  2016-04-14 15:36   ` Glenn Morris
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2016-04-14 15:28 UTC (permalink / raw
  To: Clément Pit--Claudel; +Cc: 23254-done

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

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.

[-- Attachment #2: 0001-substitute-command-keys-keeps-quotes-text-props.patch --]
[-- Type: application/x-patch, Size: 2772 bytes --]

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

* bug#23254: 25.0.90; substitute-command-keys does not preserve text properties
  2016-04-14 15:28 ` Paul Eggert
@ 2016-04-14 15:36   ` Glenn Morris
  0 siblings, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2016-04-14 15:36 UTC (permalink / raw
  To: 23254; +Cc: clement.pitclaudel, eggert

Paul Eggert wrote:

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

http://debbugs.gnu.org/17052





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

end of thread, other threads:[~2016-04-14 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-09 18:58 bug#23254: 25.0.90; substitute-command-keys does not preserve text properties Clément Pit--Claudel
2016-04-14 15:28 ` Paul Eggert
2016-04-14 15:36   ` Glenn Morris

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.