[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Doc strings starting with a line break
From: |
Stefan Monnier |
Subject: |
Re: Doc strings starting with a line break |
Date: |
Sun, 18 Sep 2016 11:58:23 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
>> i am wondering what could be the reason for some doc strings
>> starting with a break line.
>> For instance, see `isearch-forward' or `looking-at-p'.
> The newline is escaped so it's not part of the docstring. For
> `looking-at-p' it allows the following line of code to fit into 80
> characters. For `isearch-forward' it seems unnecessary but it
> has been that way for 24 years. They do things differently
> there :)
There's a special hack in the Lisp reader which reads such strings as
the constant 0 (under some circumstances) so that we don't allocate
memory for those strings which will soon after be replaced by
a reference to some part of the DOC file (via Snarf-documentation).
This memory could/would be recovered by GC, so it wouldn't be completely
wasted, but it usually wouldn't be returned to the OS (IOW it would stay
in the free-list of Elisp's memory manager), so it would result in
a slightly larger bin/emacs executable and initial memory footprint
(unless we replace this current hack by some other mechanism, obviously).
Stefan