Mercurial > emacs
changeset 41202:e9fb112f3550
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 17 Nov 2001 15:38:59 +0000 |
parents | 6ea90136e5d8 |
children | 08f6ab08cdb2 |
files | lisp/locate.el |
diffstat | 1 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/locate.el Sat Nov 17 15:05:17 2001 +0000 +++ b/lisp/locate.el Sat Nov 17 15:38:59 2001 +0000 @@ -199,11 +199,18 @@ (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))