unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* lock mechanism like in desktop.el (was: accidentally started gnus)
       [not found]       ` <871vmthodp.fsf@newton.gmurray.org.uk>
@ 2009-08-30  9:01         ` Reiner Steib
  2009-08-30 19:58           ` lock mechanism like in desktop.el Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Reiner Steib @ 2009-08-30  9:01 UTC (permalink / raw)
  To: ding, emacs-devel

[ From the Gnus list, adding emacs-devel. ]

On Sun, Aug 30 2009, Graham Murray wrote:

> Tim Landscheidt <tim@tim-landscheidt.de> writes:
[ citation added ... ]
>> Dan Christensen <jdc@uwo.ca> wrote:
>>> It's amazing how often this has saved me from having two copies of Gnus
>>> running! 
>>> 
>>> (add-hook 'gnus-before-startup-hook 'jdc-gnus-lock)
>>> 
>>> (defun jdc-gnus-lock ()
>>>   (or (equal 0 (shell-command "lockfile -r0 ~/Gnus/lock"))
>>>       (y-or-n-p "Lockfile exists.  Steal lock? ")
>>>       (progn (kill-buffer "*Group*")
>>> 	     (error "Unable to lock ~/Gnus/lock"))))
>>> 
>>> (add-hook 'gnus-after-exiting-gnus-hook 'jdc-gnus-unlock)
>>> 
>>> (defun jdc-gnus-unlock ()
>>>   (shell-command "rm -f ~/Gnus/lock"))

>> That sounds rather interesting. Any chance this could be in-
>> tegrated into the main source?

desktop.el has a lock mechanism that is independent of external
programs.  I'd prefer such a solution.  Maybe the lock mechanism in
desktop.el could be made more generic (and moved from desktop.el to
simple.el/files.el?)  so that other packages could use it without
duplicating the code (and loading desktop.el).

> Or change it so that instead of failing if gnus is already running it
> automatically runs 'gnus-slave' instead.

Prompting could offer this as well.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: lock mechanism like in desktop.el
  2009-08-30  9:01         ` lock mechanism like in desktop.el (was: accidentally started gnus) Reiner Steib
@ 2009-08-30 19:58           ` Stefan Monnier
  2009-08-30 20:13             ` Juanma Barranquero
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2009-08-30 19:58 UTC (permalink / raw)
  To: ding; +Cc: emacs-devel

> desktop.el has a lock mechanism that is independent of external
> programs.  I'd prefer such a solution.  Maybe the lock mechanism in
> desktop.el could be made more generic (and moved from desktop.el to
> simple.el/files.el?)  so that other packages could use it without
> duplicating the code (and loading desktop.el).

We already have such functionality (lock-buffer, unlock-buffer,
file-locked-p), or am I missing something?


        Stefan




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

* Re: lock mechanism like in desktop.el
  2009-08-30 19:58           ` lock mechanism like in desktop.el Stefan Monnier
@ 2009-08-30 20:13             ` Juanma Barranquero
  2009-08-31  0:38               ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Juanma Barranquero @ 2009-08-30 20:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On Sun, Aug 30, 2009 at 21:58, Stefan Monnier<monnier@iro.umontreal.ca> wrote:

> We already have such functionality (lock-buffer, unlock-buffer,
> file-locked-p), or am I missing something?

They are unimplemented (and aliased to `ignore') on Windows.

    Juanma




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

* Re: lock mechanism like in desktop.el
  2009-08-30 20:13             ` Juanma Barranquero
@ 2009-08-31  0:38               ` Stefan Monnier
  2009-08-31  0:46                 ` Juanma Barranquero
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2009-08-31  0:38 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

>> We already have such functionality (lock-buffer, unlock-buffer,
>> file-locked-p), or am I missing something?
> They are unimplemented (and aliased to `ignore') on Windows.

Then the answer should be to implement it for w32 rather than to devise
a new scheme.


        Stefan




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

* Re: lock mechanism like in desktop.el
  2009-08-31  0:38               ` Stefan Monnier
@ 2009-08-31  0:46                 ` Juanma Barranquero
  0 siblings, 0 replies; 5+ messages in thread
From: Juanma Barranquero @ 2009-08-31  0:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On Mon, Aug 31, 2009 at 02:38, Stefan Monnier<monnier@iro.umontreal.ca> wrote:

> Then the answer should be to implement it for w32 rather than to devise
> a new scheme.

FWIW, I agree, though it is non-trivial because of different semantics
(the issue has been discussed a few times, IIRC).

But certainly reusing the desktop.el mechanism seems hackish.

    Juanma




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

end of thread, other threads:[~2009-08-31  0:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <op.uywjaz0jq40fbn@balu.cs.uni-paderborn.de>
     [not found] ` <87r5v7lpzj.fsf@jidanni.org>
     [not found]   ` <87tyzw12p0.fsf@uwo.ca>
     [not found]     ` <m3d46e43op.fsf@passepartout.tim-landscheidt.de>
     [not found]       ` <871vmthodp.fsf@newton.gmurray.org.uk>
2009-08-30  9:01         ` lock mechanism like in desktop.el (was: accidentally started gnus) Reiner Steib
2009-08-30 19:58           ` lock mechanism like in desktop.el Stefan Monnier
2009-08-30 20:13             ` Juanma Barranquero
2009-08-31  0:38               ` Stefan Monnier
2009-08-31  0:46                 ` Juanma Barranquero

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).