]> code.delx.au - gnu-emacs/blobdiff - lisp/net/ange-ftp.el
Ibuffer: Mark buffers by content
[gnu-emacs] / lisp / net / ange-ftp.el
index d124027ea722c556face948eccd1fbdc40e7aca4..d5c03e3f4ae00b75f85f43e729257b8e45abeb9f 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ange-ftp.el --- transparent FTP support for GNU Emacs
 
-;; Copyright (C) 1989-1996, 1998, 2000-2015 Free Software Foundation,
+;; Copyright (C) 1989-1996, 1998, 2000-2016 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Andy Norman (ange@hplb.hpl.hp.com)
 ;;
 ;;    "^$*$ *"
 ;;
-;; 9) Set the variable ange-ftp-gateway-program-interactive to 't' to let
+;; 9) Set the variable ange-ftp-gateway-program-interactive to t to let
 ;;    ange-ftp know that it has to "hand-hold" the login to the gateway
 ;;    machine.
 ;;
   '("\\`/\\(\\([^/:]*\\)@\\)?\\([^@/:]*[^@/:.]\\):\\(.*\\)" . (3 2 4))
   "Format of a fully expanded remote file name.
 
-This is a list of the form \(REGEXP HOST USER NAME\),
+This is a list of the form \(REGEXP HOST USER NAME),
 where REGEXP is a regular expression matching
 the full remote name, and HOST, USER, and NAME are the numbers of
 parenthesized expressions in REGEXP for the components (in that order)."
@@ -1107,7 +1107,7 @@ All HOST values should be in lower case.")
 (defun ange-ftp-message (fmt &rest args)
   "Display message in echo area, but indicate if truncated.
 Args are as in `message': a format string, plus arguments to be formatted."
-  (let ((msg (apply 'format fmt args))
+  (let ((msg (apply #'format-message fmt args))
        (max (window-width (minibuffer-window))))
     (if noninteractive
        msg
@@ -1366,8 +1366,8 @@ only return the directory part of FILE."
     (goto-char end)))
 
 ;; Read in ~/.netrc, if one exists.  If ~/.netrc file exists and has
-;; the correct permissions then extract the \`machine\', \`login\',
-;; \`password\' and \`account\' information from within.
+;; the correct permissions then extract the machine, login,
+;; password and account information from within.
 
 (defun ange-ftp-parse-netrc ()
   ;; We set this before actually doing it to avoid the possibility
@@ -1536,8 +1536,8 @@ then kill the related FTP process."
       (signal 'file-error
              (list "Opening directory"
                    (if (file-exists-p directory)
-                       "not a directory"
-                     "no such file or directory")
+                       "Not a directory"
+                     "No such file or directory")
                    directory))))
 \f
 ;;;; ------------------------------------------------------------
@@ -1613,7 +1613,7 @@ good, skip, fatal, or unknown."
                          -6)))
         (if (zerop ange-ftp-xfer-size)
             (ange-ftp-message "%s...%dk" ange-ftp-process-msg kbytes)
-          (let ((percent (/ (* 100 kbytes) ange-ftp-xfer-size)))
+          (let ((percent (floor (* 100.0 kbytes) ange-ftp-xfer-size)))
             ;; cut out the redisplay of identical %-age messages.
             (unless (eq percent ange-ftp-last-percent)
               (setq ange-ftp-last-percent percent)
@@ -2511,7 +2511,7 @@ Works by doing a pwd and examining the directory syntax."
 ;;;; Remote file and directory listing support.
 ;;;; ------------------------------------------------------------
 
-;; Returns whether HOST's FTP server doesn't like \'ls\' or \'dir\' commands
+;; Returns whether HOST's FTP server doesn't like 'ls' or 'dir' commands
 ;; to take switch arguments.
 (defun ange-ftp-dumb-unix-host (host)
   (and host ange-ftp-dumb-unix-host-regexp
@@ -2831,16 +2831,24 @@ match subdirectories as well.")
                      files ange-ftp-files-hashtable)))
 
 (defun ange-ftp-switches-ok (switches)
-  "Return SWITCHES (a string) if suitable for our use."
+  "Return SWITCHES (a string) if suitable for use with ls over ftp."
   (and (stringp switches)
-       ;; We allow the A switch, which lists all files except "." and
-       ;; "..".  This is OK because we manually insert these entries
-       ;; in the hash table.
+       ;; We allow the --almost-all switch, which lists all files
+       ;; except "." and "..".  This is OK because we manually
+       ;; insert these entries in the hash table.
        (string-match
-       "--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
+        "--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]"
+        switches)
+       ;; Disallow other long flags except --(almost-)all.
+       (not (string-match "\\(\\`\\| \\)--\\w+"
+                          (replace-regexp-in-string
+                           "--\\(almost-\\)?all\\>" ""
+                           switches)))
+       ;; Must include 'l'.
        (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
+       ;; Disallow recursive flag.
        (not (string-match
-            "--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
+             "\\(\\`\\| \\)-[[:alpha:]]*R" switches))
        switches))
 
 (defun ange-ftp-get-files (directory &optional no-error)
@@ -3656,7 +3664,7 @@ so return the size on the remote host exactly. See RFC 3659."
 
   (or (file-exists-p filename)
       (signal 'file-error
-             (list "Copy file" "no such file or directory" filename)))
+             (list "Copy file" "No such file or directory" filename)))
 
   ;; canonicalize newname if a directory.
   (if (file-directory-p newname)
@@ -3855,7 +3863,7 @@ If VERBOSE-P is non-nil, print progress report in the echo area.
 FILES is a list of files to copy in the form
   (from-file to-file ok-if-already-exists keep-date)
 E.g.,
-  (ange-ftp-copy-files-async t nil t '((\"a\" \"b\" t t) (\"c\" \"d\" t t)))"
+  (ange-ftp-copy-files-async t nil t \\='((\"a\" \"b\" t t) (\"c\" \"d\" t t)))"
   (unless okay-p (error "%s: %s" 'ange-ftp-copy-files-async line))
   (if files
       (let* ((ff (car files))
@@ -4618,7 +4626,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
            (format  "%s %s \"%s\""     ; remsh -l USER does not work well
                                        ; on a hp-ux machine I tried
                     remote-shell-program host command))
-      (ange-ftp-message "Remote command '%s' ..." command)
+      (ange-ftp-message "Remote command `%s' ..." command)
       ;; Cannot call ange-ftp-real-dired-run-shell-command here as it
       ;; would prepend "cd default-directory" --- which bombs because
       ;; default-directory is in ange-ftp syntax for remote file names.
@@ -5970,7 +5978,7 @@ Other orders of $ and _ seem to all work just fine.")
 
 (defcustom ange-ftp-bs2000-special-prefix
   "X"
-  "Prefix used for filenames starting with '#' or '@'."
+  "Prefix used for filenames starting with `#' or `@'."
   :group 'ange-ftp
   :type 'string)