/[emacs]/emacs/lisp/complete.el
ViewVC logotype

Diff of /emacs/lisp/complete.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.36 by pj, Mon Jul 16 12:22:58 2001 UTC revision 1.36.8.1 by miles, Fri Apr 4 06:20:01 2003 UTC
# Line 78  Line 78 
78  ;; The regular M-TAB (lisp-complete-symbol) command also supports  ;; The regular M-TAB (lisp-complete-symbol) command also supports
79  ;; partial completion in this package.  ;; partial completion in this package.
80    
 ;; File name completion does not do partial completion of directories  
 ;; on the path, e.g., "/u/b/f" will not complete to "/usr/bin/foo",  
 ;; but you can put *'s in the path to accomplish this:  "/u*/b*/f".  
 ;; Stars are required for performance reasons.  
   
81  ;; In addition, this package includes a feature for accessing include  ;; In addition, this package includes a feature for accessing include
82  ;; files.  For example, `C-x C-f <sys/time.h> RET' reads the file  ;; files.  For example, `C-x C-f <sys/time.h> RET' reads the file
83  ;; /usr/include/sys/time.h.  The variable PC-include-file-path is a  ;; /usr/include/sys/time.h.  The variable PC-include-file-path is a
# Line 388  of `minibuffer-completion-table' and the Line 383  of `minibuffer-completion-table' and the
383               (delete-region beg end)               (delete-region beg end)
384               (insert str)               (insert str)
385               (setq end (+ beg (length str)))))               (setq end (+ beg (length str)))))
386          
387        ;; Prepare various delimiter strings        ;; Prepare various delimiter strings
388        (or (equal PC-word-delimiters PC-delims)        (or (equal PC-word-delimiters PC-delims)
389            (setq PC-delims PC-word-delimiters            (setq PC-delims PC-word-delimiters
# Line 396  of `minibuffer-completion-table' and the Line 391  of `minibuffer-completion-table' and the
391                  PC-ndelims-regex (concat "[^" PC-delims "]*")                  PC-ndelims-regex (concat "[^" PC-delims "]*")
392                  PC-delims-list (append PC-delims nil)))                  PC-delims-list (append PC-delims nil)))
393    
394          ;; Add wildcards if necessary
395          (and filename
396               (let ((dir (file-name-directory str))
397                     (file (file-name-nondirectory str)))
398                 (while (and (stringp dir) (not (file-directory-p dir)))
399                   (setq dir (directory-file-name dir))
400                   (setq file (concat (replace-regexp-in-string
401                                       PC-delim-regex "*\\&"
402                                       (file-name-nondirectory dir))
403                                      "*/" file))
404                   (setq dir (file-name-directory dir)))
405                 (setq str (concat dir file))))
406    
407        ;; Look for wildcard expansions in directory name        ;; Look for wildcard expansions in directory name
408        (and filename        (and filename
409             (string-match "\\*.*/" str)             (string-match "\\*.*/" str)
# Line 883  or properties are considered." Line 891  or properties are considered."
891  ;;; This is adapted from lib-complete.el, by Mike Williams.  ;;; This is adapted from lib-complete.el, by Mike Williams.
892  (defun PC-include-file-all-completions (file search-path &optional full)  (defun PC-include-file-all-completions (file search-path &optional full)
893    "Return all completions for FILE in any directory on SEARCH-PATH.    "Return all completions for FILE in any directory on SEARCH-PATH.
894  If optional third argument FULL is non-nil, returned pathnames should be  If optional third argument FULL is non-nil, returned pathnames should be
895  absolute rather than relative to some directory on the SEARCH-PATH."  absolute rather than relative to some directory on the SEARCH-PATH."
896    (setq search-path    (setq search-path
897          (mapcar (lambda (dir)          (mapcar (lambda (dir)
# Line 893  absolute rather than relative to some di Line 901  absolute rather than relative to some di
901        ;; It's an absolute file name, so don't need search-path        ;; It's an absolute file name, so don't need search-path
902        (progn        (progn
903          (setq file (expand-file-name file))          (setq file (expand-file-name file))
904          (file-name-all-completions          (file-name-all-completions
905           (file-name-nondirectory file) (file-name-directory file)))           (file-name-nondirectory file) (file-name-directory file)))
906      (let ((subdir (file-name-directory file))      (let ((subdir (file-name-directory file))
907            (ndfile (file-name-nondirectory file))            (ndfile (file-name-nondirectory file))
# Line 911  absolute rather than relative to some di Line 919  absolute rather than relative to some di
919            (if (file-directory-p dir)            (if (file-directory-p dir)
920                (progn                (progn
921                  (setq file-lists                  (setq file-lists
922                        (cons                        (cons
923                         (mapcar (lambda (file) (concat subdir file))                         (mapcar (lambda (file) (concat subdir file))
924                                 (file-name-all-completions ndfile                                 (file-name-all-completions ndfile
925                                                            (car search-path)))                                                            (car search-path)))
926                         file-lists))))                         file-lists))))
927            (setq search-path (cdr search-path))))            (setq search-path (cdr search-path))))

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.36.8.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26