Stephen Leake <[email protected]> writes:

> I propose to define ada-find-file in 5.x as:
>
> (defun ada-find-file ()
>   (interactive)
>   ;; we assume compliation-search-path is set, either by an
>   ;; ada-mode project, or by some other means.
>   (let ((dirs compilation-search-path)
>       list
>       filename)
>
>     ;; build completion list of all file names in compilation-search-path
>     (while dirs
>       (when (file-directory-p (car dirs))
>       (setq list (append list (file-name-all-completions "" (car dirs)))))
>       (setq dirs (cdr dirs)))
>
>     ;; prompt the user with the completion list
>     ;; FIXME: option to filter with ada-*-suffixes?
>     (setq filename (completing-read "File: " list))
>
>     ;; open it
>     (find-file (locate-file filename compilation-search-path))
>     ))

Found a better implementation:

(defun ada-find-file (filename)
  ;; we assume compliation-search-path is set, either by an
  ;; ada-mode project, or by some other means.
  ;; FIXME: option to filter with ada-*-suffixes?
  (interactive (list (completing-read "File: "
                                      (apply-partially
                                       'locate-file-completion-table
                                       compilation-search-path nil))))
  (find-file (locate-file filename compilation-search-path))
  )


--
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to