changeset 11315:c5f81d9d417c

(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.
author Richard M. Stallman <rms@gnu.org>
date Sun, 09 Apr 1995 03:08:18 +0000
parents 81ed366620c0
children 72f527d22fe1
files lisp/ange-ftp.el
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ange-ftp.el	Sun Apr 09 03:07:01 1995 +0000
+++ b/lisp/ange-ftp.el	Sun Apr 09 03:08:18 1995 +0000
@@ -926,9 +926,12 @@
 Args are as in `message': a format string, plus arguments to be formatted."
   (let ((msg (apply (function format) fmt args))
 	(max (window-width (minibuffer-window))))
-    (if (>= (length msg) max)
-	(setq msg (concat "> " (substring msg (- 3 max)))))
-    (message "%s" msg)))
+    (if noninteractive
+	msg
+      (if (>= (length msg) max)
+	  ;; Take just the last MAX - 3 chars of the string.
+	  (setq msg (concat "> " (substring msg (- 3 max)))))
+      (message "%s" msg))))
 
 (defun ange-ftp-abbreviate-filename (file &optional new)
   "Abbreviate the file name FILE relative to the default-directory.
@@ -1195,9 +1198,11 @@
   ;; We set this before actually doing it to avoid the possibility
   ;; of an infinite loop if ange-ftp-netrc-filename is an FTP file.
   (interactive)
-  (let* ((file (ange-ftp-chase-symlinks
-		(ange-ftp-real-expand-file-name ange-ftp-netrc-filename)))
-	 (attr (ange-ftp-real-file-attributes file)))
+  (let (file attr)
+    (let ((default-directory "/"))
+      (setq file (ange-ftp-chase-symlinks
+		  (ange-ftp-real-expand-file-name ange-ftp-netrc-filename)))
+      (setq attr (ange-ftp-real-file-attributes file)))
     (if (and attr			; file exists.
 	     (not (equal (nth 5 attr) ange-ftp-netrc-modtime)))	; file changed
 	(save-match-data