unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lynn Winebarger <owinebar@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Po Lu <luangruo@yahoo.com>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Docstring hack
Date: Sun, 31 Jul 2022 08:53:57 -0400	[thread overview]
Message-ID: <CAM=F=bB_aBv7TjA80TNo4DzHCzauSwhdp13JV64MWxSU-T+CFA@mail.gmail.com> (raw)
In-Reply-To: <83o7x54swu.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2439 bytes --]

On Sun, Jul 31, 2022, 3:56 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Po Lu <luangruo@yahoo.com>
> > Cc: owinebar@gmail.com,  emacs-devel@gnu.org
> > Date: Sun, 31 Jul 2022 15:24:13 +0800
> >
> > Eli Zaretskii <eliz@gnu.org> writes:
> >
> > > OK, but I still lack some glue to understand the issue.  Specifically:
> > >
> > >   . the OP said "strings that are erroneously treated as docstrings in
> > >     dump mode" -- where's the code which makes that mistake, and how
> > >     is read_literal_string related to that mistake?
> >
> > He's referring to this part of lread.c:
> >
> >   /* If purifying, and string starts with \ newline,
> >      return zero instead.  This is for doc strings
> >      that we are really going to find in etc/DOC.nn.nn.  */
> >   if (!NILP (Vpurify_flag) && NILP (Vdoc_file_name) && cancel)
> >     {
> >       unbind_to (count, Qnil);
> >       return make_fixnum (0);
> >     }
>
> Does this mean that just resetting purify-flag is enough to avoid the
> problem?  If so, I think purify-flag is only meant for preloaded
> packages, and dumping Emacs with additional packages isn't supposed to
> set that flag.  Or maybe loadup.el should load an additional file
> (beyond site-load and site-init), after it resets purify-flag?
>

I'm not sure why you'd not want to use the purify flag, since there are a
lot of explicit calls to purecopy that appear intended to take advantage of
hash consing.  I don't know why that benefit should not apply to libraries
being preloaded by site-load and site-init.


An alternative is, of course, to make that code in lread.c smarter in
> detecting doc strings and applying that handling only to doc strings.
>
> > >   . why isn't there an alternative to fix read_literal_string not to
> > >     generate zero instead of the format template? the other
> > >     alternatives all look like partial kludges to me
> >
> > I can't answer this question, sorry.  You'll have to ask the OP.
>
> I did: the OP was on the CC list.
>

My fifth alternative was to implement the substitution of 0 directly in the
evaluator semantics, so that it would only record 0 for actual docstrings
identified while evaluating source code forms during dump mode.
That seems like overkill if this is only required for loaddefs.  But the
manual should probably state that files loaded in site-load and site-init
need to be byte compiled for their docstrings to be dynamically loaded.

Lynn

[-- Attachment #2: Type: text/html, Size: 4074 bytes --]

  parent reply	other threads:[~2022-07-31 12:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-30 12:14 Docstring hack Lynn Winebarger
2022-07-30 12:25 ` Po Lu
2022-07-30 12:50   ` Lynn Winebarger
2022-07-30 13:04     ` Lynn Winebarger
2022-07-30 13:32     ` Po Lu
2022-07-30 13:28 ` Eli Zaretskii
2022-07-30 13:36   ` Po Lu
2022-07-30 15:11     ` Eli Zaretskii
2022-07-30 15:38       ` Lynn Winebarger
2022-07-30 15:44         ` Eli Zaretskii
2022-07-30 16:32           ` Lynn Winebarger
2022-07-30 16:43             ` Eli Zaretskii
2022-07-31  2:17               ` Po Lu
2022-07-31  6:27                 ` Eli Zaretskii
2022-07-31  7:24                   ` Po Lu
2022-07-31  7:56                     ` Eli Zaretskii
2022-07-31  8:48                       ` Po Lu
2022-07-31  9:14                         ` Lars Ingebrigtsen
2022-07-31 22:31                           ` Stefan Monnier
2022-08-01 10:38                             ` Lars Ingebrigtsen
2022-08-04  4:12                         ` Lynn Winebarger
2022-07-31 12:53                       ` Lynn Winebarger [this message]
2022-07-31 13:05                         ` Eli Zaretskii
2022-07-31 20:29                           ` Lynn Winebarger
2022-08-01  1:05                             ` Po Lu
2022-08-01 11:07                             ` Eli Zaretskii
2022-07-31  8:03                   ` Stefan Monnier
2022-07-31 12:43                     ` Lynn Winebarger
2022-07-31 21:32                       ` Stefan Monnier
2022-08-02 16:55                         ` Lynn Winebarger
2022-07-31 11:57               ` Lynn Winebarger
2022-07-31  0:52       ` Po Lu
2022-07-31  7:52     ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAM=F=bB_aBv7TjA80TNo4DzHCzauSwhdp13JV64MWxSU-T+CFA@mail.gmail.com' \
    --to=owinebar@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).