summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2006-12-20 05:57:41 +0000
committerMichael Albinus <michael.albinus@gmx.de>2006-12-20 05:57:41 +0000
commite1e17cae49bb5b9bdf6bcce34b8916b665dbb9c1 (patch)
treeda4b5388668146c85268fcddfbcc78a7e8a7dda0
parent82bc67b8b25da41b15f93d7d69bcc64d48abfd46 (diff)
downloademacs-e1e17cae49bb5b9bdf6bcce34b8916b665dbb9c1.tar.gz
* net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
parameter PREDICATE. * lisp/tramp.el (tramp-handle-file-name-completion) (tramp-completion-handle-file-name-completion): Handle optional parameter PREDICATE. (tramp-find-default-method): Add code for default values.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/net/ange-ftp.el11
-rw-r--r--lisp/net/tramp.el19
3 files changed, 30 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fe321c3060b..9549676f155 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2006-12-20 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
+ parameter PREDICATE.
+
+ * lisp/tramp.el (tramp-handle-file-name-completion)
+ (tramp-completion-handle-file-name-completion): Handle optional
+ parameter PREDICATE.
+ (tramp-find-default-method): Add code for default values.
+
2006-12-20 Nick Roberts <nickrob@snap.net.nz>
* progmodes/gdb-ui.el (gdb-stopped): After attaching to a process
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index c77dbbd64b3..75c9b04a040 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -3977,7 +3977,7 @@ E.g.,
ange-ftp-this-dir))
(ange-ftp-real-file-name-all-completions file ange-ftp-this-dir)))))
-(defun ange-ftp-file-name-completion (file dir)
+(defun ange-ftp-file-name-completion (file dir &optional predicate)
(let ((ange-ftp-this-dir (expand-file-name dir)))
(if (ange-ftp-ftp-name ange-ftp-this-dir)
(progn
@@ -4005,8 +4005,13 @@ E.g.,
file
(nconc (ange-ftp-generate-root-prefixes)
(ange-ftp-real-file-name-all-completions
- file ange-ftp-this-dir)))
- (ange-ftp-real-file-name-completion file ange-ftp-this-dir)))))
+ file ange-ftp-this-dir))
+ predicate)
+ (if predicate
+ (ange-ftp-real-file-name-completion
+ file ange-ftp-this-dir predicate)
+ (ange-ftp-real-file-name-completion
+ file ange-ftp-this-dir))))))
(defun ange-ftp-file-name-completion-1 (file tbl dir &optional predicate)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 6a46486e6e1..3cdcfd74084 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2856,7 +2856,8 @@ of."
;; The following isn't needed for Emacs 20 but for 19.34?
-(defun tramp-handle-file-name-completion (filename directory)
+(defun tramp-handle-file-name-completion
+ (filename directory &optional predicate)
"Like `file-name-completion' for tramp files."
(unless (tramp-tramp-file-p directory)
(error
@@ -2866,7 +2867,8 @@ of."
(try-completion
filename
(mapcar (lambda (x) (cons x nil))
- (file-name-all-completions filename directory)))))
+ (file-name-all-completions filename directory))
+ predicate)))
;; cp, mv and ln
@@ -4627,10 +4629,13 @@ Falls back to normal file name handler if no tramp file name handler exists."
;; Method, host name and user name completion for a file.
;;;###autoload
-(defun tramp-completion-handle-file-name-completion (filename directory)
+(defun tramp-completion-handle-file-name-completion
+ (filename directory &optional predicate)
"Like `file-name-completion' for tramp files."
- (try-completion filename
- (mapcar 'list (file-name-all-completions filename directory))))
+ (try-completion
+ filename
+ (mapcar 'list (file-name-all-completions filename directory))
+ predicate))
;; I misuse a little bit the tramp-file-name structure in order to handle
;; completion possibilities for partial methods / user names / host names.
@@ -6965,8 +6970,8 @@ localname (file name on remote host)."
item)
(while choices
(setq item (pop choices))
- (when (and (string-match (nth 0 item) (or host ""))
- (string-match (nth 1 item) (or user "")))
+ (when (and (string-match (or (nth 0 item) "") (or host ""))
+ (string-match (or (nth 1 item) "") (or user "")))
(setq method (nth 2 item))
(setq choices nil)))
method))