From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: .emacs (load {user-init-file, custom-file} causes duplicate load of both Date: Thu, 11 Nov 2010 02:45:14 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1289461552 18207 80.91.229.12 (11 Nov 2010 07:45:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 11 Nov 2010 07:45:52 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 11 08:45:48 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PGRqu-0001RK-2d for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Nov 2010 08:45:48 +0100 Original-Received: from localhost ([127.0.0.1]:56347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGRqt-0000OY-BH for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Nov 2010 02:45:47 -0500 Original-Received: from [140.186.70.92] (port=44087 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGRqS-0000OF-Kl for help-gnu-emacs@gnu.org; Thu, 11 Nov 2010 02:45:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGRqO-000492-Jv for help-gnu-emacs@gnu.org; Thu, 11 Nov 2010 02:45:20 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]:38961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGRqO-00048s-E7 for help-gnu-emacs@gnu.org; Thu, 11 Nov 2010 02:45:16 -0500 Original-Received: from eliz by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1PGRqM-0005Mc-V2 for help-gnu-emacs@gnu.org; Thu, 11 Nov 2010 02:45:14 -0500 In-reply-to: (message from Larry Evans on Wed, 10 Nov 2010 19:14:25 -0600) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75335 Archived-At: > From: Larry Evans > Date: Wed, 10 Nov 2010 19:14:25 -0600 > > My ~/.emacs file contains (amoung other things): > > ---{~/.emacs--- > (setq user-init-file > (expand-file-name "init.el" > (expand-file-name ".emacs.d" "~"))) > (setq custom-file > (expand-file-name "custom.el" > (expand-file-name ".xemacs" "~"))) > (load-file user-init-file) > (load-file custom-file) > ---}~/.emacs--- > > When started with this, the *messages* buffer contains: > > ---{*messages--- > Loading /home/evansl/.emacs.d/init.el (source)... > Loading /home/evansl/.recentf...done > Cleaning up the recentf list...done (0 removed) > Loading /home/evansl/.emacs.d/init.el (source)...done > Loading /home/evansl/.xemacs/custom.el (source)... > Loading desktop...done > Loading /home/evansl/.xemacs/custom.el (source)...done > ---}*messages--- > > Why are both user-init-file and custom-file both loaded twice? Because you are overriding the values of variables that Emacs uses at startup. The startup procedure involves some non-trivial logic for loading user-init-file and custom-file, and you are interfering with that logic by setting their values in your ~/.emacs, which is read half-way through the startup process. Simply load the files by name, or use other variables. Then Emacs should load these files only once, as you want.