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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27433 in the body.
You can then email your comments to 27433 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#27433; Package emacs. (Tue, 20 Jun 2017 21:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sebastien Chapuis <sebastien <at> chapu.is>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 20 Jun 2017 21:49:02 GMT) Full text and rfc822 format available.

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

From: Sebastien Chapuis <sebastien <at> chapu.is>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2;
 add-face-text-property with APPEND to t mess up with initialized list
Date: Wed, 21 Jun 2017 05:40:09 +0800
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).

Thank you,
Sebastien Chapuis.



In GNU Emacs 25.2.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.31)
 of 2017-04-27 built on XPS13
Repository revision: 3a34412caae002accd0fc7a7fc0b718c2f34159b
Windowing system distributor 'Fedora Project', version 11.0.11903000
System Description:	Fedora release 25 (Twenty Five)

Configured using:
 'configure --prefix=/opt/emacs --with-modules --with-x-toolkit=gtk2'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES

Important settings:
  value of $LANG: fr_FR.utf8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  semantic-minor-modes-format: ((:eval (if (or semantic-highlight-edits-mode semantic-show-unmatched-syntax-mode)  S)))
  yas-minor-mode: t
  display-time-mode: t
  global-anzu-mode: t
  anzu-mode: t
  global-hl-line-mode: t
  display-battery-mode: t
  global-git-gutter-mode: t
  which-key-mode: t
  projectile-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  semantic-idle-scheduler-mode: t
  semantic-mode: t
  company-quickhelp-mode: t
  company-quickhelp-local-mode: t
  global-company-mode: t
  company-mode: t
  helm-mode: t
  shell-dirtrack-mode: t
  aggressive-indent-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  show-smartparens-global-mode: t
  show-smartparens-mode: t
  smartparens-mode: t
  async-bytecomp-package-mode: t
  save-place-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
[mu4e] Switched context to chapuis
let*: Wrong type argument: stringp, nilInvalid face attribute (:background "red") (:background "red")
Invalid face attribute (:background "red") (:background "red") [836 times]
Updating buffer list...done
Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help
Invalid face attribute (:background "red") (:background "red") [7558 times]
Unable to load color "" [2 times]
Unable to load color "color-235"
Unable to load color "color-26"
Invalid face attribute (:background "red") (:background "red") [5061 times]

Load-path shadows:
~/.local/share/icons-in-terminal/icons-in-terminal hides /home/sebastien/.emacs.d/lisp/icons-in-terminal
~/github/my-company-quickhelp/company-quickhelp hides /home/sebastien/.emacs.d/elpa/company-quickhelp-20170429.1052/company-quickhelp
~/github/my-pos-tip/pos-tip hides /home/sebastien/.emacs.d/elpa/pos-tip-20150318.813/pos-tip
/home/sebastien/.emacs.d/lisp/smooth-scrolling hides /home/sebastien/.emacs.d/elpa/smooth-scrolling-20161002.1249/smooth-scrolling
/home/sebastien/.emacs.d/lisp/bind-key hides /home/sebastien/.emacs.d/elpa/bind-key-20161218.1520/bind-key

Features:
(shadow semantic/tag-write face-remap emacsbug winner helm-command
helm-elisp helm-eval edebug semantic/analyze/complete
semantic/db-typecache semantic/analyze semantic/sort semantic/scope
semantic/analyze/fcn semantic/edit windmove semantic/decorate/mode
semantic/decorate pulse semantic/db-find semantic/db-ref
semantic/db-file data-debug cedet-files company-elisp yasnippet init-gui
ibuf-macs company-oddmuse company-files company-capf company-cmake
company-xcode company-clang company-semantic company-eclim company-nxml
company-bbdb company-yasnippet company-keywords company-etags etags xref
project company-gtags company-template company-dabbrev-code
company-dabbrev cus-start cus-load my-theme google-c-style time
hippie-exp helm-swoop restart-emacs server anzu smtpmail-async mu4e-conf
mu4e desktop frameset mu4e-speedbar mu4e-main mu4e-view cal-menu
calendar cal-loaddefs epa mu4e-headers mu4e-compose mu4e-context
mu4e-draft mu4e-actions rfc2368 mu4e-mark mu4e-message flow-fill
html2text mu4e-proc mu4e-proc-mu mu4e-utils doc-view jka-compr
image-mode mu4e-lists mu4e-vars message rfc822 mml mml-sec epg mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
hl-line mu4e-meta smtpmail-multi smtpmail sendmail rfc2047 rfc2045
ietf-drums mail-utils cleanline which-func battery sidebar
sidebar-buffers sidebar-mu4e sidebar-face sidebar-select derived
sidebar-utils sidebar-filemapping icons-in-terminal ov ace-window avy
git-gutter helm-tramp dash-functional imenu-list clojure-mode-expansions
smartparens-clojure clojure-mode align imenu help-fns+ wid-edit
toggle-quotes alert log4e notifications dbus gntp git-messenger popup
gitconfig-mode conf-mode indent-guide iedit iedit-lib which-key
move-text expand-region text-mode-expansions web-mode-expansions
er-basic-expansions expand-region-core expand-region-custom
ssh-config-mode clang-rename esup esup-child benchmark
clang-include-fixer let-alist smartparens-html web-mode disp-table
company-web-html company-web company-css web-completion-data
projectile-speedbar sr-speedbar projectile grep ibuf-ext
multiple-cursors mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more mc-cycle-cursors
mc-edit-lines multiple-cursors-core rect ibuffer semantic/db-mode
semantic/idle srefactor-lisp semantic/bovine/el semantic/format
semantic/tag-ls semantic/find semantic/ctxt semantic/db-el eieio-opt
speedbar sb-image ezimage dframe semantic/db eieio-base semantic/bovine
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw mode-local cedet company-quickhelp company helpful
elisp-refs loop f s list-utils modern-cpp-font-lock crux helm-ag
helm-mode helm-files image-dired tramp tramp-compat tramp-loaddefs
trampver ucs-normalize shell pcomplete format-spec dired-x dired-aux
ffap helm-buffers helm-tags helm-bookmark helm-adaptive helm-info
bookmark pp helm-locate helm-grep helm-regexp helm-external helm-net
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse auth-source gnus-util mm-util
help-fns mail-prsvr password-cache url-vars mailcap helm-utils compile
comint ansi-color helm-help helm-types helm helm-source eieio-compat
eieio eieio-core helm-multi-match helm-lib dired aggressive-indent
flycheck-irony flycheck json map irony-diagnostics irony find-func
irony-iotask neotree time-date smartparens-config smartparens thingatpt
dash fish-mode rx paradox paradox-menu paradox-commit-list hydra ring lv
paradox-execute paradox-github paradox-core subr-x spinner android-mode
xml ido helm-config helm-easymenu edmacro kmacro async-bytecomp advice
async all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons memoize
font-lock+ autoinsert pos-tip saveplace use-package diminish bind-key
easy-mmode finder-inf cl-seq cl-macs cl info package epg-config seq
byte-opt gv bytecomp byte-compile cl-extra help-mode easymenu cconv
cl-loaddefs pcase cl-lib mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 651106 389102)
 (symbols 48 56376 11)
 (miscs 40 949 1289)
 (strings 32 151184 319489)
 (string-bytes 1 4475615)
 (vectors 16 88656)
 (vector-slots 8 2027993 231654)
 (floats 8 1469 1429)
 (intervals 56 3355 1052)
 (buffers 976 32))

--
Sebastien Chapuis




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27433; Package emacs. (Sat, 24 Jun 2017 15:50:01 GMT) Full text and rfc822 format available.

Message #8 received at 27433 <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. */




Changed bug title to 'add-face-text-property with APPEND=t destructively modifies the original property list' from '25.2; add-face-text-property with APPEND to t mess up with initialized list' Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 24 Jun 2017 15:50:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 24 Jun 2017 15:50:02 GMT) Full text and rfc822 format available.

Forcibly Merged 20153 27433. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sun, 16 Jul 2017 14:16:02 GMT) Full text and rfc822 format available.

Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 09 Oct 2019 03:09:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 20153 <at> debbugs.gnu.org and Oleh Krehel <ohwoeowho <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 09 Oct 2019 03:09:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 07 Nov 2019 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 165 days ago.

Previous Next


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