From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: run/load a lisp script before user init file Date: Tue, 08 Oct 2013 22:09:38 +0900 Message-ID: <87y563kiy5.fsf@uwakimon.sk.tsukuba.ac.jp> References: <52539DB7.2070807@poczta.onet.pl> <87zjqkjn0n.fsf@uwakimon.sk.tsukuba.ac.jp> <20131008.084033.138845573572961256.hanche@math.ntnu.no> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: ger.gmane.org 1381237798 27883 80.91.229.3 (8 Oct 2013 13:09:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Oct 2013 13:09:58 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 08 15:10:01 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VTX32-0003fp-1C for ged-emacs-devel@m.gmane.org; Tue, 08 Oct 2013 15:10:00 +0200 Original-Received: from localhost ([::1]:36807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTX31-0007BD-JC for ged-emacs-devel@m.gmane.org; Tue, 08 Oct 2013 09:09:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTX2r-00075V-Ev for emacs-devel@gnu.org; Tue, 08 Oct 2013 09:09:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTX2j-00044b-Uv for emacs-devel@gnu.org; Tue, 08 Oct 2013 09:09:49 -0400 Original-Received: from mgmt1.sk.tsukuba.ac.jp ([130.158.97.223]:42156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTX2j-00043x-Do for emacs-devel@gnu.org; Tue, 08 Oct 2013 09:09:41 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt1.sk.tsukuba.ac.jp (Postfix) with ESMTP id 6C5CD3FA0A15 for ; Tue, 8 Oct 2013 22:09:38 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 5E8F81A79FF; Tue, 8 Oct 2013 22:09:38 +0900 (JST) In-Reply-To: <20131008.084033.138845573572961256.hanche@math.ntnu.no> X-Mailer: VM undefined under 21.5 (beta34) "kale" 182d01410b8d XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 130.158.97.223 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:164001 Archived-At: Harald Hanche-Olsen writes: > If one were to think along these lines, wouldn't it make more sense to > have a directory "site-start.d" where packages can put their own > initialization code, each in its own file? It makes uninstalling > trivial, for one thing. site-start is a Lisp file; you can already have that if you want. Also, in XEmacs and SXEmacs you can just put the needed code in an autoload cookie in the package itself, and it automatically gets executed when loading the auto-autoloads. I don't know if there is a similar feature for ELPA packages, but I imagine there is. (In XEmacs, this code actually gets executed before site-start IIRC.) Jarek Czekalski writes: > W dniu 2013-10-08 08:27, Stephen J. Turnbull pisze: >> It doesn't actually solve any problems, and makes some of them harder >> to solve (eg, uninstall). > I thought it makes uninstall easier. Just erase the file you > added. I mean that during install I add the file > site-lisp/emacspeak/site-start.el. A complete uninstall, yes, but how about disable (you can't remove the site-start file if it contains much code) or uninstall-but-leave-conf (you don't want to leave the site-start file behind because it will cause startup errors)? You could probably make it work, but really, there are better approaches. >> It's ugly (why should the site-start library be treated differently >> from any other?[1]) > I don't think of site-start as of a library. It's not your choice, and it's not really Emacs's, either. site-start is an ancient interface, and sufficiently well-established that changing it would very likely surprise people. It would also be a PITA: you can't use locate-library to find the file you want. The site-start.d approach is much better, as is the auto-autoloads approach. (Note that although the name "auto-autoloads" is shared by all packages and core in XEmacs, it's always a generated file, so you don't want to edit it anyway. The right appropriate is to put the initialization code in a function, and then call that. To find that code you use find-function.) >> It's not general (I suspect that at the point where site-start is >> run, the load-path is very short.) > No. On Debian it already contains dozens of paths. Debian already has site-start.d, so who cares about Debian? You're proposing a change to the upstream Emacs, which is a different matter. And on the upstream Emacs, I would guess there are only 5-10 paths, and they wouldn't be appropriate locations for a 3rd-party start file. >> What's wrong with the obvious solution? Like this: >> >> 1. Install your script on the load-path in some application-specific file. >> 2. Compile it. >> 3. Find site-start. If it doesn't exist yet, create an empty one. > Easy to say: "Find site-start". How? Let's have a difficult > example: Debian. Again, forget Debian. Debian has its own Emacs Policy, and you'd want to conform to that rather than try to override it from upstream. In any case, it's easy to find the right site-start: emacs -batch -q -no-site-file -eval '(prin1 (locate-library "site-start"))' should do the trick if it exists.