From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Yiyi Hu" Newsgroups: gmane.emacs.bugs Subject: bug#940: Is there a way to quit loading of ~/.emacs please? Date: Wed, 10 Sep 2008 02:24:53 +0800 Message-ID: References: <48C685F3.60001@gmail.com> Reply-To: Yiyi Hu , 940@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1220986087 26331 80.91.229.12 (9 Sep 2008 18:48:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Sep 2008 18:48:07 +0000 (UTC) Cc: 940@emacsbugs.donarmstrong.com To: "Lennart Borgman (gmail)" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 09 20:49:02 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kd8GY-0008Aj-3E for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Sep 2008 20:48:42 +0200 Original-Received: from localhost ([127.0.0.1]:49489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kd8FY-0006Iz-36 for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Sep 2008 14:47:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kd8FU-0006I8-92 for bug-gnu-emacs@gnu.org; Tue, 09 Sep 2008 14:47:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kd8FT-0006HN-A8 for bug-gnu-emacs@gnu.org; Tue, 09 Sep 2008 14:47:35 -0400 Original-Received: from [199.232.76.173] (port=37164 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kd8FS-0006HK-V6 for bug-gnu-emacs@gnu.org; Tue, 09 Sep 2008 14:47:34 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:51389) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kd8FT-0000ME-15 for bug-gnu-emacs@gnu.org; Tue, 09 Sep 2008 14:47:35 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m89IlWot006526; Tue, 9 Sep 2008 11:47:32 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m89IU4Mh032511; Tue, 9 Sep 2008 11:30:04 -0700 X-Loop: don@donarmstrong.com Resent-From: "Yiyi Hu" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 09 Sep 2008 18:30:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 940 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 940-submit@emacsbugs.donarmstrong.com id=B940.122098470530797 (code B ref 940); Tue, 09 Sep 2008 18:30:04 +0000 Original-Received: (at 940) by emacsbugs.donarmstrong.com; 9 Sep 2008 18:25:05 +0000 Original-Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.239]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m89IOrvu030644 for <940@emacsbugs.donarmstrong.com>; Tue, 9 Sep 2008 11:24:55 -0700 Original-Received: by rv-out-0506.google.com with SMTP id k40so2010019rvb.1 for <940@emacsbugs.donarmstrong.com>; Tue, 09 Sep 2008 11:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=z64N+97bEjoRp0MPjUUa7QUe+U+QukNSuMBnw4TGG8k=; b=SCrSJAzfuG1Upy+nJ2ewEz7rFiMncK9JkTTOvbnDXMlBwAksY4kBbhxSydtXIFavqR UMxM+VoLn6aOPUrU66wgxDDjx4+Syb5CSVG9rQS0Y71NTa4QjJTyh44msyaOwRETSrbK 5Yv6hnGN0ltRrKxtITk2wBVOyh/LGnBI/6qo0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=xyZveNdIEbHPkpAJR+R11qd7iLT8IT9lrp09awd0M3yRL68P13NV477I035AKFBDrh PCtRbYYexRdIVArO1Pjy6+851CDyYBVRmhYAvPAcjI7zY35h2Rq6xnq/7vQnlTBIByVV fipHrBLFqtPILrGwEXfO99ezAAtNt3Gf0vUts= Original-Received: by 10.140.192.9 with SMTP id p9mr37985rvf.114.1220984693461; Tue, 09 Sep 2008 11:24:53 -0700 (PDT) Original-Received: by 10.141.145.12 with HTTP; Tue, 9 Sep 2008 11:24:53 -0700 (PDT) In-Reply-To: <48C685F3.60001@gmail.com> Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Tue, 09 Sep 2008 14:47:35 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:20405 Archived-At: This is not a bug, Just a feature request for elisp language. Ok, thanks for your replies, I'll explain this is *great* detail. What I want to do is simple: When emacs starts, It checks if ~/.emacs is newer than ~/.emacs.elc, if it does, then it recompiles the ~/.emacs, and load ~/.emacs.elc on the fly. But skip the rest of ~/.emacs, The reason why I want this will be explained. Here the story begins: If I do something like: (if (byte-compile-file-if-newer "~/.emacs") (load-file "~/.emacs.elc")) Here is a situation depends on wether ~/.emacs.elc exists. If ~/.emacs.elc exists and ever being compiled with a line (defalias 'perl-mode 'cperl-mode), and we remove (defalias 'perl-mode 'cperl-mode) in ~/.emacs, then, cperl-mode will still be in effect for the first time we start emacs use the new ~/.emacs, we have to restart emacs again or manually byte-compile the ~/.emacs. The reason which causes this is, the side effect created in old ~/.emacs.elc will still in effect. Why not use 'unless' statement version? (unless (byte-compile-file-if-newer "~/.emacs") remaining lisp code ...) Because, This will confuse M-x customize-* series functions. Eg, when you put (customize-set-variables ....) things within (unless (byte-compile-file-if-newer "~/.emacs") ) When you do M-x customzie-variable again, It will crate another list which is like (customize-set-variables ...) outside of the file level (unless () ...) statement. If you think It's ok, Please check the example above. (customize-set-variables ..) will take effect and last a session. Why not splitting ~/.emacs? I did this, and It's not a happy journey. Eg, when change something, I have to think wether I should put here or there, or within ~/.emacs. At last, I choose using one ~/.emacs, Also, even if we split ~/.emacs, we still need to recompiling ~/.emacs after we do customize-variable. That's why I think the problem still exists. I ever used (signal 'quit nil) to skiping loading the rest of ~/.emacs, It works fine except the time when we invoke emacs with file name args. (signal 'quit nil) will cancel loading of files we specified in args. In fact, This is not a bug, Just a elisp language feature request. Hope if we can have a function named (leave-load t) which we can manually control when to stop loading the lisp source file. How this function is used is as below: (if (byte-compile-file-if-newer "~/.emacs") (load-file "~/.emacs") (leave-load t)) Then, the ~/.emacs.elc will always be populated, and processed. To me, this is almost the _perfect_ version for auto byte-compile and loading for ~/.emacs. :-) And this language feature IMO, is useful for people who want to control the library loading process. If you have any questions, don't hesitate, I've been thinking on how to make ~/.emacs auto re-compiling procedure perfect for 3 days. Thanks for reading. ;-)