all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to disable warnings/questions when using desktop-save-mode?
@ 2012-05-23 10:21 Marius Hofert
  2012-05-25  4:20 ` Kevin Rodgers
  0 siblings, 1 reply; 5+ messages in thread
From: Marius Hofert @ 2012-05-23 10:21 UTC (permalink / raw)
  To: Emacs help

Hi,

1) I have enabled desktop-save mode (with (desktop-save-mode 1)) since I find this
quite useful. I recently started to use different instances of Emacs (Emacs 24
GTK Snapshot version on Xubuntu 12.04). Every time I open another instance of
Emacs, I receive "...Warning: desktop file appears to be in
use by PID ... Use it anyway? (y or n)". How can I tell Emacs to not ask me but
always choose y (= yes) here automatically? [I tried (setq desktop-save t) but
I still obtained the warning.]

2) A similar problem appears when a new instance is closed and thus writes to the
desktop file. When closing an older instance afterwards one then obtains
"... Desktop file is more recent than the one loaded. Save anyway?". How can I
tell Emacs to not ask me but choose y (= yes) automatically?

Maybe 2) is solved by choosing "no" in 1) [which I guess is also fine in most cases].

Cheers,

Marius






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to disable warnings/questions when using desktop-save-mode?
       [not found] <mailman.1567.1337768477.855.help-gnu-emacs@gnu.org>
@ 2012-05-24  0:31 ` Xah Lee
  2012-05-24  8:05   ` Marius Hofert
  0 siblings, 1 reply; 5+ messages in thread
From: Xah Lee @ 2012-05-24  0:31 UTC (permalink / raw)
  To: help-gnu-emacs

On May 23, 3:21 am, Marius Hofert <marius.hof...@math.ethz.ch> wrote:
> Hi,
>
> 1) I have enabled desktop-save mode (with (desktop-save-mode 1)) since I find this
> quite useful. I recently started to use different instances of Emacs (Emacs 24
> GTK Snapshot version on Xubuntu 12.04). Every time I open another instance of
> Emacs, I receive "...Warning: desktop file appears to be in
> use by PID ... Use it anyway? (y or n)". How can I tell Emacs to not ask me but
> always choose y (= yes) here automatically? [I tried (setq desktop-save t) but
> I still obtained the warning.]
>
> 2) A similar problem appears when a new instance is closed and thus writes to the
> desktop file. When closing an older instance afterwards one then obtains
> "... Desktop file is more recent than the one loaded. Save anyway?". How can I
> tell Emacs to not ask me but choose y (= yes) automatically?
>
> Maybe 2) is solved by choosing "no" in 1) [which I guess is also fine in most cases].
>
> Cheers,
>
> Marius

see the desktop section at

http://code.google.com/p/ergoemacs/source/browse/trunk/ergoemacs/init_settings.el

 Xat


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to disable warnings/questions when using desktop-save-mode?
  2012-05-24  0:31 ` Xah Lee
@ 2012-05-24  8:05   ` Marius Hofert
  0 siblings, 0 replies; 5+ messages in thread
From: Marius Hofert @ 2012-05-24  8:05 UTC (permalink / raw)
  To: Xah Lee; +Cc: help-gnu-emacs

Precisely what I was looking for, many thanks, Xah. 

Xah Lee <xahlee@gmail.com> writes:

> On May 23, 3:21 am, Marius Hofert <marius.hof...@math.ethz.ch> wrote:
>> Hi,
>>
>> 1) I have enabled desktop-save mode (with (desktop-save-mode 1)) since I find this
>> quite useful. I recently started to use different instances of Emacs (Emacs 24
>> GTK Snapshot version on Xubuntu 12.04). Every time I open another instance of
>> Emacs, I receive "...Warning: desktop file appears to be in
>> use by PID ... Use it anyway? (y or n)". How can I tell Emacs to not ask me but
>> always choose y (= yes) here automatically? [I tried (setq desktop-save t) but
>> I still obtained the warning.]
>>
>> 2) A similar problem appears when a new instance is closed and thus writes to the
>> desktop file. When closing an older instance afterwards one then obtains
>> "... Desktop file is more recent than the one loaded. Save anyway?". How can I
>> tell Emacs to not ask me but choose y (= yes) automatically?
>>
>> Maybe 2) is solved by choosing "no" in 1) [which I guess is also fine in most cases].
>>
>> Cheers,
>>
>> Marius
>
> see the desktop section at
>
> http://code.google.com/p/ergoemacs/source/browse/trunk/ergoemacs/init_settings.el
>
>  Xat





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to disable warnings/questions when using desktop-save-mode?
  2012-05-23 10:21 How to disable warnings/questions when using desktop-save-mode? Marius Hofert
@ 2012-05-25  4:20 ` Kevin Rodgers
  2012-05-27 17:32   ` Marius Hofert
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Rodgers @ 2012-05-25  4:20 UTC (permalink / raw)
  To: help-gnu-emacs

On 5/23/12 4:21 AM, Marius Hofert wrote:
> 1) I have enabled desktop-save mode (with (desktop-save-mode 1)) since I find this
> quite useful. I recently started to use different instances of Emacs (Emacs 24
> GTK Snapshot version on Xubuntu 12.04). Every time I open another instance of
> Emacs, I receive "...Warning: desktop file appears to be in
> use by PID ... Use it anyway? (y or n)". How can I tell Emacs to not ask me but
> always choose y (= yes) here automatically? [I tried (setq desktop-save t) but
> I still obtained the warning.]

(setq desktop-load-locked-desktop t)

> 2) A similar problem appears when a new instance is closed and thus writes to the
> desktop file. When closing an older instance afterwards one then obtains
> "... Desktop file is more recent than the one loaded. Save anyway?". How can I
> tell Emacs to not ask me but choose y (= yes) automatically?
>
> Maybe 2) is solved by choosing "no" in 1) [which I guess is also fine in most cases].

I think you need to make sure each instance has its own value of desktop
base-file-name and/or desktop-base-lock-name, effectively defeating the
locking mechanism altogether.  You could do that by appending the PID
returned by (emacs-pid) to those variables in your ~/.emacs:

(setq desktop-base-lock-name
       (convert-standard-filename (format ".emacs.desktop.lock-%d" (emacs-pid))))

or:

(eval-after-load 'desktop
   '(setq desktop-base-lock-name
	 (format "%s-%d" desktop-base-lock-name (emacs-pid))))

and probably the same for desktop-base-lock-name.

-- 
Kevin Rodgers
Denver, Colorado, USA




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to disable warnings/questions when using desktop-save-mode?
  2012-05-25  4:20 ` Kevin Rodgers
@ 2012-05-27 17:32   ` Marius Hofert
  0 siblings, 0 replies; 5+ messages in thread
From: Marius Hofert @ 2012-05-27 17:32 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: help-gnu-emacs

Dear Kevin,

thanks for your solution. Since it is simpler than the one suggested 
previously, I got interested in it.
My ~/.emacs contains:

(desktop-save-mode 1)
(setq desktop-save t)
(setq desktop-load-locked-desktop t)
(setq desktop-base-lock-name
       (convert-standard-filename (format ".emacs.desktop.lock-%d" 
(emacs-pid))))
(setq desktop-dirname user-emacs-directory)

Still, I obtain "Desktop file is more recent than the one loaded. Save 
anyway?" [Yes/No]. How can I avoid this question being raised?

Cheers,

Marius


On 05/25/2012 06:20 AM, Kevin Rodgers wrote:
> On 5/23/12 4:21 AM, Marius Hofert wrote:
>> 1) I have enabled desktop-save mode (with (desktop-save-mode 1)) 
>> since I find this
>> quite useful. I recently started to use different instances of Emacs 
>> (Emacs 24
>> GTK Snapshot version on Xubuntu 12.04). Every time I open another 
>> instance of
>> Emacs, I receive "...Warning: desktop file appears to be in
>> use by PID ... Use it anyway? (y or n)". How can I tell Emacs to not 
>> ask me but
>> always choose y (= yes) here automatically? [I tried (setq 
>> desktop-save t) but
>> I still obtained the warning.]
>
> (setq desktop-load-locked-desktop t)
>
>> 2) A similar problem appears when a new instance is closed and thus 
>> writes to the
>> desktop file. When closing an older instance afterwards one then obtains
>> "... Desktop file is more recent than the one loaded. Save anyway?". 
>> How can I
>> tell Emacs to not ask me but choose y (= yes) automatically?
>>
>> Maybe 2) is solved by choosing "no" in 1) [which I guess is also fine 
>> in most cases].
>
> I think you need to make sure each instance has its own value of desktop
> base-file-name and/or desktop-base-lock-name, effectively defeating the
> locking mechanism altogether.  You could do that by appending the PID
> returned by (emacs-pid) to those variables in your ~/.emacs:
>
> (setq desktop-base-lock-name
>       (convert-standard-filename (format ".emacs.desktop.lock-%d" 
> (emacs-pid))))
>
> or:
>
> (eval-after-load 'desktop
>   '(setq desktop-base-lock-name
>      (format "%s-%d" desktop-base-lock-name (emacs-pid))))
>
> and probably the same for desktop-base-lock-name.
>





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-27 17:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-23 10:21 How to disable warnings/questions when using desktop-save-mode? Marius Hofert
2012-05-25  4:20 ` Kevin Rodgers
2012-05-27 17:32   ` Marius Hofert
     [not found] <mailman.1567.1337768477.855.help-gnu-emacs@gnu.org>
2012-05-24  0:31 ` Xah Lee
2012-05-24  8:05   ` Marius Hofert

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.