Function: locate-in-alternate-database

locate-in-alternate-database is an interactive and byte-compiled function defined in locate.el.gz.

Signature

(locate-in-alternate-database SEARCH-STRING DATABASE)

Documentation

Run the GNU locate program, using an alternate database.

This command only works if you use GNU locate. It does not work properly if locate-prompt-for-command is set to t. In that case, you can just run the regular locate command and specify the database on the command line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/locate.el.gz
;; Only for GNU locate
(defun locate-in-alternate-database  (search-string database)
  "Run the GNU locate program, using an alternate database.

This command only works if you use GNU locate.  It does not work
properly if `locate-prompt-for-command' is set to t.  In that
case, you can just run the regular `locate' command and specify
the database on the command line."
  (interactive
      (list
       (progn
	 ;; (require 'locate)
	 (read-from-minibuffer "Locate: " nil nil
			       nil 'locate-history-list))
       (read-file-name "Locate using Database: " )
       ))
  (or (file-exists-p database)
      (error "Database file %s does not exist" database))
  (let ((locate-make-command-line
         (lambda (string)
           (cons locate-command
                 (list (concat "--database="
                               (expand-file-name database))
                       string)))))
    (locate search-string)))