aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2006-07-04 00:03:53 +0000
committerLuc Teirlinck2006-07-04 00:03:53 +0000
commite8fc997ccb57b8e3561dc719f4d883b7194031d2 (patch)
treef319af781c4ebcf04bf20531738ee3b753891d32
parentfbe4aef8351d639d5224abec64ce348082c52210 (diff)
downloademacs-e8fc997ccb57b8e3561dc719f4d883b7194031d2.tar.gz
emacs-e8fc997ccb57b8e3561dc719f4d883b7194031d2.zip
(locate-update-when-revert): New option.
(locate-update-path): New option (suggested by Michael Albinus). (locate-prompt-for-command): Whitespace change. (locate-update): No longer offer to update the locate database by default. Implement the two new options.
-rw-r--r--lisp/locate.el40
1 files changed, 33 insertions, 7 deletions
diff --git a/lisp/locate.el b/lisp/locate.el
index 702ae98ecd6..5df695d59b9 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -191,17 +191,37 @@ This should contain the \"-l\" switch, but not the \"-F\" or \"-b\" switches."
191 :group 'locate 191 :group 'locate
192 :version "22.1") 192 :version "22.1")
193 193
194(defcustom locate-update-when-revert nil
195 "This option affects how the *Locate* buffer gets reverted.
196If non-nil, offer to update the locate database when reverting that buffer.
197\(Normally, you need to have root privileges for this to work. See the
198option `locate-update-path'.)
199If nil, reverting does not update the locate database."
200 :type 'boolean
201 :group 'locate
202 :version "22.1")
203
194(defcustom locate-update-command "updatedb" 204(defcustom locate-update-command "updatedb"
195 "The executable program used to update the locate database." 205 "The executable program used to update the locate database."
196 :type 'string 206 :type 'string
197 :group 'locate) 207 :group 'locate)
198 208
209(defcustom locate-update-path "/"
210 "The default directory from where `locate-update-command' is called.
211Usually, root permissions are required to run that command. This
212can be achieved by setting this option to \"/su::\" or \"/sudo::\"
213\(if you have the appropriate authority). If your current user
214permissions are sufficient to run the command, you can set this
215option to \"/\"."
216 :type 'string
217 :group 'locate
218 :version "22.1")
219
199(defcustom locate-prompt-for-command nil 220(defcustom locate-prompt-for-command nil
200 "If non-nil, the `locate' command prompts for a command to run. 221 "If non-nil, the `locate' command prompts for a command to run.
201Otherwise, that behavior is invoked via a prefix argument." 222Otherwise, that behavior is invoked via a prefix argument."
202 :group 'locate 223 :group 'locate
203 :type 'boolean 224 :type 'boolean)
204 )
205 225
206;; Functions 226;; Functions
207 227
@@ -557,12 +577,18 @@ do not work in subdirectories.
557 577
558;; From Stephen Eglen <stephen@cns.ed.ac.uk> 578;; From Stephen Eglen <stephen@cns.ed.ac.uk>
559(defun locate-update (ignore1 ignore2) 579(defun locate-update (ignore1 ignore2)
560 "Update the locate database. 580 "Revert the *Locate* buffer.
561Database is updated using the shell command in `locate-update-command'." 581If `locate-update-when-revert' is non-nil, offer to update the
582locate database using the shell command in `locate-update-command'."
562 (let ((str (car locate-history-list))) 583 (let ((str (car locate-history-list)))
563 (cond ((yes-or-no-p "Update locate database (may take a few seconds)? ") 584 (and locate-update-when-revert
564 (shell-command locate-update-command) 585 (yes-or-no-p "Update locate database (may take a few seconds)? ")
565 (locate str))))) 586 ;; `expand-file-name' is used in order to autoload Tramp if
587 ;; necessary. It cannot be loaded when `default-directory'
588 ;; is remote.
589 (let ((default-directory (expand-file-name locate-update-path)))
590 (shell-command locate-update-command)))
591 (locate str)))
566 592
567;;; Modified three functions from `dired.el': 593;;; Modified three functions from `dired.el':
568;;; dired-find-directory, 594;;; dired-find-directory,