]> git.eshelyaron.com Git - emacs.git/commitdiff
(locate): Show default locate pattern within the
authorRichard M. Stallman <rms@gnu.org>
Sat, 17 Nov 2001 15:42:19 +0000 (15:42 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 17 Nov 2001 15:42:19 +0000 (15:42 +0000)
prompt, but don't insert it into the minibuffer contents.  Catch
the case when pattern is the empty string.

lisp/ChangeLog
lisp/locate.el

index 853e429da23ae1e28e51533a9820f57f57d241c6..f7a2c6b1ebae0564b3b0cb94e99a04024a23ee0e 100644 (file)
@@ -1,3 +1,9 @@
+2001-11-17  Stephen Eglen  <stephen@gnu.org>
+
+       * 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  <eliz@is.elta.co.il>
 
        * language/european.el ("French"): New language environment.
index 80dc7af7a2193d06c5f48e59f95ec87fe8355585..6d5967a57508c054fb440d81c864b71b173d20e5 100644 (file)
@@ -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))