From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: Noam Postavsky <npostavs@gmail.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#28607: 27.0.50; help-fns unsolicited elisp loading
Date: Sat, 18 May 2019 12:00:52 -0400
Message-ID: <87tvdrda6j.fsf@gmail.com>
References: <87efqtoc9u.fsf@udel.edu> <3cvak51n96.fsf@fencepost.gnu.org>
	<20170926155126.kujypxt33oxbzxsq@logos.localdomain>
	<83in5xjzak.fsf@gnu.org>
	<CAKyxw10XCzp1fY96vcm_Ep_hZsF3a-YQeUnSkUc1p5WvPtDYhw@mail.gmail.com>
	<bjk1qdds39.fsf@fencepost.gnu.org>
	<CAKyxw13--qefNuxLQNjvsH7WRQHs0ucGmT9bXeZ3eVvtE-rdXA@mail.gmail.com>
	<874l5vf8q5.fsf@gmail.com> <83sgtecyen.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="141711"; mail-complaints-to="usenet@blaine.gmane.org"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
Cc: mvoteiza@udel.edu, 28607@debbugs.gnu.org,
	Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 18 18:05:53 2019
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256)
	(Exim 4.89)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1hS1qJ-000ahm-Ux
	for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 May 2019 18:05:52 +0200
Original-Received: from localhost ([127.0.0.1]:35969 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1hS1qI-00077n-TA
	for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 May 2019 12:05:50 -0400
Original-Received: from eggs.gnu.org ([209.51.188.92]:38866)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hS1me-0004dH-3l
	for bug-gnu-emacs@gnu.org; Sat, 18 May 2019 12:02:05 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hS1mc-0006Km-LX
	for bug-gnu-emacs@gnu.org; Sat, 18 May 2019 12:02:04 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:47536)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1hS1mc-0006KY-I7
	for bug-gnu-emacs@gnu.org; Sat, 18 May 2019 12:02:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1hS1mc-0003l5-DM
	for bug-gnu-emacs@gnu.org; Sat, 18 May 2019 12:02:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Noam Postavsky <npostavs@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sat, 18 May 2019 16:02:02 +0000
Resent-Message-ID: <handler.28607.B28607.155819526414374@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 28607
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
Original-Received: via spool by 28607-submit@debbugs.gnu.org id=B28607.155819526414374
	(code B ref 28607); Sat, 18 May 2019 16:02:02 +0000
Original-Received: (at 28607) by debbugs.gnu.org; 18 May 2019 16:01:04 +0000
Original-Received: from localhost ([127.0.0.1]:32843 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1hS1lg-0003jl-1u
	for submit@debbugs.gnu.org; Sat, 18 May 2019 12:01:04 -0400
Original-Received: from mail-io1-f45.google.com ([209.85.166.45]:42000)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <npostavs@gmail.com>) id 1hS1lb-0003j3-E3
	for 28607@debbugs.gnu.org; Sat, 18 May 2019 12:01:00 -0400
Original-Received: by mail-io1-f45.google.com with SMTP id g16so7850381iom.9
	for <28607@debbugs.gnu.org>; Sat, 18 May 2019 09:00:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; 
	h=from:to:cc:subject:references:date:in-reply-to:message-id
	:user-agent:mime-version;
	bh=egL21AuVkjZhbBgp1wa7x48vtMxn/s/KZsJGZtOqztk=;
	b=fl4mxfFVUm1qkoICERwYr6EzPcl3TavvR5FlPbYpQsVbC6NRaLhPLWCY9bx4GRstBK
	aOa23wDh/hM4C0ChyNR8K0wQKHuK1+JWRzv1CykgXAwNkWPCE7zGyaKrv6y3VzzyIAZr
	U7L7UzqOPfxPIKO6JVFp/Ejs/fM/upec6DsZcGed4Pb7AV7QejcqYMUhVJbYWYMvpqfV
	Ps3Gug8Pdzb4LsuYFfmQrebf11QuOzWxXOC5Sx4PQzQ+Y6qzq+5fN3GQcONXaC0AuclE
	qRefE5yHHItc3XPuWEJCW9qte5k7E7PJtUy06FON34qQTjVvYAVaZ7mMSUBkotf3byVU
	EDTQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
	:message-id:user-agent:mime-version;
	bh=egL21AuVkjZhbBgp1wa7x48vtMxn/s/KZsJGZtOqztk=;
	b=PBoBLx8PEjum6f8omstTKQu26nJM4XQKPT7OoTOlh+vQBsE7xKsIH9XRkTo+lahfTW
	NFFHf6Nzyr9Og4RIhd1qN/2ESRKZp5p5B9kejhYdh4J0f35IaTkHN/tg1TTtFzacJlOd
	yBZSdyvtpTyX2v1bnoLNRKipDVGKKF8DuFxRYAZdslVhjSYOX1g586a/8HwNTHMqJYfF
	dxah9uq2JzBTftp76tbwMXY3ZWRyg8PztQGVI3VBGDHcpPY8HEJSaT4WSDSPX3MK59QJ
	ABnD5JECXYmHzs4PLlZcziTNLTSUDkTSiSn4QK2wR1bUpTaDIJ2rBVghLG0FUA88FAAz
	22iw==
X-Gm-Message-State: APjAAAVAlSCWFfLS7HPUf+4rBo5KD29INkzB/7Yq5RXTS6CwjcAuqGht
	9zRfAPqs8xyaTolDZdfs3lg=
X-Google-Smtp-Source: APXvYqwiZwZV726QMVfHEX2DLCs9WoBdckHcLTEii4Hoy8jonD8Tkq5A8vkrdIWmo+I6RYZt9lFqrg==
X-Received: by 2002:a6b:fa11:: with SMTP id p17mr24573161ioh.286.1558195253547;
	Sat, 18 May 2019 09:00:53 -0700 (PDT)
Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
	by smtp.gmail.com with ESMTPSA id
	b196sm77326itb.30.2019.05.18.09.00.52
	(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
	Sat, 18 May 2019 09:00:53 -0700 (PDT)
In-Reply-To: <83sgtecyen.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 May
	2019 16:38:24 +0300")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 209.51.188.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
	the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gnu-emacs/>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "bug-gnu-emacs"
	<bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.bugs:159497
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/159497>

Eli Zaretskii <eliz@gnu.org> writes:

>> I made a new option instead of extending help-enable-auto-load
>> because otherwise I would have to think about how to dis/enable them
>> each individually, which is annoying to encode in a single option.
>
> Thanks, this LGTM.  I wonder whether we should document
> definition-prefixes (together with the mechinery it is part of) and
> this new option in the ELisp manual.

Yeah, I think the machinery deserves a mention in the Elisp manual at
least.  Though the user option should go in the Emacs manual.

--- c/doc/emacs/building.texi
+++ i/doc/emacs/building.texi
@@ -1499,6 +1499,12 @@ Lisp Libraries
 buffer).  To disable this feature, change the variable
 @code{help-enable-auto-load} to @code{nil}.
 
+@vindex help-enable-completion-auto-load
+Automatic loading also occurs when completing names for
+@code{describe-variable} and @code{describe-function}, based on the
+prefix being completed.  To disable this feature, change the variable
+@code{help-enable-completion-auto-load} to @code{nil}.
+
 @vindex load-dangerous-libraries
 @cindex Lisp files byte-compiled by XEmacs
   By default, Emacs refuses to load compiled Lisp files which were
diff --git c/doc/lispref/loading.texi i/doc/lispref/loading.texi
index f0cc689d1f..947f1fa6a5 100644
--- c/doc/lispref/loading.texi
+++ i/doc/lispref/loading.texi
@@ -466,9 +466,11 @@ Autoload
 order to install the real definition and other associated code, then
 runs the real definition as if it had been loaded all along.
 Autoloading can also be triggered by looking up the documentation of
-the function or macro (@pxref{Documentation Basics}).
+the function or macro (@pxref{Documentation Basics}), and completion
+of variable and function names (@pxref{Autoload by Prefix} below).
 
 @menu
+* Autoload by Prefix:: Autoload by Prefix.
 * When to Autoload::   When to Use Autoload.
 @end menu
 
@@ -703,6 +705,23 @@ Autoload
 function, only a macro.
 @end defun
 
+@node Autoload by Prefix
+@subsection Autoload by Prefix
+
+@vindex definition-prefixes
+@findex register-definition-prefixes
+@vindex autoload-compute-prefixes
+During completion for the commands @code{describe-variable} and
+@code{describe-function}, Emacs will try to load files which may
+contain definitions matching the prefix being completed.  The variable
+@code{definition-prefixes} holds a hashtable which maps a prefix to
+the corresponding list of files to load for it.  Entries to this
+mapping are added by calls to @code{register-definition-prefixes}
+which are generated by @code{update-file-autoloads}.  Files which
+don't contain any definitions worth loading (test files, for
+examples), should set @code{autoload-compute-prefixes} to @code{nil}
+as a file-local variable.
+
 @node When to Autoload
 @subsection When to Use Autoload
 @cindex autoload, when to use