[Top][All Lists]

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

Re: [Emacs-diffs] /srv/bzr/emacs/trunk r100117: Run kill-emacs when exit

From: Stephen J. Turnbull
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r100117: Run kill-emacs when exiting for display closed or SIGTERM/HUP.
Date: Tue, 04 May 2010 20:33:21 +0900

Jan Djärv writes:

 > Put up a solution that addresses the problems:
 > Desktop file isn't loaded.
 > *scratch* and *Messages* and more get the wrong default directory.
 > It is nice of you to let us know that you don't care about getcwd, but not 
 > very helpful.

As I wrote, it's *one* data point.

Specifically, I can't recall ever saving *scratch* or " *Message-Log*"
to wherever I started my session; I want to save it to a project-
specific directory, which in typical cases for me is many characters
of typing away from what getcwd would return.  (In fact, I often do
C-x h M-w C-x b RET C-x C-f log RET C-y C-x C-s or the like.)

Similarly, in my usage, it's very likely that the reason I have
multiple sessions to choose from is that I split a session, by simply
killing a bunch of buffers I don't need in the new session, and saving
a desktop file somewhere appropriate.  AFAICT that place is highly
unlikely to have anything to do with getcwd(), but I'm willing to
listen to your explanation.

So my solution would be to (1) add `default-directory' to
`desktop-locals-to-save' (which handles the default directory settings
for *scratch* and " *Message-Log*", I think somebody already mentioned
this), (2) write the desktop file to somewhere appropriate (probably
`desktop-dirname', maybe asking the user), (3) write a thunk library

    (cd (or DESKTOP-DIRNAME "~"))
    (load-user-init-file)          ; does Emacs have this?

to ~/.emacs.d/sessions/xsm-XSM-CLIENT-ID.el, and set SmRestartCommand to

emacs -q -l ~/.emacs.d/sessions/xsm-XSM-CLIENT-ID.el -clientId XSM-CLIENTID

This is pretty kludgy; an improvement would be to build knowledge of
XSM and any other common desktop session management protocols into
Emacs, lose the "-q -l ~/.emacs.d/sessions/xsm-XSM-CLIENT-ID.el", and
have an internal `session-manager-client-id' variable, which if
non-nil is a string representing a session manager client ID, and use
that to generate and load the thunk library.

The thunk library probably can't really be avoided, because with it,
the generalization to Emacs session managers other than desktop.el
should be fairly straightforward.  Without it, you'd need to build
that knowledge into Emacs core.  Yucky.

reply via email to

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