From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter Breton Newsgroups: gmane.emacs.devel Subject: Re: Reverting *Locate* buffers. Date: Mon, 26 Jun 2006 06:15:46 -0700 (PDT) Message-ID: <20060626131546.93100.qmail@web55513.mail.re4.yahoo.com> References: <200606260327.k5Q3Rfpd013691@jane.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1151377764 28148 80.91.229.2 (27 Jun 2006 03:09:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 27 Jun 2006 03:09:24 +0000 (UTC) Cc: Peter Breton , emacs-pretesters@gnu.org, "T. V. Raman" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 27 05:09:21 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fv3x0-0007uO-5c for ged-emacs-devel@m.gmane.org; Tue, 27 Jun 2006 05:09:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fv3wz-0007GS-MJ for ged-emacs-devel@m.gmane.org; Mon, 26 Jun 2006 23:09:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FuqyO-0000I9-LT for emacs-devel@gnu.org; Mon, 26 Jun 2006 09:17:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FuqyG-0000CY-3k for emacs-devel@gnu.org; Mon, 26 Jun 2006 09:17:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FuqyF-0000CV-VP for emacs-devel@gnu.org; Mon, 26 Jun 2006 09:17:44 -0400 Original-Received: from [206.190.58.222] (helo=web55513.mail.re4.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.52) id 1FurA6-0003rI-P9 for emacs-devel@gnu.org; Mon, 26 Jun 2006 09:29:59 -0400 Original-Received: (qmail 93102 invoked by uid 60001); 26 Jun 2006 13:15:46 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=HQn72XxnWqyJtCzd7TXJQdD7eG/XcyrEurYZ0BD2gGcZt/7/qQIhD5Z62uFAIzk1tmP41QYBdbB/2v79zY7MM5yjSKJ9r7QnyAhNm7HbcIwWigZc1R4n0S4BT24o+GIwJNk9lONFVRzNcm2bs8nMjjpRo9YSl1BYroqPV15uaJA= ; Original-Received: from [72.72.45.103] by web55513.mail.re4.yahoo.com via HTTP; Mon, 26 Jun 2006 06:15:46 PDT Original-To: Luc Teirlinck , emacs-devel@gnu.org In-Reply-To: <200606260327.k5Q3Rfpd013691@jane.dms.auburn.edu> X-Mailman-Approved-At: Mon, 26 Jun 2006 23:09:05 -0400 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:56211 Archived-At: That sounds fine to me. I've never actually used the revert feature.. someone else sent me in a patch for it, and it seemed harmless enough so I added it. I find the idea of reverting the buffer by rebuilding the database to be a bit odd; I would just rerun the search, and have an additional function to rebuild the database. However, if people are happy with the existing feature, then it still seems harmless to me :) Having an additional warning when not running as root also sounds like a good idea. Peter > There have been in the past several complaints about > the fact that > trying to revert a *Locate* buffers first asks > whether you want to > update the locate database. > > If you answer yes, then in my setup and I would > guess in most setups, > you get an error unless you are running as root, > because you need to > be root to update the locate database. As a result, > the buffer does > not get reverted. > > If you answer no, the *Locate* buffer does not get > reverted either, > whereas you might just have wanted to revert to undo > manual changes > to the buffer and whereas the locate database might > have been updated > by cron, or by the user, in the meantime anyway. > > A few days ago, I got a request to make this > behavior customizable, > which was CC-ed to emacs-pretesters instead of the > more appropriate > emacs-devel. > > The patch below introduces an option allowing the > user to avoid the > question. The default remains to ask the question. > But, even for the > default behavior there is a change: if the user > answers no, the buffer > gets reverted without updating the database. > > If there are no objections, I will install the patch > below: > > ===File > ~/locate-diff======================================= > *** locate.el 15 Mar 2006 19:31:47 -0600 1.36 > --- locate.el 25 Jun 2006 20:49:16 -0500 > *************** > *** 191,196 **** > --- 191,204 ---- > :group 'locate > :version "22.1") > > + (defcustom locate-update-when-revert t > + "This option affects how the *Locate* buffer > gets reverted. > + If non-nil, offer to update the locate database > when reverting that buffer. > + If nil, reverting does not update the locate > database." > + :type 'boolean > + :group 'locate > + :version "22.1") > + > (defcustom locate-update-command "updatedb" > "The executable program used to update the > locate database." > :type 'string > *************** > *** 557,568 **** > > ;; From Stephen Eglen > (defun locate-update (ignore1 ignore2) > ! "Update the locate database. > ! Database is updated using the shell command in > `locate-update-command'." > (let ((str (car locate-history-list))) > ! (cond ((yes-or-no-p "Update locate database > (may take a few seconds)? ") > ! (shell-command locate-update-command) > ! (locate str))))) > > ;;; Modified three functions from `dired.el': > ;;; dired-find-directory, > --- 565,578 ---- > > ;; From Stephen Eglen > (defun locate-update (ignore1 ignore2) > ! "Revert the *Locate* buffer. > ! If `locate-update-when-revert' is non-nil, offer > to update the > ! locate database using the shell command in > `locate-update-command'." > (let ((str (car locate-history-list))) > ! (and locate-update-when-revert > ! (yes-or-no-p "Update locate database (may take a > few seconds)? ") > ! (shell-command locate-update-command)) > ! (locate str))) > > ;;; Modified three functions from `dired.el': > ;;; dired-find-directory, > ============================================================ > >