GNU bug report logs - #21237
25.0.50; defconst vs dump

Previous Next

Package: emacs;

Reported by: stephen_leake <at> stephe-leake.org

Date: Tue, 11 Aug 2015 20:09:02 UTC

Severity: minor

Found in version 25.0.50

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

Bug is archived. No further changes may be made.

Forwarded to http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00471.html

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

Acknowledgement sent to stephen_leake <at> stephe-leake.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 11 Aug 2015 20:09:02 GMT) Full text and rfc822 format available.

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

From: stephen_leake <at> stephe-leake.org
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; defconst vs dump
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))




Set bug forwarded-to-address to 'http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00471.html'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 11 Aug 2015 22:27:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21237; Package emacs. (Wed, 09 Oct 2019 04:35:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: stephen_leake <at> stephe-leake.org
Cc: 21237 <at> debbugs.gnu.org
Subject: Re: bug#21237: 25.0.50; defconst vs dump
Date: Wed, 09 Oct 2019 06:34:31 +0200
stephen_leake <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21237; Package emacs. (Thu, 08 Jul 2021 14:01:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: stephen_leake <at> stephe-leake.org
Cc: 21237 <at> debbugs.gnu.org
Subject: Re: bug#21237: 25.0.50; defconst vs dump
Date: Thu, 08 Jul 2021 16:00:14 +0200
Lars Ingebrigtsen <larsi <at> 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




bug closed, send any further explanations to 21237 <at> debbugs.gnu.org and stephen_leake <at> stephe-leake.org Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 08 Jul 2021 14:01:03 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. (Fri, 06 Aug 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 263 days ago.

Previous Next


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