From fe8c7212711d93d339a08abd64ffc357e9d5aff7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 17 Nov 2001 15:42:19 +0000 Subject: [PATCH] (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. --- lisp/ChangeLog | 6 ++++++ lisp/locate.el | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 853e429da23..f7a2c6b1eba 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2001-11-17 Stephen Eglen + + * locate.el (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. + 2001-11-17 Eli Zaretskii * language/european.el ("French"): New language environment. 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)) -- 2.39.2