help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .emacs (load {user-init-file, custom-file} causes duplicate load of


From: Larry Evans
Subject: Re: .emacs (load {user-init-file, custom-file} causes duplicate load of both
Date: Thu, 11 Nov 2010 05:22:39 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100713 Lightning/1.0b1 Thunderbird/3.0.6

On 11/11/10 01:45, Eli Zaretskii wrote:
>> From: Larry Evans <cppljevans@suddenlink.net>
>> 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.
> 
> 

Hi Eli,

Unfortunately, after renaming the variables to:

  my-user-init-file
  my-custom-file

the *Messages* buffer still had the duplicate loads.

My real reason for investigating this is I'm trying to avoid
the error message:

"Current desktop was not loaded from a file.  Overwrite this desktop file? "

from function desktop-save in desktop.el.gz.  A trace in that function
showed:

  desktop-file-modtime

was nil.  Further search in that file showed the only place that was
set was in function desktop-read.  So, in .emacs I put:

  (desktop-read)

However, that didn't work.

Any help resolving this would be appreciated.

-Larry





reply via email to

[Prev in Thread] Current Thread [Next in Thread]