Gnus development mailing list
 help / color / mirror / Atom feed
From: Dan Christensen <jdc@uwo.ca>
To: ding@gnus.org
Subject: Re: accidentally started gnus
Date: Tue, 25 Aug 2009 08:46:19 -0400	[thread overview]
Message-ID: <87tyzw12p0.fsf@uwo.ca> (raw)
In-Reply-To: <87r5v7lpzj.fsf@jidanni.org>

To avoid accidentally starting Gnus a second time, I use the following
code, which requires that you have the lockfile program in your path.
After a crash, the lock file will still exist, in which case you can
steal the lock.

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

Dan




  reply	other threads:[~2009-08-25 12:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <op.uywjaz0jq40fbn@balu.cs.uni-paderborn.de>
2009-08-19 16:37 ` jidanni
2009-08-25 12:46   ` Dan Christensen [this message]
2009-08-29 23:10     ` Tim Landscheidt
2009-08-30  5:17       ` Graham Murray
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-18 21:02 accidentally started gnus jidanni
2009-08-20 21:48 ` Ted Zlatanov
2009-08-21 11:22   ` jidanni
2009-08-21 19:01     ` Ted Zlatanov
2009-08-21 19:23       ` Adam Sjøgren
2009-08-21 19:44         ` Ted Zlatanov

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=87tyzw12p0.fsf@uwo.ca \
    --to=jdc@uwo.ca \
    --cc=ding@gnus.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.
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 NNTP newsgroup(s).