emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reverting *Locate* buffers.


From: Peter Breton
Subject: Re: Reverting *Locate* buffers.
Date: Mon, 26 Jun 2006 06:15:46 -0700 (PDT)

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 <address@hidden>
>   (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 <address@hidden>
>   (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 via email to

[Prev in Thread] Current Thread [Next in Thread]