(x_new_font): Update f->scroll_bar_actual_width.
[bpt/emacs.git] / lisp / net / tramp-fish.el
index 95091c2..8db5dc8 100644 (file)
@@ -1,16 +1,16 @@
 ;;; tramp-fish.el --- Tramp access functions for FISH protocol
 
-;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,8 +18,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, see
-;; <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -210,7 +209,7 @@ Used instead of analyzing error codes of commands.")
     (directory-files-and-attributes . tramp-fish-handle-directory-files-and-attributes)
     ;; `dired-call-process' performed by default handler
     ;; `dired-compress-file' performed by default handler
-    ;; `dired-uncache' performed by default handler
+    (dired-uncache . tramp-handle-dired-uncache)
     (expand-file-name . tramp-fish-handle-expand-file-name)
     ;; `file-accessible-directory-p' performed by default handler
     (file-attributes . tramp-fish-handle-file-attributes)
@@ -221,7 +220,7 @@ Used instead of analyzing error codes of commands.")
     (file-remote-p . tramp-handle-file-remote-p)
     (file-modes . tramp-handle-file-modes)
     (file-name-all-completions . tramp-fish-handle-file-name-all-completions)
-    ;; `file-name-as-directory' performed by default handler
+    (file-name-as-directory . tramp-handle-file-name-as-directory)
     (file-name-completion . tramp-handle-file-name-completion)
     (file-name-directory . tramp-handle-file-name-directory)
     (file-name-nondirectory . tramp-handle-file-name-nondirectory)
@@ -313,10 +312,19 @@ pass to the OPERATION."
   (tramp-fish-do-copy-or-rename-file
    'copy filename newname ok-if-already-exists keep-date preserve-uid-gid))
 
-(defun tramp-fish-handle-delete-directory (directory)
+(defun tramp-fish-handle-delete-directory (directory &optional recursive)
   "Like `delete-directory' for Tramp files."
   (when (file-exists-p directory)
-    (with-parsed-tramp-file-name
+    (if recursive
+       (mapc
+        (lambda (file)
+          (if (file-directory-p file)
+              (tramp-compat-delete-directory file recursive)
+            (delete-file file)))
+        ;; We do not want to delete "." and "..".
+        (directory-files
+         directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
+     (with-parsed-tramp-file-name
        (directory-file-name (expand-file-name directory)) nil
       (tramp-flush-directory-property v localname)
       (tramp-fish-send-command-and-check v (format "#RMD %s" localname)))))
@@ -352,7 +360,7 @@ pass to the OPERATION."
        (tramp-run-real-handler 'expand-file-name (list name nil)))
     ;; Dissect NAME.
     (with-parsed-tramp-file-name name nil
-      (unless (file-name-absolute-p localname)
+      (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
        (setq localname (concat "~/" localname)))
       ;; Tilde expansion if necessary.
       (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
@@ -380,13 +388,13 @@ pass to the OPERATION."
       ;; would otherwise use backslash.  `default-directory' is
       ;; bound, because on Windows there would be problems with UNC
       ;; shares or Cygwin mounts.
-      (tramp-let-maybe directory-sep-char ?/
-       (let ((default-directory (tramp-compat-temporary-file-directory)))
-         (tramp-make-tramp-file-name
-          method user host
-          (tramp-drop-volume-letter
-           (tramp-run-real-handler 'expand-file-name
-                                   (list localname)))))))))
+      (let ((directory-sep-char ?/)
+           (default-directory (tramp-compat-temporary-file-directory)))
+       (tramp-make-tramp-file-name
+        method user host
+        (tramp-drop-volume-letter
+         (tramp-run-real-handler
+          'expand-file-name (list localname))))))))
 
 (defun tramp-fish-handle-file-attributes (filename &optional id-format)
   "Like `file-attributes' for Tramp files."
@@ -918,7 +926,7 @@ PRESERVE-UID-GID is completely ignored."
   (when (and keep-date (functionp 'set-file-times))
     (set-file-times newname (nth 5 (file-attributes filename))))
   ;; Set the mode.
-  (set-file-modes newname (file-modes filename)))
+  (set-file-modes newname (tramp-default-file-modes filename)))
 
 (defun tramp-fish-get-file-entries (vec localname list)
   "Read entries returned by FISH server.
@@ -1125,7 +1133,6 @@ connection if a previous connection has died for some reason."
        (tramp-message vec 6 "%s" (mapconcat 'identity (process-command p) " "))
 
        ;; Check whether process is alive.
-       (set-process-sentinel p 'tramp-flush-connection-property)
        (tramp-set-process-query-on-exit-flag p nil)
 
        (tramp-process-actions p vec tramp-actions-before-shell 60)