Show
Ignore:
Timestamp:
09/18/06 20:48:14 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/locate.el

    r4111 r4166  
    115115;; Variables 
    116116 
     117(defvar locate-current-search nil) 
    117118(defvar locate-current-filter nil) 
    118119 
     
    290291          (or (and current-prefix-arg (not locate-prompt-for-command)) 
    291292              (and (not current-prefix-arg) locate-prompt-for-command))) 
     293         locate-buffer 
    292294         ) 
    293295 
    294296    ;; Find the Locate buffer 
    295     (save-window-excursion 
    296       (set-buffer (get-buffer-create locate-buffer-name)) 
     297    (setq locate-buffer (if (eq major-mode 'locate-mode) 
     298                            (current-buffer) 
     299                          (get-buffer-create locate-buffer-name))) 
     300 
     301    (save-excursion 
     302      (set-buffer locate-buffer) 
    297303      (locate-mode) 
     304 
    298305      (let ((inhibit-read-only t) 
    299             (buffer-undo-list t)) 
    300         (erase-buffer) 
    301  
    302         (setq locate-current-filter filter) 
    303  
    304         (if run-locate-command 
    305             (shell-command search-string locate-buffer-name) 
    306           (apply 'call-process locate-cmd nil t nil locate-cmd-args)) 
    307  
    308         (and filter 
    309              (locate-filter-output filter)) 
    310  
    311         (locate-do-setup search-string) 
    312         )) 
    313     (and (not (string-equal (buffer-name) locate-buffer-name)) 
    314         (switch-to-buffer-other-window locate-buffer-name)) 
     306            (buffer-undo-list t)) 
     307        (erase-buffer) 
     308 
     309        (set (make-local-variable 'locate-current-search) search-string) 
     310        (set (make-local-variable 'locate-current-filter) filter) 
     311 
     312        (if run-locate-command 
     313            (shell-command search-string) 
     314          (apply 'call-process locate-cmd nil t nil locate-cmd-args)) 
     315 
     316        (and filter 
     317             (locate-filter-output filter)) 
     318 
     319        (locate-do-setup search-string))) 
     320 
     321    (unless (eq (current-buffer) locate-buffer) 
     322      (switch-to-buffer-other-window locate-buffer)) 
    315323 
    316324    (run-hooks 'dired-mode-hook) 
     
    462470        buffer-read-only    t 
    463471        selective-display   t) 
     472  (buffer-disable-undo) 
    464473  (dired-alist-add-1 default-directory (point-min-marker)) 
    465474  (set (make-local-variable 'dired-directory) "/") 
     
    493502    (and (eobp) 
    494503         (progn 
    495            (kill-buffer locate-buffer-name) 
    496            (if locate-current-filter 
    497                (error "Locate: no match for %s in database using filter %s" 
    498                       search-string locate-current-filter) 
    499              (error "Locate: no match for %s in database" search-string)))) 
     504           (let ((filter locate-current-filter)) ; local 
     505             (kill-buffer (current-buffer)) 
     506             (if filter 
     507                 (error "Locate: no match for %s in database using filter %s" 
     508                        search-string filter) 
     509               (error "Locate: no match for %s in database" search-string))))) 
    500510 
    501511    (locate-insert-header search-string) 
     
    581591If `locate-update-when-revert' is non-nil, offer to update the 
    582592locate database using the shell command in `locate-update-command'." 
    583   (let ((str (car locate-history-list))) 
    584     (and locate-update-when-revert 
    585          (yes-or-no-p "Update locate database (may take a few seconds)? ") 
    586          ;; `expand-file-name' is used in order to autoload Tramp if 
    587          ;; necessary.  It cannot be loaded when `default-directory' 
    588          ;; is remote. 
    589          (let ((default-directory (expand-file-name locate-update-path))) 
    590            (shell-command locate-update-command))) 
    591     (locate str))) 
     593  (and locate-update-when-revert 
     594       (yes-or-no-p "Update locate database (may take a few seconds)? ") 
     595       ;; `expand-file-name' is used in order to autoload Tramp if 
     596       ;; necessary.  It cannot be loaded when `default-directory' 
     597       ;; is remote. 
     598       (let ((default-directory (expand-file-name locate-update-path))) 
     599         (shell-command locate-update-command))) 
     600  (locate locate-current-search locate-current-filter)) 
    592601 
    593602;;; Modified three functions from `dired.el':