diff options
author | Richard M. Stallman <rms@gnu.org> | 2001-11-17 15:42:19 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2001-11-17 15:42:19 +0000 |
commit | fe8c7212711d93d339a08abd64ffc357e9d5aff7 (patch) | |
tree | dee0e6e170a184e53686d38fb5c808203de8a740 /lisp/locate.el | |
parent | a5e6715c0374a8288df140c8374982be5f58f292 (diff) | |
download | emacs-fe8c7212711d93d339a08abd64ffc357e9d5aff7.tar.gz |
(locate): Show default locate pattern within the
prompt, but don't insert it into the minibuffer contents. Catch
the case when pattern is the empty string.
Diffstat (limited to 'lisp/locate.el')
-rw-r--r-- | lisp/locate.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/locate.el b/lisp/locate.el index 80dc7af7a21..6d5967a5750 100644 --- a/lisp/locate.el +++ b/lisp/locate.el @@ -199,11 +199,18 @@ With prefix arg, prompt for the locate command to run." (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)) |