]> code.delx.au - gnu-emacs/blobdiff - lisp/locate.el
* progmodes/python.el (python-info-current-defun): Fix failed
[gnu-emacs] / lisp / locate.el
index ce1154c97399889d25dc4c304bee279190f58421..804260969ee8188d608ca05cb0371a3d7d9dfea9 100644 (file)
@@ -1,7 +1,6 @@
 ;;; locate.el --- interface to the locate command
 
-;; Copyright (C) 1996, 1998, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1998, 2001-2013 Free Software Foundation, Inc.
 
 ;; Author: Peter Breton <pbreton@cs.umb.edu>
 ;; Keywords: unix files
@@ -35,7 +34,7 @@
 ;;
 ;;   SHELLPROGRAM  Name-to-find
 ;;
-;; set the variable `locate-command' in your .emacs file.
+;; set the variable `locate-command' in your init file.
 ;;
 ;;   To use a more complicated expression, create a function which
 ;; takes a string (the name to find) as input and returns a list.
@@ -97,7 +96,7 @@
 ;; (defadvice dired-make-relative (before set-no-error activate)
 ;;   "For locate mode and Windows, don't return errors"
 ;;   (if (and (eq   major-mode  'locate-mode)
-;;        (memq system-type (list 'windows-nt 'ms-dos)))
+;;        (memq system-type '(windows-nt ms-dos)))
 ;;       (ad-set-arg 2 t)
 ;;     ))
 ;;
@@ -145,6 +144,11 @@ the version.)"
   :type 'string
   :group 'locate)
 
+(defcustom locate-post-command-hook nil
+  "List of hook functions run after `locate' (see `run-hooks')."
+  :type  'hook
+  :group 'locate)
+
 (defvar locate-history-list nil
   "The history list used by the \\[locate] command.")
 
@@ -226,6 +230,11 @@ that is, with a prefix arg, you get the default behavior."
   :group 'locate
   :type 'boolean)
 
+(defcustom locate-mode-hook nil
+  "List of hook functions run by `locate-mode' (see `run-mode-hooks')."
+  :type  'hook
+  :group 'locate)
+
 ;; Functions
 
 (defun locate-default-make-command-line (search-string)
@@ -325,7 +334,7 @@ then `locate-post-command-hook'."
 
        (locate-do-setup search-string)))
     (and (not (string-equal (buffer-name) locate-buffer-name))
-       (switch-to-buffer-other-window locate-buffer-name))
+       (pop-to-buffer locate-buffer-name))
 
     (run-hooks 'dired-mode-hook)
     (dired-next-line 3)                        ;move to first matching file.
@@ -471,9 +480,9 @@ do not work in subdirectories.
   (make-local-variable 'directory-listing-before-filename-regexp)
   ;; This should support both Unix and Windoze style names
   (setq directory-listing-before-filename-regexp
-       (concat "^."
+       (concat "^.\\("
                (make-string (1- locate-filename-indentation) ?\s)
-               "\\(/\\|[A-Za-z]:\\)\\|"
+                "\\)\\|"
                (default-value 'directory-listing-before-filename-regexp)))
   (make-local-variable 'dired-actual-switches)
   (setq dired-actual-switches "")
@@ -579,7 +588,7 @@ do not work in subdirectories.
     (message "This command only works inside main listing.")))
 
 ;; From Stephen Eglen <stephen@cns.ed.ac.uk>
-(defun locate-update (ignore1 ignore2)
+(defun locate-update (_ignore1 _ignore2)
   "Revert the *Locate* buffer.
 If `locate-update-when-revert' is non-nil, offer to update the
 locate database using the shell command in `locate-update-command'."