From: Stefan Monnier Date: Mon, 14 Jan 2002 12:45:46 +0000 (+0000) Subject: (ange-ftp-get-process, ange-ftp-send-cmd) X-Git-Tag: emacs-21.2~190 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ed931f3ea9d3edfe14c64300a48111e9db5ae091;p=emacs.git (ange-ftp-get-process, ange-ftp-send-cmd) (ange-ftp-file-name-all-completions, ange-ftp-file-name-completion) (ange-ftp-insert-directory): Preserve match-data. (ange-ftp-shell-command): Strip port number from the host if present. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9071ef02e4c..49c6c14a72c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2002-01-14 Stefan Monnier + + * net/ange-ftp.el (ange-ftp-get-process, ange-ftp-send-cmd) + (ange-ftp-file-name-all-completions, ange-ftp-file-name-completion) + (ange-ftp-insert-directory): Preserve match-data. + (ange-ftp-shell-command): Strip port number from the host if present. + 2002-01-13 Eli Zaretskii * files.el (find-file-noselect): Don't consider a buffer as @@ -8,7 +15,7 @@ * net/ange-ftp.el (ange-ftp-allow-child-lookup): Always return nil. This fixes a bug that treated all files as directories. (ange-ftp-insert-directory): Explicitly follow symlinks. - + 2001-12-28 Simon Josefsson * mail/sendmail.el (mail-envelope-from): Fix :type. @@ -40,7 +47,7 @@ * net/ange-ftp.el (ange-ftp-file-modtime): Use save-match-data. - * emacs-lisp/easy-mmode.el (define-minor-mode): + * emacs-lisp/easy-mmode.el (define-minor-mode): Make no arg by default in an interactive call, so that repeating the command toggles again. @@ -60,10 +67,10 @@ 2001-12-13 Richard M. Stallman - * font-lock.el (font-lock-mode): + * font-lock.el (font-lock-mode): Put our function at the end of after-change-functions. - * emacs-lisp/advice.el (ad-compile-function): + * emacs-lisp/advice.el (ad-compile-function): Byte compile the function under another (uninterned) name. 2001-12-10 Eli Zaretskii diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index cda0bf34201..06a34f58ea8 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -2092,30 +2092,31 @@ Create a new process if needed." ;; grab a suitable process. (setq proc (ange-ftp-start-process host user name)) - ;; login to FTP server. - (if (and (ange-ftp-use-smart-gateway-p host) - ange-ftp-gateway-host) - (ange-ftp-smart-login host user pass account proc) - (ange-ftp-normal-login host user pass account proc)) - - ;; Tell client to send back hash-marks as progress. It isn't usually - ;; fatal if this command fails. - (ange-ftp-guess-hash-mark-size proc) - - ;; Guess at the host type. - (ange-ftp-guess-host-type host user) - - ;; Try to use passive mode if asked to. - (when ange-ftp-try-passive-mode - (let ((answer (cdr (ange-ftp-raw-send-cmd - proc "passive" "Trying passive mode..." nil)))) - (if (string-match "\\?\\|refused" answer) - (message "Trying passive mode...ok") - (message "Trying passive mode...failed")))) - - ;; Run any user-specified hooks. Note that proc, host and user are - ;; dynamically bound at this point. - (run-hooks 'ange-ftp-process-startup-hook)) + (save-match-data + ;; login to FTP server. + (if (and (ange-ftp-use-smart-gateway-p host) + ange-ftp-gateway-host) + (ange-ftp-smart-login host user pass account proc) + (ange-ftp-normal-login host user pass account proc)) + + ;; Tell client to send back hash-marks as progress. It isn't usually + ;; fatal if this command fails. + (ange-ftp-guess-hash-mark-size proc) + + ;; Guess at the host type. + (ange-ftp-guess-host-type host user) + + ;; Try to use passive mode if asked to. + (when ange-ftp-try-passive-mode + (let ((answer (cdr (ange-ftp-raw-send-cmd + proc "passive" "Trying passive mode..." nil)))) + (if (string-match "\\?\\|refused" answer) + (message "Trying passive mode...ok") + (message "Trying passive mode...failed")))) + + ;; Run any user-specified hooks. Note that proc, host and user are + ;; dynamically bound at this point. + (run-hooks 'ange-ftp-process-startup-hook))) proc))) ;; Variables for caching host and host-type @@ -2211,30 +2212,31 @@ and NOWAIT." host-type (ange-ftp-host-type host user)) ;; This will trigger an FTP login, if one doesn't exist (eq cmd0 'dir)) - (setq cmd1 (funcall - (or (cdr (assq host-type ange-ftp-fix-dir-name-func-alist)) - 'identity) - cmd1) - cmd3 (nth 3 cmd)) - ;; Need to deal with the HP-UX ftp bug. This should also allow - ;; us to resolve symlinks to directories on SysV machines. (Sebastian will - ;; be happy.) - (and (eq host-type 'unix) - (string-match "/$" cmd1) - (not (string-match "R" cmd3)) - (setq cmd1 (concat cmd1 "."))) - - ;; If the dir name contains a space, some ftp servers will - ;; refuse to list it. We instead change directory to the - ;; directory in question and ls ".". - (when (string-match " " cmd1) - (ange-ftp-cd host user (nth 1 cmd)) - (setq cmd1 ".")) - - ;; If the remote ls can take switches, put them in - (or (memq host-type ange-ftp-dumb-host-types) - (setq cmd0 'ls - cmd1 (format "\"%s %s\"" cmd3 cmd1)))) + (save-match-data + (setq cmd1 (funcall + (or (cdr (assq host-type ange-ftp-fix-dir-name-func-alist)) + 'identity) + cmd1) + cmd3 (nth 3 cmd)) + ;; Need to deal with the HP-UX ftp bug. This should also allow + ;; us to resolve symlinks to directories on SysV machines. (Sebastian will + ;; be happy.) + (and (eq host-type 'unix) + (string-match "/$" cmd1) + (not (string-match "R" cmd3)) + (setq cmd1 (concat cmd1 "."))) + + ;; If the dir name contains a space, some ftp servers will + ;; refuse to list it. We instead change directory to the + ;; directory in question and ls ".". + (when (string-match " " cmd1) + (ange-ftp-cd host user (nth 1 cmd)) + (setq cmd1 ".")) + + ;; If the remote ls can take switches, put them in + (or (memq host-type ange-ftp-dumb-host-types) + (setq cmd0 'ls + cmd1 (format "\"%s %s\"" cmd3 cmd1))))) ;; First argument is the remote name ((progn @@ -3847,7 +3849,8 @@ Value is (0 0) if the modification time cannot be determined." completions))) (if (or (and (eq system-type 'windows-nt) - (string-match "^[a-zA-Z]:[/\\]$" ange-ftp-this-dir)) + (save-match-data + (string-match "^[a-zA-Z]:[/\\]$" ange-ftp-this-dir))) (string-equal "/" ange-ftp-this-dir)) (nconc (all-completions file (ange-ftp-generate-root-prefixes)) (ange-ftp-real-file-name-all-completions file @@ -3879,7 +3882,8 @@ Value is (0 0) if the modification time cannot be determined." (function ange-ftp-file-entry-active-p))))))) (if (or (and (eq system-type 'windows-nt) - (string-match "^[a-zA-Z]:[/\\]$" ange-ftp-this-dir)) + (save-match-data + (string-match "^[a-zA-Z]:[/\\]$" ange-ftp-this-dir))) (string-equal "/" ange-ftp-this-dir)) (try-completion file @@ -4324,21 +4328,23 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") ;; So the format conversion should be all that is needed. (defun ange-ftp-insert-directory (file switches &optional wildcard full) - (let ((short (ange-ftp-abbreviate-filename file)) - (parsed (ange-ftp-ftp-name (expand-file-name file))) - tem) - (if parsed - (if (and (not wildcard) - (setq tem (file-symlink-p (directory-file-name file)))) - (ange-ftp-insert-directory - (ange-ftp-replace-name-component file tem) - switches wildcard full) - (insert - (if wildcard - (let ((default-directory (file-name-directory file))) - (ange-ftp-ls (file-name-nondirectory file) switches nil nil t)) - (ange-ftp-ls file switches full))))q - (ange-ftp-real-insert-directory file switches wildcard full)))) + (save-match-data + (let ((short (ange-ftp-abbreviate-filename file)) + (parsed (ange-ftp-ftp-name (expand-file-name file))) + tem) + (if parsed + (if (and (not wildcard) + (setq tem (file-symlink-p (directory-file-name file)))) + (ange-ftp-insert-directory + (ange-ftp-replace-name-component file tem) + switches wildcard full) + (insert + (if wildcard + (let ((default-directory (file-name-directory file))) + (ange-ftp-ls (file-name-nondirectory file) + switches nil nil t)) + (ange-ftp-ls file switches full)))) + (ange-ftp-real-insert-directory file switches wildcard full))))) (defun ange-ftp-dired-uncache (dir) (if (ange-ftp-ftp-name (expand-file-name dir)) @@ -4368,6 +4374,10 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") (ange-ftp-real-shell-command command output-buffer error-buffer) (if (> (length name) 0) ; else it's $HOME (setq command (concat "cd " name "; " command))) + ;; Remove port from the hostname. + (save-match-data + (when (string-match "\\(.*\\)#" host) + (setq host (match-string 1 host)))) (setq command (format "%s %s \"%s\"" ; remsh -l USER does not work well ; on a hp-ux machine I tried