unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
To: ding@gnus.org, emacs-devel@gnu.org
Subject: lock mechanism like in desktop.el (was: accidentally started gnus)
Date: Sun, 30 Aug 2009 11:01:16 +0200	[thread overview]
Message-ID: <87ab1h7k0z.fsf_-_@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <871vmthodp.fsf@newton.gmurray.org.uk> (Graham Murray's message of "Sun, 30 Aug 2009 06:17:06 +0100")

[ 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/




       reply	other threads:[~2009-08-30  9:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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         ` Reiner Steib [this message]
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

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87ab1h7k0z.fsf_-_@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    --cc=ding@gnus.org \
    --cc=emacs-devel@gnu.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 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).