* Doc strings starting with a line break
@ 2016-09-18 10:51 Tino Calancha
2016-09-18 11:06 ` Richard Copley
2016-09-18 12:27 ` Andreas Schwab
0 siblings, 2 replies; 8+ messages in thread
From: Tino Calancha @ 2016-09-18 10:51 UTC (permalink / raw)
To: Emacs developers; +Cc: tino.calacha
Hi,
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'.
Tino
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doc strings starting with a line break
2016-09-18 10:51 Doc strings starting with a line break Tino Calancha
@ 2016-09-18 11:06 ` Richard Copley
2016-09-18 11:18 ` Tino Calancha
2016-09-18 15:58 ` Stefan Monnier
2016-09-18 12:27 ` Andreas Schwab
1 sibling, 2 replies; 8+ messages in thread
From: Richard Copley @ 2016-09-18 11:06 UTC (permalink / raw)
To: Tino Calancha; +Cc: tino.calacha, Emacs developers
On 18 September 2016 at 11:51, Tino Calancha <tino.calancha@gmail.com> wrote:
> 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 :)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doc strings starting with a line break
2016-09-18 11:06 ` Richard Copley
@ 2016-09-18 11:18 ` Tino Calancha
2016-09-18 15:58 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Tino Calancha @ 2016-09-18 11:18 UTC (permalink / raw)
To: Richard Copley; +Cc: Emacs developers, Tino Calancha
On Sun, 18 Sep 2016, Richard Copley wrote:
> On 18 September 2016 at 11:51, Tino Calancha <tino.calancha@gmail.com> wrote:
>> 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.
I guess would fit without that trick: i count 77 characters.
> For `isearch-forward' it seems unnecessary but it
> has been that way for 24 years. They do things differently
> there :)
I see. Indeed, it's being a long time.
I will accept these strings as a cargo cult.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doc strings starting with a line break
2016-09-18 10:51 Doc strings starting with a line break Tino Calancha
2016-09-18 11:06 ` Richard Copley
@ 2016-09-18 12:27 ` Andreas Schwab
2016-09-18 12:29 ` Tino Calancha
1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2016-09-18 12:27 UTC (permalink / raw)
To: Tino Calancha; +Cc: tino.calacha, Emacs developers
On Sep 18 2016, Tino Calancha <tino.calancha@gmail.com> wrote:
> 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'.
I don't see anything unusual.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doc strings starting with a line break
2016-09-18 12:27 ` Andreas Schwab
@ 2016-09-18 12:29 ` Tino Calancha
0 siblings, 0 replies; 8+ messages in thread
From: Tino Calancha @ 2016-09-18 12:29 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Emacs developers, Tino Calancha
On Sun, 18 Sep 2016, Andreas Schwab wrote:
> On Sep 18 2016, Tino Calancha <tino.calancha@gmail.com> wrote:
>
>> 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'.
>
> I don't see anything unusual.
You need to read the source code: In *Help* buffer there is no
difference at all.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doc strings starting with a line break
2016-09-18 11:06 ` Richard Copley
2016-09-18 11:18 ` Tino Calancha
@ 2016-09-18 15:58 ` Stefan Monnier
2016-09-18 16:59 ` Andreas Schwab
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2016-09-18 15:58 UTC (permalink / raw)
To: emacs-devel
>> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doc strings starting with a line break
2016-09-18 15:58 ` Stefan Monnier
@ 2016-09-18 16:59 ` Andreas Schwab
2016-09-19 1:06 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2016-09-18 16:59 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
On Sep 18 2016, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 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).
That feature is only used in elc files, though (and some el files that
are explicitly loaded noncompiled like loaddefs.el).
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Doc strings starting with a line break
2016-09-18 16:59 ` Andreas Schwab
@ 2016-09-19 1:06 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2016-09-19 1:06 UTC (permalink / raw)
To: emacs-devel
>> 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).
> That feature is only used in elc files, though (and some el files that
> are explicitly loaded noncompiled like loaddefs.el).
I'm fuzzy on the details, indeed. But IIRC the .elc files never
contains strings that start with "\<lf> so this special hack doesn't
apply to them (we have another (related) hack for the (#$ . <N>) cons
cells of those preloaded .elc files).
IOW, it might be that nowadays this hack only applies to
loaddefs.el, really. Funnily enough the patch below make Emacs crash,
rather than just changing its size.
Stefan
diff --git a/src/lread.c b/src/lread.c
index ef58b20..21a8f01 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3096,8 +3096,8 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
/* 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)
- return make_number (0);
+ /* if (!NILP (Vpurify_flag) && NILP (Vdoc_file_name) && cancel)
+ * return make_number (0); */
if (! force_multibyte && force_singlebyte)
{
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-09-19 1:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-18 10:51 Doc strings starting with a line break Tino Calancha
2016-09-18 11:06 ` Richard Copley
2016-09-18 11:18 ` Tino Calancha
2016-09-18 15:58 ` Stefan Monnier
2016-09-18 16:59 ` Andreas Schwab
2016-09-19 1:06 ` Stefan Monnier
2016-09-18 12:27 ` Andreas Schwab
2016-09-18 12:29 ` Tino Calancha
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).