all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jan D." <jan.h.d@swipnet.se>
To: "Stephen J. Turnbull" <stephen@xemacs.org>
Cc: Stefan Monnier <monnier@IRO.UMontreal.CA>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
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 14:51:24 +0200	[thread overview]
Message-ID: <4BE0184C.1090902@swipnet.se> (raw)
In-Reply-To: <87d3xb7vge.fsf@uwakimon.sk.tsukuba.ac.jp>

On 2010-05-04 13:33, Stephen J. Turnbull wrote:

> 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.)

I don't save *scratch*, but I rely on the fact that
   C-x b *sc<TAB><RETURN> C-x C-f
makes it easy to open files where Emacs was started.


>
> 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.

The way to get Emacs to load a desktop file when starting Emacs is to 
start Emacs in the directory where it was saved.  The --chdir emulated 
that.  I'm not saying that setting a desktop file to another directory 
is handled well by this, but it wasn't handeled at all previously.

It is obvious that the arguments against --chdir comes without any long 
term usage of restoring Emacs sessions through the session manager. 
Otherwise, this would have been fixed by those affected by it.  I'm not 
affected, as I start Emacs in the directory where I save my desktop (if 
I do save it that is).

What you are arguing for is an enhancement that works just as fine with 
or without --chdir.  With Emacs today, you can't restart an Emacs and 
load a desktop file saved in another place different from where Emacs is 
started.


>
> 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),

This assumes you are using desktop.  If you restart an Emacs without any 
desktop saved, the default directory is still wrong.  But with --chdir 
it is not.


> (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
>

There is no need to use -l or fiddle with SmRestartCommand, Emacs has 
had automatic save and restore of session data in a session file since 
2002 (actually, it is called ~/emacs.d/session-CLIENT-ID), but nobody 
has taken advantage of this fact AFAIK.

desktop.el would have to add a function to the hook 
emacs-save-session-functions that stores whatever data it needs to 
recover.  For example, the desktop file name in use.

	Jan D.





  reply	other threads:[~2010-05-04 12:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1O8efK-0003y3-Sb@internal.in.savannah.gnu.org>
2010-05-02 19:24 ` [Emacs-diffs] /srv/bzr/emacs/trunk r100117: Run kill-emacs when exiting for display closed or SIGTERM/HUP Stefan Monnier
2010-05-02 20:53   ` Jan Djärv
2010-05-03  0:55     ` Stefan Monnier
2010-05-03  8:21       ` Jan D.
2010-05-03 17:43         ` Stefan Monnier
2010-05-03 18:08           ` Jan Djärv
2010-05-04  2:38             ` Stefan Monnier
2010-05-04  7:59               ` Jan Djärv
2010-05-04 11:49                 ` Stephen J. Turnbull
2010-05-04 13:03                   ` Jan D.
2010-05-04 13:48                 ` Stefan Monnier
2010-05-04 14:42                   ` Jan D.
2010-05-04  3:03             ` Stephen J. Turnbull
2010-05-04  8:06               ` Jan Djärv
2010-05-04 11:33                 ` Stephen J. Turnbull
2010-05-04 12:51                   ` Jan D. [this message]
2010-05-04 13:54                     ` Stefan Monnier
2010-05-04 14:26                       ` Jan D.
2010-05-04 18:50                         ` Stefan Monnier
2010-05-05  5:17                           ` Stephen J. Turnbull
2010-05-05  7:21                           ` Jan Djärv
2010-05-05 14:00                             ` Stefan Monnier
2010-05-05 16:18                               ` Jan Djärv
2010-05-05 18:24                                 ` Stefan Monnier
2010-05-04 16:45                 ` Juri Linkov
2010-05-04 18:50                   ` Jan Djärv
2010-05-04 19:55                     ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BE0184C.1090902@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=stephen@xemacs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.