From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/68942 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: lock mechanism like in desktop.el (was: accidentally started gnus) Date: Sun, 30 Aug 2009 11:01:16 +0200 Message-ID: <87ab1h7k0z.fsf_-_@marauder.physik.uni-ulm.de> References: <87r5v7lpzj.fsf@jidanni.org> <87tyzw12p0.fsf@uwo.ca> <871vmthodp.fsf@newton.gmurray.org.uk> Reply-To: Reiner Steib NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1251622915 323 80.91.229.12 (30 Aug 2009 09:01:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Aug 2009 09:01:55 +0000 (UTC) To: ding@gnus.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 30 11:01:48 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MhgIF-0003ec-G1 for ged-emacs-devel@m.gmane.org; Sun, 30 Aug 2009 11:01:47 +0200 Original-Received: from localhost ([127.0.0.1]:46736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhgIE-00061H-K7 for ged-emacs-devel@m.gmane.org; Sun, 30 Aug 2009 05:01:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhgI7-0005yU-5l for emacs-devel@gnu.org; Sun, 30 Aug 2009 05:01:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhgI1-0005wa-Sa for emacs-devel@gnu.org; Sun, 30 Aug 2009 05:01:38 -0400 Original-Received: from [199.232.76.173] (port=40578 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhgI1-0005wX-ND for emacs-devel@gnu.org; Sun, 30 Aug 2009 05:01:33 -0400 Original-Received: from mail.uni-ulm.de ([134.60.1.11]:55300) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MhgHw-0002xq-Jk for emacs-devel@gnu.org; Sun, 30 Aug 2009 05:01:33 -0400 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.10.175]) by mail.uni-ulm.de (8.14.2/8.14.2) with ESMTP id n7U91JwF024981; Sun, 30 Aug 2009 11:01:20 +0200 (MEST) Original-Received: from localhost (localhost [127.0.0.1]) by bridgekeeper.physik.uni-ulm.de (Postfix) with ESMTP id AAB7F1CE67; Sun, 30 Aug 2009 11:01:19 +0200 (CEST) X-Face: P05mdcZT&lL[-s2=mw~RsllZ0zZAb?vdE}.s (Graham Murray's message of "Sun, 30 Aug 2009 06:17:06 +0100") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.1 (gnu/linux) X-DCC-CollegeOfNewCaledonia-Metrics: poseidon 1189; Body=2 Fuz1=2 Fuz2=2 X-Virus-Scanned: by amavisd-new X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114873 gmane.emacs.gnus.general:68942 Archived-At: [ From the Gnus list, adding emacs-devel. ] On Sun, Aug 30 2009, Graham Murray wrote: > Tim Landscheidt writes: [ citation added ... ] >> Dan Christensen 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/