* bug#47391: 27.2; static list return from function and nconc
@ 2021-03-25 14:54 Rajeev Narang via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-25 15:28 ` Philipp Stephani
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Rajeev Narang via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-25 14:54 UTC (permalink / raw)
To: 47391, emacs-devel
(defun fn () '(1 2))
(nconc (fn) '(3))
-> (1 2 3)
(nconc (fn) '(3))
-> (1 2 3 3) ? should be (1 2 3)
If this is not a bug, then hfy-invisible, hfy-face-to-style-i may need to be fixed.
In GNU Emacs 27.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.24)
of 2021-03-19 built on hp
Repository revision: deef5efafb70f4b171265b896505b92b6eef24e6
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: Debian GNU/Linux bullseye/sid
Recent messages:
fn
(1 2 3)
(1 2 3 3)
next-line: End of buffer [2 times]
Mark activated
next-line: End of buffer
Making completion list...
Quit
Mark activated
Making completion list...
Configured using:
'configure --prefix=/home/rajeev/tmp/build/emacs'
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT
LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS
LIBSYSTEMD JSON PDUMPER LCMS2 GMP
Important settings:
value of $LC_TIME: en_GB.UTF-8
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
reveal-mode: t
global-so-long-mode: t
global-auto-revert-mode: t
shell-dirtrack-mode: t
midnight-mode: t
display-time-mode: t
tooltip-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
transient-mark-mode: t
hs-minor-mode: t
Load-path shadows:
/home/rajeev/.config/emacs/elpa/map-3.0/map hides /home/rajeev/tmp/build/emacs/share/emacs/27.2/lisp/emacs-lisp/map
Features:
(shadow emacsbug dired-aux tabify man cal-move sh-script smie
executable smerge-mode diff vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
vc-dir ewoc vc vc-dispatcher sort gnus-cite gnus-async gnus-bcklg
gnus-ml ob-ditaa ob-plantuml org-clock org-colview org-habit cl-print
debug misearch multi-isearch js eieio-opt speedbar sb-image ezimage
dframe hfy-cmap help-fns radix-tree htmlfontify htmlfontify-loaddefs
cus-edit cus-start cus-load cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs utf-7 nnml mm-archive
network-stream url-http url-gw nsm url-cache url-auth time-stamp
org-duration view mule-util face-remap edmacro kmacro server
cursor-sensor bbdb-gnus nnfolder pcase rx xt-mouse which-func imenu
timeclock spam spam-stat gnus-uu yenc semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw
mode-local cedet org-indent reveal mailalias bbdb-message mail-extr
ol-eww eww mm-url thingatpt url-queue ol-rmail ol-mhe ol-irc ol-info
ol-gnus nnir ol-docview doc-view jka-compr image-mode exif ol-bibtex
bibtex ol-bbdb ol-w3m icomplete so-long autorevert filenotify vc-git
diff-mode bbdb-anniv cl-extra tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell ls-lisp hideshow printing
ps-print ps-print-loaddefs ps-def lpr web-server
web-server-status-codes el/web midnight el/cron bbdb-mua backtrace
help-mode qp el/wthr el/av el/hass el/fin el/remote el/script
type-break cal-iso org-id lunar solar cal-dst holidays hol-loaddefs
el/calc el/loc term disp-table ehelp dirtrack dbus parsec plstore pp
gnutls gnus-delay gnus-draft gnus-agent gnus-srvr gnus-score
score-mode nnvirtual nntp gnus-cache gnus-msg nndraft nnmh
gnus-icalendar org-capture gnus-art mm-uu mml2015 mm-view mml-smime
smime dig icalendar sieve sieve-mode sieve-manage sasl sasl-anonymous
sasl-login sasl-plain sendmail time ox-odt rng-loc rng-uri rng-parse
rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok
nxml-util ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox
org-element avl-tree generator org-agenda org-refile org-crypt org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src
ob-comint org-pcomplete pcomplete comint ansi-color ring org-list
org-faces org-entities noutline outline easy-mmode org-version
ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat advice
org-macs org-loaddefs find-func gnus-sum url url-proxy url-privacy
url-expand url-methods url-history mailcap shr url-cookie url-domsuf
url-util svg xml dom gnus-group gnus-undo gnus-start gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo parse-time iso8601 gnus-spec
gnus-int gnus-range message rmc puny dired dired-loaddefs format-spec
rfc822 mml mml-sec epa derived epg epg-config mm-decode mm-bodies
mm-encode mail-parse rfc2231 gmm-utils mailheader gnus-win gnus
nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search time-date mail-utils mm-util mail-prsvr wid-edit
el/org el/doc el/mail el/tools el/shell el/xmpp el/diary timer-list
el/timer el/util bbdb-com crm mailabbrev bbdb bbdb-site timezone
el/bbdb appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
el/init wombat-theme info package easymenu browse-url url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer 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 composite charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray 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 threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar
gtk x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 684512 118274)
(symbols 48 40819 5)
(strings 32 175683 17540)
(string-bytes 1 5739083)
(vectors 16 77783)
(vector-slots 8 1527654 184718)
(floats 8 1239 1715)
(intervals 56 41435 1244)
(buffers 1000 118))
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug#47391: 27.2; static list return from function and nconc
2021-03-25 14:54 bug#47391: 27.2; static list return from function and nconc Rajeev Narang via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-03-25 15:28 ` Philipp Stephani
2021-03-25 15:43 ` Stefan Monnier
2021-03-25 15:43 ` Stefan Monnier
2021-03-25 15:28 ` Philipp Stephani
` (2 subsequent siblings)
3 siblings, 2 replies; 11+ messages in thread
From: Philipp Stephani @ 2021-03-25 15:28 UTC (permalink / raw)
To: Rajeev Narang; +Cc: 47391, Emacs developers
Am Do., 25. März 2021 um 16:23 Uhr schrieb Rajeev Narang via Bug
reports for GNU Emacs, the Swiss army knife of text editors
<bug-gnu-emacs@gnu.org>:
>
> (defun fn () '(1 2))
>
> (nconc (fn) '(3))
> -> (1 2 3)
This is undefined behavior/unsupported. The value that (fn) evaluates
to is immutable, but nconc mutates it.
>
> (nconc (fn) '(3))
> -> (1 2 3 3) ? should be (1 2 3)
>
> If this is not a bug, then hfy-invisible, hfy-face-to-style-i may need to be fixed.
If they use this pattern, then they should indeed be fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47391: 27.2; static list return from function and nconc
2021-03-25 15:28 ` Philipp Stephani
@ 2021-03-25 15:43 ` Stefan Monnier
2021-03-25 15:43 ` Stefan Monnier
1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2021-03-25 15:43 UTC (permalink / raw)
To: Philipp Stephani; +Cc: Rajeev Narang, 47391, Emacs developers
>> (defun fn () '(1 2))
>>
>> (nconc (fn) '(3))
>> -> (1 2 3)
>
> This is undefined behavior/unsupported. The value that (fn) evaluates
> to is immutable, but nconc mutates it.
>
>>
>> (nconc (fn) '(3))
>> -> (1 2 3 3) ? should be (1 2 3)
>>
>> If this is not a bug, then hfy-invisible, hfy-face-to-style-i may need to be fixed.
>
> If they use this pattern, then they should indeed be fixed.
Note that in the code above, we usually consider that the bug is not in
`fn` but in the use of `nconc` on a list which the code doesn't know can
safely be mutated (it should hence use `append` instead).
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug#47391: 27.2; static list return from function and nconc
2021-03-25 15:28 ` Philipp Stephani
2021-03-25 15:43 ` Stefan Monnier
@ 2021-03-25 15:43 ` Stefan Monnier
1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2021-03-25 15:43 UTC (permalink / raw)
To: Philipp Stephani; +Cc: Rajeev Narang, 47391, Emacs developers
>> (defun fn () '(1 2))
>>
>> (nconc (fn) '(3))
>> -> (1 2 3)
>
> This is undefined behavior/unsupported. The value that (fn) evaluates
> to is immutable, but nconc mutates it.
>
>>
>> (nconc (fn) '(3))
>> -> (1 2 3 3) ? should be (1 2 3)
>>
>> If this is not a bug, then hfy-invisible, hfy-face-to-style-i may need to be fixed.
>
> If they use this pattern, then they should indeed be fixed.
Note that in the code above, we usually consider that the bug is not in
`fn` but in the use of `nconc` on a list which the code doesn't know can
safely be mutated (it should hence use `append` instead).
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47391: 27.2; static list return from function and nconc
2021-03-25 14:54 bug#47391: 27.2; static list return from function and nconc Rajeev Narang via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-25 15:28 ` Philipp Stephani
@ 2021-03-25 15:28 ` Philipp Stephani
2021-03-25 15:55 ` Gregory Heytings
2021-03-25 15:55 ` Gregory Heytings
3 siblings, 0 replies; 11+ messages in thread
From: Philipp Stephani @ 2021-03-25 15:28 UTC (permalink / raw)
To: Rajeev Narang; +Cc: 47391, Emacs developers
Am Do., 25. März 2021 um 16:23 Uhr schrieb Rajeev Narang via Bug
reports for GNU Emacs, the Swiss army knife of text editors
<bug-gnu-emacs@gnu.org>:
>
> (defun fn () '(1 2))
>
> (nconc (fn) '(3))
> -> (1 2 3)
This is undefined behavior/unsupported. The value that (fn) evaluates
to is immutable, but nconc mutates it.
>
> (nconc (fn) '(3))
> -> (1 2 3 3) ? should be (1 2 3)
>
> If this is not a bug, then hfy-invisible, hfy-face-to-style-i may need to be fixed.
If they use this pattern, then they should indeed be fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug#47391: 27.2; static list return from function and nconc
2021-03-25 14:54 bug#47391: 27.2; static list return from function and nconc Rajeev Narang via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-25 15:28 ` Philipp Stephani
2021-03-25 15:28 ` Philipp Stephani
@ 2021-03-25 15:55 ` Gregory Heytings
2021-03-25 15:58 ` Stefan Monnier
2021-03-25 15:55 ` Gregory Heytings
3 siblings, 1 reply; 11+ messages in thread
From: Gregory Heytings @ 2021-03-25 15:55 UTC (permalink / raw)
To: Rajeev Narang; +Cc: 47391, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
>
> (defun fn () '(1 2))
>
> (nconc (fn) '(3))
> -> (1 2 3)
>
> (nconc (fn) '(3))
> -> (1 2 3 3) ? should be (1 2 3)
>
Why do you think this is a bug? The docstring of "nconc" says:
"Concatenate any number of lists by _altering_ them. Only the last
argument is not altered, and need not be a list." (append (fn) '(3))
always returns (1 2 3).
>
> If this is not a bug, then hfy-invisible, hfy-face-to-style-i may need
> to be fixed.
>
Does the attached patch fix the bug you see?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=0001-lisp-htmlfontify.el-hfy-invisible-Return-a-new-list-.patch, Size: 837 bytes --]
From 268e15ea8d94d4e258d576408b6026bbc5e1fda3 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Thu, 25 Mar 2021 15:51:05 +0000
Subject: [PATCH 2/2] * lisp/htmlfontify.el (hfy-invisible): Return a new list
at each invocation (bug#47391)
---
lisp/htmlfontify.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index bfbe0ee165..cd7df5dfdf 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -822,7 +822,7 @@ VAL is ignored."
"This text should be invisible.
Do something in CSS to make that happen.
VAL is ignored here."
- '(("display" . "none")))
+ (list '("display" . "none")))
(defun hfy-combined-face-spec (face)
"Return a `defface' style alist of possible specifications for FACE.
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#47391: 27.2; static list return from function and nconc
2021-03-25 15:55 ` Gregory Heytings
@ 2021-03-25 15:58 ` Stefan Monnier
2021-03-25 16:03 ` Gregory Heytings
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Stefan Monnier @ 2021-03-25 15:58 UTC (permalink / raw)
To: Gregory Heytings; +Cc: Rajeev Narang, 47391, emacs-devel
> Does the attached patch fix the bug you see?
I pushed another one instead which avoids `nconc` instead of trying to
allow it.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47391: 27.2; static list return from function and nconc
2021-03-25 15:58 ` Stefan Monnier
@ 2021-03-25 16:03 ` Gregory Heytings
2021-03-25 16:03 ` Gregory Heytings
2021-03-28 13:21 ` Lars Ingebrigtsen
2 siblings, 0 replies; 11+ messages in thread
From: Gregory Heytings @ 2021-03-25 16:03 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Rajeev Narang, 47391, emacs-devel
>> Does the attached patch fix the bug you see?
>
> I pushed another one instead which avoids `nconc` instead of trying to
> allow it.
>
Okay. Apparently htmlfontify.el was written with the idea of mutating
lists returned by functions (for efficiency reasons?), hfy-invisible was
an exception.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug#47391: 27.2; static list return from function and nconc
2021-03-25 15:58 ` Stefan Monnier
2021-03-25 16:03 ` Gregory Heytings
@ 2021-03-25 16:03 ` Gregory Heytings
2021-03-28 13:21 ` Lars Ingebrigtsen
2 siblings, 0 replies; 11+ messages in thread
From: Gregory Heytings @ 2021-03-25 16:03 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Rajeev Narang, 47391, emacs-devel
>> Does the attached patch fix the bug you see?
>
> I pushed another one instead which avoids `nconc` instead of trying to
> allow it.
>
Okay. Apparently htmlfontify.el was written with the idea of mutating
lists returned by functions (for efficiency reasons?), hfy-invisible was
an exception.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47391: 27.2; static list return from function and nconc
2021-03-25 15:58 ` Stefan Monnier
2021-03-25 16:03 ` Gregory Heytings
2021-03-25 16:03 ` Gregory Heytings
@ 2021-03-28 13:21 ` Lars Ingebrigtsen
2 siblings, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-28 13:21 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Gregory Heytings, 47391, Rajeev Narang
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Does the attached patch fix the bug you see?
>
> I pushed another one instead which avoids `nconc` instead of trying to
> allow it.
I guess this means that this bug has been fixed? So I'm closing this
report now.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#47391: 27.2; static list return from function and nconc
2021-03-25 14:54 bug#47391: 27.2; static list return from function and nconc Rajeev Narang via Bug reports for GNU Emacs, the Swiss army knife of text editors
` (2 preceding siblings ...)
2021-03-25 15:55 ` Gregory Heytings
@ 2021-03-25 15:55 ` Gregory Heytings
3 siblings, 0 replies; 11+ messages in thread
From: Gregory Heytings @ 2021-03-25 15:55 UTC (permalink / raw)
To: Rajeev Narang; +Cc: 47391, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
>
> (defun fn () '(1 2))
>
> (nconc (fn) '(3))
> -> (1 2 3)
>
> (nconc (fn) '(3))
> -> (1 2 3 3) ? should be (1 2 3)
>
Why do you think this is a bug? The docstring of "nconc" says:
"Concatenate any number of lists by _altering_ them. Only the last
argument is not altered, and need not be a list." (append (fn) '(3))
always returns (1 2 3).
>
> If this is not a bug, then hfy-invisible, hfy-face-to-style-i may need
> to be fixed.
>
Does the attached patch fix the bug you see?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=0001-lisp-htmlfontify.el-hfy-invisible-Return-a-new-list-.patch, Size: 837 bytes --]
From 268e15ea8d94d4e258d576408b6026bbc5e1fda3 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Thu, 25 Mar 2021 15:51:05 +0000
Subject: [PATCH 2/2] * lisp/htmlfontify.el (hfy-invisible): Return a new list
at each invocation (bug#47391)
---
lisp/htmlfontify.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index bfbe0ee165..cd7df5dfdf 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -822,7 +822,7 @@ VAL is ignored."
"This text should be invisible.
Do something in CSS to make that happen.
VAL is ignored here."
- '(("display" . "none")))
+ (list '("display" . "none")))
(defun hfy-combined-face-spec (face)
"Return a `defface' style alist of possible specifications for FACE.
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-03-28 13:21 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-25 14:54 bug#47391: 27.2; static list return from function and nconc Rajeev Narang via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-25 15:28 ` Philipp Stephani
2021-03-25 15:43 ` Stefan Monnier
2021-03-25 15:43 ` Stefan Monnier
2021-03-25 15:28 ` Philipp Stephani
2021-03-25 15:55 ` Gregory Heytings
2021-03-25 15:58 ` Stefan Monnier
2021-03-25 16:03 ` Gregory Heytings
2021-03-25 16:03 ` Gregory Heytings
2021-03-28 13:21 ` Lars Ingebrigtsen
2021-03-25 15:55 ` Gregory Heytings
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.