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

Diff of /emacs/lisp/ido.el

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

revision 1.78 by kfstorm, Mon Oct 3 16:45:35 2005 UTC revision 1.79 by kfstorm, Wed Oct 19 22:21:18 2005 UTC
# Line 1084  it doesn't interfere with other minibuff Line 1084  it doesn't interfere with other minibuff
1084            (setq truncate-lines t)))))            (setq truncate-lines t)))))
1085    
1086  (defun ido-is-tramp-root (&optional dir)  (defun ido-is-tramp-root (&optional dir)
   (setq dir (or dir ido-current-directory))  
1087    (and ido-enable-tramp-completion    (and ido-enable-tramp-completion
1088         (string-match "\\`/[^/][^/]+:\\([^/:@]+@\\)?\\'" dir)))         (string-match "\\`/[^/]+[@:]\\'"
1089                         (or dir ido-current-directory))))
1090    
1091  (defun ido-is-root-directory (&optional dir)  (defun ido-is-root-directory (&optional dir)
1092    (setq dir (or dir ido-current-directory))    (setq dir (or dir ido-current-directory))
# Line 1507  With ARG, turn ido speed-up on if arg is Line 1507  With ARG, turn ido speed-up on if arg is
1507    
1508  (defun ido-set-current-directory (dir &optional subdir no-merge)  (defun ido-set-current-directory (dir &optional subdir no-merge)
1509    ;; Set ido's current directory to DIR or DIR/SUBDIR    ;; Set ido's current directory to DIR or DIR/SUBDIR
1510    (setq dir (ido-final-slash dir t))    (unless (and ido-enable-tramp-completion
1511                   (string-match "\\`/[^/]*@\\'" dir))
1512        (setq dir (ido-final-slash dir t)))
1513    (setq ido-use-merged-list nil    (setq ido-use-merged-list nil
1514          ido-try-merged-list (not no-merge))          ido-try-merged-list (not no-merge))
1515    (if subdir    (when subdir
1516        (setq dir (ido-final-slash (concat dir subdir) t)))      (setq dir (concat dir subdir))
1517        (unless (and ido-enable-tramp-completion
1518                     (string-match "\\`/[^/]*@\\'" dir))
1519          (setq dir (ido-final-slash dir t))))
1520    (if (equal dir ido-current-directory)    (if (equal dir ido-current-directory)
1521        nil        nil
1522      (ido-trace "cd" dir)      (ido-trace "cd" dir)
# Line 3102  for first matching file." Line 3107  for first matching file."
3107     ((ido-nonreadable-directory-p dir) '())     ((ido-nonreadable-directory-p dir) '())
3108     ;; do not check (ido-directory-too-big-p dir) here.     ;; do not check (ido-directory-too-big-p dir) here.
3109     ;; Caller must have done that if necessary.     ;; Caller must have done that if necessary.
    ((and ido-enable-tramp-completion  
          (string-match "\\`/\\([^/:]+:\\([^/:@]+@\\)?\\)\\'" dir))  
3110    
3111      ;; Trick tramp's file-name-all-completions handler to DTRT, as it     ((and ido-enable-tramp-completion
3112      ;; has some pretty obscure requirements.  This seems to work...           (or (fboundp 'tramp-completion-mode)
3113      ;; /ftp:            => (f-n-a-c "/ftp:" "")               (require 'tramp nil t))
3114      ;; /ftp:kfs:        => (f-n-a-c "" "/ftp:kfs:")           (string-match "\\`/[^/]+[:@]\\'" dir))
3115      ;; /ftp:kfs@      => (f-n-a-c "ftp:kfs@" "/")      ;; Strip method:user@host: part of tramp completions.
3116      ;; /ftp:kfs@kfs:  => (f-n-a-c "" "/ftp:kfs@kfs:")      ;; Tramp completions do not include leading slash.
3117      ;; Currently no attempt is made to handle multi: stuff.      (let ((len (1- (length dir)))
3118              (compl
3119      (let* ((prefix (match-string 1 dir))             (or (file-name-all-completions "" dir)
3120             (user-flag (match-beginning 2))                 ;; work around bug in ange-ftp.
3121             (len (and prefix (length prefix)))                 ;; /ftp:user@host: => nil
3122             compl)                 ;; /ftp:user@host:./ => ok
3123        (if user-flag                 (and
3124            (setq dir (substring dir 1)))                  (not (string= "/ftp:" dir))
3125        (require 'tramp nil t)                  (tramp-tramp-file-p dir)
3126        (ido-trace "tramp complete" dir)                  (fboundp 'tramp-ftp-file-name-p)
3127        (setq compl (file-name-all-completions dir (if user-flag "/" "")))                  (funcall 'tramp-ftp-file-name-p dir)
3128        (if (> len 0)                  (string-match ":\\'" dir)
3129                    (file-name-all-completions "" (concat dir "./"))))))
3130          (if (and compl
3131                   (> (length (car compl)) len)
3132                   (string= (substring (car compl) 0 len) (substring dir 1)))
3133            (mapcar (lambda (c) (substring c len)) compl)            (mapcar (lambda (c) (substring c len)) compl)
3134          compl)))          compl)))
3135     (t     (t
# Line 3193  for first matching file." Line 3200  for first matching file."
3200                                (if ido-file-extensions-order                                (if ido-file-extensions-order
3201                                    #'ido-file-extension-lessp                                    #'ido-file-extension-lessp
3202                                  #'ido-file-lessp)))                                  #'ido-file-lessp)))
3203      (let ((default-directory ido-current-directory))      (unless (ido-is-tramp-root ido-current-directory)
3204        (ido-to-end ;; move ftp hosts and visited files to end        (let ((default-directory ido-current-directory))
3205         (delq nil (mapcar          (ido-to-end ;; move ftp hosts and visited files to end
3206                    (lambda (x) (if (or (string-match "..:\\'" x)           (delq nil (mapcar
3207                                        (and (not (ido-final-slash x))                      (lambda (x) (if (or (string-match "..:\\'" x)
3208                                             (get-file-buffer x))) x))                                          (and (not (ido-final-slash x))
3209                    ido-temp-list))))                                               (get-file-buffer x))) x))
3210                        ido-temp-list)))))
3211      (ido-to-end  ;; move . files to end      (ido-to-end  ;; move . files to end
3212       (delq nil (mapcar       (delq nil (mapcar
3213                  (lambda (x) (if (string-equal (substring x 0 1) ".") x))                  (lambda (x) (if (string-equal (substring x 0 1) ".") x))

Legend:
Removed from v.1.78  
changed lines
  Added in v.1.79

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