Subject: bug#21237: 25.0.50; defconst vs dump

From: [email-masked]
Date: Tue, 11 Aug 2015 15:07:21 -0500

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))