From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: unload-feature questions and thoughts Date: Sun, 04 Feb 2007 19:32:33 +0100 Message-ID: <85bqk9db9a.fsf@lola.goethe.zz> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1170614197 1147 80.91.229.12 (4 Feb 2007 18:36:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 4 Feb 2007 18:36:37 +0000 (UTC) Cc: Emacs Devel To: "Juanma Barranquero" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 04 19:36:29 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HDmDw-0007Nd-1i for ged-emacs-devel@m.gmane.org; Sun, 04 Feb 2007 19:36:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HDmDx-0001aa-8d for ged-emacs-devel@m.gmane.org; Sun, 04 Feb 2007 13:36:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HDmDl-0001a4-Pk for emacs-devel@gnu.org; Sun, 04 Feb 2007 13:36:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HDmDk-0001ZW-DW for emacs-devel@gnu.org; Sun, 04 Feb 2007 13:36:13 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HDmDk-0001ZT-9u for emacs-devel@gnu.org; Sun, 04 Feb 2007 13:36:12 -0500 Original-Received: from mail-in-01.arcor-online.net ([151.189.21.41]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1HDmDj-0002EY-Qc for emacs-devel@gnu.org; Sun, 04 Feb 2007 13:36:12 -0500 Original-Received: from mail-in-13-z2.arcor-online.net (mail-in-13-z2.arcor-online.net [151.189.8.30]) by mail-in-01.arcor-online.net (Postfix) with ESMTP id 5F93A1060D8; Sun, 4 Feb 2007 19:32:35 +0100 (CET) Original-Received: from mail-in-04.arcor-online.net (mail-in-04.arcor-online.net [151.189.21.44]) by mail-in-13-z2.arcor-online.net (Postfix) with ESMTP id 4A16B1B8E9F; Sun, 4 Feb 2007 19:32:35 +0100 (CET) Original-Received: from lola.goethe.zz (dslb-084-061-048-252.pools.arcor-ip.net [84.61.48.252]) by mail-in-04.arcor-online.net (Postfix) with ESMTP id 000801C71DC; Sun, 4 Feb 2007 19:32:34 +0100 (CET) Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 650991C4CE1D; Sun, 4 Feb 2007 19:32:33 +0100 (CET) In-Reply-To: (Juanma Barranquero's message of "Sun\, 4 Feb 2007 19\:03\:35 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux) X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:65855 Archived-At: "Juanma Barranquero" writes: > 3.- A weirdness of load vs. autoload. Let's suppose we have a package > test.el, with: > > ;;;;; test.el ;;;;; > (defun test-fun () (interactive) t) > (provide 'test) > ;;;;;;;;;;;;;;;;;;; > > and we create an autoload for it: > > (autoload 'test-fun "test" nil t) > > Now, if we do load test.el by using the autoload mechanism, i.e., > > M-x test-fun RET > > then the autoload is recorded: > > (get 'test-fun 'autoload) => ("test" nil t nil) > > However, if we load test.el with `load' or `require', the autoload is > not recorded: > > (require 'test) > (get 'test-fun 'autoload) => nil > > Which is not very important, but affects the ability of > `unload-feature' to do its work: it cannot restore an autoload if it > is not recorded in the property list. We had this discussion already. IIRC, load could be used multiple times and in so many contexts, that is was not reasonable to expect it to be undoable. As one consequence, AUCTeX typically uses a startup-file looking the following: ;;; auctex.el ;; ;; This can be used for starting up AUCTeX. The following somewhat ;; strange trick causes tex-site.el to be loaded in a way that can be ;; safely undone using (unload-feature 'tex-site). ;; (autoload 'TeX-load-hack (expand-file-name "tex-site.el" (file-name-directory load-file-name))) (TeX-load-hack) and then we have TeX-load-hack is an alias for `ignore' in `tex-site.el'. (TeX-load-hack &rest IGNORE) Do nothing and return nil. This function accepts any number of arguments, but ignores them. [back] Before we coded this hack, there was a discussion on emacs-devel because I had been surprised, too. Anyway, this is most emphatically not something that should be changed now. But maybe it would be worth documenting something about it. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum