* bug#21237: 25.0.50; defconst vs dump
@ 2015-08-11 20:07 stephen_leake
2019-10-09 4:34 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: stephen_leake @ 2015-08-11 20:07 UTC (permalink / raw
To: 21237
Given these two definitions:
(defconst format-1
(let ((str "(%s %s)"))
(put-text-property 1 3 'face 'font-lock-keyword-face str)
(put-text-property 4 6 'face 'font-lock-function-name-face str)
str))
(defvar format-2
(let ((str "(%s %s %s)"))
(put-text-property 1 3 'face 'font-lock-keyword-face str)
(put-text-property 4 6 'face 'font-lock-function-name-face str)
str))
If I byte-compile a file containing these, and later load that
byte-compiled file, the text properties are present on both format-1 and
format-2.
However, if the file is dumped for preloading into emacs, then the text
properties are not present on format-1; the defconst apparently causes
them to disappear.
If this is desired/intended behavior, it should be documented in the
defconst doc string, and there should be a warning during the dump
process.
In GNU Emacs 25.0.50.10 (x86_64-w64-mingw32)
of 2015-08-11 on TAKVER2
Repository revision: 85f7e5115f9f409126d355997e8103ea5126ada2
Windowing system distributor `Microsoft Corp.', version 6.3.9600
Configured using:
`configure --prefix=/mingw64
PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig'
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: cp1252
Major mode: Emacs-Lisp
Minor modes in effect:
diff-auto-refine-mode: t
global-ede-mode: t
ede-minor-mode: t
other-frame-window-mode: t
display-time-mode: t
delete-selection-mode: t
icomplete-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-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
line-number-mode: t
transient-mark-mode: t
Recent messages:
Error: (file-error "Setting ACL" "Operation not permitted" "c:/home/stephe/projects.text~")
Wrote c:/home/stephe/projects.text
Compiling c:/home/stephe/Elisp_Work/defconst_vs_bytecompile.el...done
Wrote c:/home/stephe/Elisp_Work/defconst_vs_bytecompile.elc
You can run the command `byte-compile-file' with M-x by-c RET
Wrote c:/home/stephe/Elisp_Work/defconst_vs_bytecompile.elc
Saving file c:/home/stephe/Misc/emacs_notes.text...
Wrote c:/home/stephe/Misc/emacs_notes.text
Mark set [3 times]
Auto-saving...
Load-path shadows:
c:/home/stephe/.emacs.d/elpa/ada-ref-man-2012.0/ada-ref-man hides /Projects/org.emacs.ada-mode/ada-ref-man
/Projects/org.emacs.ada-mode/ada-xref hides c:/Projects/emacs/master/lisp/progmodes/ada-xref
/Projects/org.emacs.ada-mode/ada-stmt hides c:/Projects/emacs/master/lisp/progmodes/ada-stmt
/Projects/org.emacs.ada-mode/ada-prj hides c:/Projects/emacs/master/lisp/progmodes/ada-prj
/Projects/org.emacs.ada-mode/ada-mode hides c:/Projects/emacs/master/lisp/progmodes/ada-mode
Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils copyright
gpr-query xref-ada ada-skel ada-skeletons skeleton ada-compiler
ada-gnat-compile ada-xref-tool ada-gnat-xref gnat-core ada-indent-engine
ada-wisi ada-indent-user-options ada-grammar-wy wisi-compile wisi
wisi-parse wisi-compat-24.2 semantic/wisent semantic/wisent/wisent
ada-fix-error ada-build ada-mode find-file ada-mode-compat-24.2 align
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs vc vc-dispatcher vc-git diff-mode project-settings
ede/generic semantic/db ede/shell ede/config eieio-opt find-func
ede/emacs ede/speedbar ede/files ede ede/detect ede/base ede/auto
ede/source eieio-base eieio-speedbar speedbar sb-image ezimage dframe
eieio-custom project-elisp xref-patches semantic/symref
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw mode-local cedet project-patches etags xgit-core bzr-core
xmtn-minimal dvc-autoloads dvc-unified dvc-core dvc-buffers dvc-ui
dvc-register dvc-utils ewoc dvc-emacs ffap thingatpt url-parse
auth-source gnus-util mm-util help-fns mail-prsvr password-cache
url-vars dvc-defs dvc-site other-frame-window time delsel cus-start
cus-load color-theme edmacro kmacro wid-edit cl noutline outline
easy-mmode xref cl-seq project eieio byte-opt bytecomp byte-compile
cl-extra help-mode seq cconv eieio-core whitespace dired-x dired-aux
dired compile comint ansi-color ring cl-macs gv cl-loaddefs pcase cl-lib
icomplete finder-inf bbdb-autoloads info package easymenu epg-config
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp disp-table w32-win w32-vars
term/common-win 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
w32notify w32 multi-tty make-network-process emacs)
Memory information:
((conses 16 372334 22137)
(symbols 56 32965 0)
(miscs 48 87 352)
(strings 32 61954 12167)
(string-bytes 1 1753908)
(vectors 16 33702)
(vector-slots 8 1346382 183617)
(floats 8 715 202)
(intervals 56 991 85)
(buffers 976 19))
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#21237: 25.0.50; defconst vs dump
2015-08-11 20:07 bug#21237: 25.0.50; defconst vs dump stephen_leake
@ 2019-10-09 4:34 ` Lars Ingebrigtsen
2021-07-08 14:00 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-09 4:34 UTC (permalink / raw
To: stephen_leake; +Cc: 21237
stephen_leake@stephe-leake.org writes:
> Given these two definitions:
>
> (defconst format-1
> (let ((str "(%s %s)"))
> (put-text-property 1 3 'face 'font-lock-keyword-face str)
> (put-text-property 4 6 'face 'font-lock-function-name-face str)
> str))
>
> (defvar format-2
> (let ((str "(%s %s %s)"))
> (put-text-property 1 3 'face 'font-lock-keyword-face str)
> (put-text-property 4 6 'face 'font-lock-function-name-face str)
> str))
>
> If I byte-compile a file containing these, and later load that
> byte-compiled file, the text properties are present on both format-1 and
> format-2.
>
> However, if the file is dumped for preloading into emacs, then the text
> properties are not present on format-1; the defconst apparently causes
> them to disappear.
I can confirm that this is still the case in Emacs 27.
> If this is desired/intended behavior, it should be documented in the
> defconst doc string, and there should be a warning during the dump
> process.
I tried looking around in the code a bit, but I don't really know what
to look for.
Does anybody know whether this behaviour is intended? It seems odd that
defvars and defconsts are handled differently here.
Hm... Oh! Here's from defconst:
if (!NILP (Vpurify_flag))
tem = Fpurecopy (tem);
and purecopy:
purecopy (Lisp_Object obj)
{
if (FIXNUMP (obj)
|| (! SYMBOLP (obj) && PURE_P (XPNTR (obj)))
|| SUBRP (obj))
return obj; /* Already pure. */
if (STRINGP (obj) && XSTRING (obj)->u.s.intervals)
message_with_string ("Dropping text-properties while making string `%s' pure",
obj, true);
And, indeed, I get
Dropping text-properties while making string `(%s %s)' pure
when compiling. (Side issue: Should that have a "Warning: " prefix or
something so that it gets more noticeable?)
So I guess this is intended behaviour? I guess it's too obscure a thing
to put in the doc string of defconst.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#21237: 25.0.50; defconst vs dump
2019-10-09 4:34 ` Lars Ingebrigtsen
@ 2021-07-08 14:00 ` Lars Ingebrigtsen
0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-08 14:00 UTC (permalink / raw
To: stephen_leake; +Cc: 21237
Lars Ingebrigtsen <larsi@gnus.org> writes:
> And, indeed, I get
>
> Dropping text-properties while making string `(%s %s)' pure
>
> when compiling. (Side issue: Should that have a "Warning: " prefix or
> something so that it gets more noticeable?)
>
> So I guess this is intended behaviour? I guess it's too obscure a thing
> to put in the doc string of defconst.
So I'm closing this bug report (since the build process does warn about
this, and people not doing Emacs dumping doesn't need to have this in
the defconst doc string).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-08 14:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-11 20:07 bug#21237: 25.0.50; defconst vs dump stephen_leake
2019-10-09 4:34 ` Lars Ingebrigtsen
2021-07-08 14:00 ` Lars Ingebrigtsen
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.