+2002-01-14 Stefan Monnier <monnier@cs.yale.edu>
+
+ * 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 <eliz@is.elta.co.il>
* files.el (find-file-noselect): Don't consider a buffer as
* 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 <jas@extundo.com>
* mail/sendmail.el (mail-envelope-from): Fix :type.
* 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.
2001-12-13 Richard M. Stallman <rms@gnu.org>
- * 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 <eliz@is.elta.co.il>
;; 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
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
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
(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
;; 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))
(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