On Thu, Jun 16, 2011 at 12:40 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:
Rainer M Krug <r.m.krug@gmail.com> wrote:


> I created the attached init.el file. In my setup, ~/.emacs.d/org-mode
> is a symbolic link. If I set it to org-7.7, everything works as
> expected desktop is loaded and saved without question), but when
> linking it to the git version, the desktop is loaded, but when closing
> it giveas me the above mentioned question:
>
> "Current desktop was not loaded from a file. Overwrite this desktop file?"
>
> As I said, the desktop *is* loaded.
>
> Hope you can reproduce it with this setup,
>

Here's a caution: when desktop.el is loaded, it adds to after-init-hook a
function that reads the desktop file. However, after-init-hook gets called
"at the end of initialization": if you try to reproduce using something like

   emacs -q -l init.el

it's not going to work - after-init-hook gets runs "between the -q and -l"
so to speak, whereas desktop.el does not get loaded until init.el is loaded:
that initializes the hook too late to do any good.

Probably the best way to do it is to create a dummy user "foo", copy init.el
to /home/foo/.emacs and then invoke emacs as

  emacs -u foo

Using this method, I cannot reproduce the problem with or without org in
the init file: here's the one that I used which also sets a couple of
desktop hooks that make some noise which is recorded in the *Messages*
buffer - that helps to verify that things work according to
expectations:

--8<---------------cut here---------------start------------->8---
;;; -*- mode: emacs-lisp -*-
(setq debug-on-error t)
(require 'desktop)
(desktop-save-mode 1)
(add-to-list 'desktop-after-read-hook (function (lambda () (message "got a desktop file"))))
(add-to-list 'desktop-no-desktop-file-hook (function (lambda () (message "no desktop file read"))))

;;; I tried with and without the following five lines
;;; I also tried with them placed *before* the desktop stuff
(add-to-list 'load-path (expand-file-name "~nick/src/emacs/org/org-mode/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org-install)
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
--8<---------------cut here---------------end--------------->8---

Nick



There seems to be a problem with my .emacs.desktop files in combination with the new org - if I close all buffer, quit, answer the question with yes, re-open emacs, open the same file again, close emacs (no questions asked), open emacs again, desktop file is read, close, no questions asked.

So I know how to fix it. I attach one .emacs.desktop which shows this behavior.

Cheers and thanks for your patience,

Rainer



--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug