aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-04-09 03:08:18 +0000
committerRichard M. Stallman1995-04-09 03:08:18 +0000
commitc4f57b91f11a371b7b23ef2e7c46f6cdc515a0af (patch)
tree1dd2233a6894b65cd246e8eefc628d9148a9dcbc
parentbcccd65d3fbd3e0de151044eb843289100a27b9d (diff)
downloademacs-c4f57b91f11a371b7b23ef2e7c46f6cdc515a0af.tar.gz
emacs-c4f57b91f11a371b7b23ef2e7c46f6cdc515a0af.zip
(ange-ftp-parse-netrc): Bind `default-directory' to
"/" to avoid infinite loop while expanding filename. (ange-ftp-message): Don't truncate message in batch mode.
-rw-r--r--lisp/ange-ftp.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/ange-ftp.el b/lisp/ange-ftp.el
index cf3141c91ed..0da2944c5fa 100644
--- a/lisp/ange-ftp.el
+++ b/lisp/ange-ftp.el
@@ -926,9 +926,12 @@ SIZE, if supplied, should be a prime number."
926Args are as in `message': a format string, plus arguments to be formatted." 926Args are as in `message': a format string, plus arguments to be formatted."
927 (let ((msg (apply (function format) fmt args)) 927 (let ((msg (apply (function format) fmt args))
928 (max (window-width (minibuffer-window)))) 928 (max (window-width (minibuffer-window))))
929 (if (>= (length msg) max) 929 (if noninteractive
930 (setq msg (concat "> " (substring msg (- 3 max))))) 930 msg
931 (message "%s" msg))) 931 (if (>= (length msg) max)
932 ;; Take just the last MAX - 3 chars of the string.
933 (setq msg (concat "> " (substring msg (- 3 max)))))
934 (message "%s" msg))))
932 935
933(defun ange-ftp-abbreviate-filename (file &optional new) 936(defun ange-ftp-abbreviate-filename (file &optional new)
934 "Abbreviate the file name FILE relative to the default-directory. 937 "Abbreviate the file name FILE relative to the default-directory.
@@ -1195,9 +1198,11 @@ Optional DEFAULT is password to start with."
1195 ;; We set this before actually doing it to avoid the possibility 1198 ;; We set this before actually doing it to avoid the possibility
1196 ;; of an infinite loop if ange-ftp-netrc-filename is an FTP file. 1199 ;; of an infinite loop if ange-ftp-netrc-filename is an FTP file.
1197 (interactive) 1200 (interactive)
1198 (let* ((file (ange-ftp-chase-symlinks 1201 (let (file attr)
1199 (ange-ftp-real-expand-file-name ange-ftp-netrc-filename))) 1202 (let ((default-directory "/"))
1200 (attr (ange-ftp-real-file-attributes file))) 1203 (setq file (ange-ftp-chase-symlinks
1204 (ange-ftp-real-expand-file-name ange-ftp-netrc-filename)))
1205 (setq attr (ange-ftp-real-file-attributes file)))
1201 (if (and attr ; file exists. 1206 (if (and attr ; file exists.
1202 (not (equal (nth 5 attr) ange-ftp-netrc-modtime))) ; file changed 1207 (not (equal (nth 5 attr) ange-ftp-netrc-modtime))) ; file changed
1203 (save-match-data 1208 (save-match-data