unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: pbreton@cs.umb.edu, emacs-pretesters@gnu.org,
	raman@users.sourceforge.net, emacs-devel@gnu.org
Subject: Re: Reverting *Locate* buffers.
Date: Mon, 26 Jun 2006 20:55:24 -0500 (CDT)	[thread overview]
Message-ID: <200606270155.k5R1tOlo019173@jane.dms.auburn.edu> (raw)
In-Reply-To: <20060626131546.93100.qmail@web55513.mail.re4.yahoo.com> (message from Peter Breton on Mon, 26 Jun 2006 06:15:46 -0700 (PDT))

Peter Breton wrote:

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

What about just setting the standard value of `locate-update-when-revert'
to nil?  Then the default behavior will make sense for most people and
people who prefer the old behavior just have to customize an option
to get it back.

   Having an additional warning when not running as root
   also sounds like a good idea.

The problem is that there is not that much space in the minibuffer.
But the docstring of `locate-update-when-revert' can mention the
problem.  Since one would need need to explicitly set this non-nil to
get asked the question, presumably people will read the docstring
before doing so.

The following patches and NEWS entry implement this.  I can install if
we all agree on this.

===File ~/NEWS-diff=========================================
*** NEWS	25 Jun 2006 09:51:35 -0500	1.1367
--- NEWS	26 Jun 2006 20:32:40 -0500	
***************
*** 3494,3499 ****
--- 3494,3508 ----
  (defun PP (data) (insert (format "%S\n" data)))
  (ewoc-create 'PP "start\n\n" "\n" t)
  
+ ** Locate changes
+ 
+ ---
+ *** By default, reverting the *Locate* buffer now just runs the last
+ `locate' command back over again without offering to update the locate
+ database (which normally only works if you have root privileges).  If
+ you prefer the old behavior, set the new customizable option
+ `locate-update-when-revert' to t.
+ 
  \f
  * Changes in Emacs 22.1 on non-free operating systems
  
============================================================

===File ~/locate-diff=======================================
*** locate.el	15 Mar 2006 19:31:47 -0600	1.36
--- locate.el	26 Jun 2006 20:11:34 -0500	
***************
*** 191,196 ****
--- 191,205 ----
    :group 'locate
    :version "22.1")
  
+ (defcustom locate-update-when-revert nil
+   "This option affects how the *Locate* buffer gets reverted.
+ If non-nil, offer to update the locate database when reverting that buffer.
+ \(Normally, you need to have root privileges for this to work.)
+ 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 <stephen@cns.ed.ac.uk>
  (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,
--- 566,579 ----
  
  ;; From Stephen Eglen <stephen@cns.ed.ac.uk>
  (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,
============================================================

      reply	other threads:[~2006-06-27  1:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26  3:27 Reverting *Locate* buffers Luc Teirlinck
2006-06-26  7:43 ` David Kastrup
2006-06-28  1:58   ` Luc Teirlinck
2006-06-28  3:55     ` T. V. Raman
2006-06-29  3:13       ` Luc Teirlinck
2006-06-29  6:27         ` David Kastrup
2006-06-29 21:52         ` Michael Albinus
2006-06-30  1:55           ` Luc Teirlinck
2006-07-02 20:39             ` Michael Albinus
2006-07-02 20:52         ` Michael Albinus
2006-07-03  2:51           ` Luc Teirlinck
2006-07-03 13:43             ` Michael Albinus
2006-07-03 23:21               ` Richard Stallman
2006-07-04  0:14               ` Luc Teirlinck
2006-07-03 15:05           ` Richard Stallman
2006-07-03 15:37             ` Michael Albinus
2006-07-03 15:41               ` David Kastrup
2006-07-04 15:42           ` Stefan Monnier
2006-06-29 21:58       ` Michael Albinus
2006-06-26 13:15 ` Peter Breton
2006-06-27  1:55   ` Luc Teirlinck [this message]

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=200606270155.k5R1tOlo019173@jane.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-pretesters@gnu.org \
    --cc=pbreton@cs.umb.edu \
    --cc=raman@users.sourceforge.net \
    /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).