GNU bug report logs - #27433
add-face-text-property with APPEND=t destructively modifies the original property list

Previous Next

Package: emacs;

Reported by: Sebastien Chapuis <sebastien <at> chapu.is>

Date: Tue, 20 Jun 2017 21:49:01 UTC

Severity: minor

Tags: fixed

Merged with 20153

Found in versions 24.4.91, 25.2

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: npostavs <at> users.sourceforge.net
To: Sebastien Chapuis <sebastien <at> chapu.is>
Cc: 27433 <at> debbugs.gnu.org
Subject: Re: bug#27433: 25.2;
 add-face-text-property with APPEND to t mess up with initialized list
Date: Sat, 24 Jun 2017 11:50:56 -0400
retitle 27433 add-face-text-property with APPEND=t destructively modifies the original property list
severity 27433 minor
quit

Sebastien Chapuis <sebastien <at> chapu.is> writes:

> Hello, I have found a bug reproducible with emacs -Q (tested with
> emacs 25.2.2 and 25.2.1)
>
> I made a small use case that you can find here:
> - https://gist.github.com/sebastiencs/3b1f33a028d2b8d1ee41c44f5338f8e7
> or here:
> - http://paste.lisp.org/display/349159
>
> I provided explainations in the code.
> When I use edebug, the variable 'list-attributes' in the function
> 'my-icons-in-terminal' is directly set to (:family "icons-in-terminal
> (:background "red") (:background "red") ...), even if it is initialized
> with '(:family "icons-in-terminal).

> ;; If I initialize the variable list-attributes to (list :family "...") instead of '(:family) in my-icons-in-terminal,
> ;;   it doesn't appear.

I think we can fix it by using append instead of nonc, or perhaps we
should just document the side effect?

---   i/src/textprop.c
+++   w/src/textprop.c
@@ -421,7 +421,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object,
 		if (set_type == TEXT_PROPERTY_PREPEND)
 		  Fsetcar (this_cdr, Fcons (val1, Fcar (this_cdr)));
 		else
-		  nconc2 (Fcar (this_cdr), list1 (val1));
+                  Fsetcar (this_cdr, CALLN (Fappend, Fcar (this_cdr), list1 (val1)));
 	      else {
 		/* The previous value is a single value, so make it
 		   into a list. */




This bug report was last modified 5 years and 230 days ago.

Previous Next


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