all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: stephen_leake@stephe-leake.org
Cc: 21237@debbugs.gnu.org
Subject: bug#21237: 25.0.50; defconst vs dump
Date: Wed, 09 Oct 2019 06:34:31 +0200	[thread overview]
Message-ID: <87sgo2tu3s.fsf@gnus.org> (raw)
In-Reply-To: <86oaidy4g6.fsf@stephe-leake.org> (stephen leake's message of "Tue, 11 Aug 2015 15:07:21 -0500")

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





  reply	other threads:[~2019-10-09  4:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11 20:07 bug#21237: 25.0.50; defconst vs dump stephen_leake
2019-10-09  4:34 ` Lars Ingebrigtsen [this message]
2021-07-08 14:00   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgo2tu3s.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=21237@debbugs.gnu.org \
    --cc=stephen_leake@stephe-leake.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.