Bugs item #3479603, was opened at 2012-01-25 05:31
Message generated for change (Comment added) made by smerten
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3479603&group_id=38414
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: emacs mode
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 6
Private: No
Submitted By: Jakub Wilk (jakub-wilk)
Assigned to: Stefan Merten (smerten)
Summary: rst.el: self-modifying code
Initial Comment:
I'm forwarding a bug reported by Samuel Bronson, originally at <http://bugs.debian.org/657269>:
This is the expression for the default value of the customization setting `rst-adornment-faces-alist':
,----
| (let ((alist '((t . font-lock-keyword-face)
| (nil . font-lock-keyword-face)))
| (i 1))
| (while (<= i rst-level-face-max)
| (nconc alist (list (cons i (intern (format "rst-level-%d-face" i)))))
| (setq i (1+ i)))
| alist)
`----
According to the elisp manual (which refers to this as "STANDARD"):
,----[ (elisp) Variable Definitions ]
| The expression STANDARD can be evaluated at various other times,
| too--whenever the customization facility needs to know OPTION's
| standard value. So be sure to use an expression which is harmless
| to evaluate at any time. We recommend avoiding backquotes in
| STANDARD, because they are not expanded when editing the value, so
| list values will appear to have the wrong structure.
`----
Unfortunately, the expression above is not safe to evaluate more than once, because it has the side effect of modifying the very data structure representing the expression. This happens because of the way it passes the value of a list literal to `nconc', which destructively modifies its arguments.
You can see the problem by customizing the variable `rst-level-face-max' to a few different values, then asking customize to show the saved lisp expression for `rst-adornment-faces-alist' (without having customized that).
A quick fix would be to use a copy of the literal list, as in the patch below.
----------------------------------------------------------------------
>Comment By: Stefan Merten (smerten)
Date: 2012-04-30 07:50
Message:
Contained in the next release of rst.el. Thanks to Samuel Bronson for the
patch.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3479603&group_id=38414
|