[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lock mechanism like in desktop.el (was: accidentally started gnus)
From: |
Reiner Steib |
Subject: |
lock mechanism like in desktop.el (was: accidentally started gnus) |
Date: |
Sun, 30 Aug 2009 11:01:16 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/22.1 (gnu/linux) |
[ From the Gnus list, adding emacs-devel. ]
On Sun, Aug 30 2009, Graham Murray wrote:
> Tim Landscheidt <address@hidden> writes:
[ citation added ... ]
>> Dan Christensen <address@hidden> 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/
- lock mechanism like in desktop.el (was: accidentally started gnus),
Reiner Steib <=