;;; locate.el --- interface to the locate command
-;; Copyright (C) 1996, 1998 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1998, 2001 Free Software Foundation, Inc.
;; Author: Peter Breton <pbreton@cs.umb.edu>
;; Keywords: unix files
(mapconcat 'identity (cdr locate-cmd) " "))
(+ 2 (length (car locate-cmd))))
nil nil 'locate-history-list))
- (read-from-minibuffer
- "Locate: "
- (locate-word-at-point)
- nil nil 'locate-history-list)
- )))
+ (let* ((default (locate-word-at-point))
+ (input
+ (read-from-minibuffer
+ (if (> (length default) 0)
+ (format "Locate (default `%s'): " default)
+ (format "Locate: "))
+ nil nil nil 'locate-history-list default t)))
+ (and (equal input "") default
+ (setq input default))
+ input))))
+ (if (equal search-string "")
+ (error "Please specify a filename to search for"))
(let* ((locate-cmd-list (funcall locate-make-command-line search-string))
(locate-cmd (car locate-cmd-list))
(locate-cmd-args (cdr locate-cmd-list))
(switch-to-buffer-other-window locate-buffer-name))
(run-hooks 'dired-mode-hook)
+ (dired-next-line 2) ;move to first matching file.
(run-hooks 'locate-post-command-hook)
)
)
(append (list locate-current-filter) locate-format-args)))
(setq locate-format-string
- (concat locate-format-string ": \n\n")
+ (concat locate-format-string ":\n\n")
locate-regexp-match
- (concat locate-regexp-match ": \n"))
+ (concat locate-regexp-match ":\n"))
(insert (apply 'format locate-format-string (reverse locate-format-args)))