emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116491: * net/tramp.el (ls-lisp-use-insert-director


From: Michael Albinus
Subject: [Emacs-diffs] trunk r116491: * net/tramp.el (ls-lisp-use-insert-directory-program): Declare.
Date: Thu, 20 Feb 2014 14:24:24 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116491
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Thu 2014-02-20 15:24:13 +0100
message:
  * net/tramp.el (ls-lisp-use-insert-directory-program): Declare.
  (tramp-handle-insert-directory): New defun, taken from tramp-gvfs.el.
  
  * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist)
  [insert-directory]: Use `tramp-handle-insert-directory.
  (tramp-gvfs-handle-insert-directory): Remove function.
  
  * net/tramp-sh.el (tramp-sh-handle-insert-directory):
  Call `tramp-handle-insert-directory'.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/net/tramp-gvfs.el         
trampgvfs.el-20091113204419-o5vbwnq5f7feedwu-10898
  lisp/net/tramp-sh.el           trampsh.el-20100913133439-a1faifh29eqoi4nh-1
  lisp/net/tramp.el              tramp.el-20091113204419-o5vbwnq5f7feedwu-2427
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-02-20 10:33:32 +0000
+++ b/lisp/ChangeLog    2014-02-20 14:24:13 +0000
@@ -1,3 +1,15 @@
+2014-02-20  Michael Albinus  <address@hidden>
+
+       * net/tramp.el (ls-lisp-use-insert-directory-program): Declare.
+       (tramp-handle-insert-directory): New defun, taken from tramp-gvfs.el.
+
+       * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist)
+       [insert-directory]: Use `tramp-handle-insert-directory.
+       (tramp-gvfs-handle-insert-directory): Remove function.
+
+       * net/tramp-sh.el (tramp-sh-handle-insert-directory):
+       Call `tramp-handle-insert-directory'.
+
 2014-02-20  Juanma Barranquero  <address@hidden>
 
        * elec-pair.el (electric-pair-syntax-info): Do not check syntax

=== modified file 'lisp/net/tramp-gvfs.el'
--- a/lisp/net/tramp-gvfs.el    2014-02-19 19:24:32 +0000
+++ b/lisp/net/tramp-gvfs.el    2014-02-20 14:24:13 +0000
@@ -108,7 +108,6 @@
 (eval-when-compile
   (require 'cl)
   (require 'custom))
-(defvar ls-lisp-use-insert-directory-program)
 
 ;;;###tramp-autoload
 (defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce")
@@ -451,7 +450,7 @@
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `find-file-noselect' performed by default handler.
     ;; `get-file-buffer' performed by default handler.
-    (insert-directory . tramp-gvfs-handle-insert-directory)
+    (insert-directory . tramp-handle-insert-directory)
     (insert-file-contents . tramp-handle-insert-file-contents)
     (load . tramp-handle-load)
     (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
@@ -1006,19 +1005,6 @@
        (and (file-directory-p (file-name-directory filename))
             (file-writable-p (file-name-directory filename)))))))
 
-(defun tramp-gvfs-handle-insert-directory
-  (filename switches &optional wildcard full-directory-p)
-  "Like `insert-directory' for Tramp files."
-  ;; gvfs-* output is hard to parse.  So we let `ls-lisp' do the job.
-  (unless switches (setq switches ""))
-  (with-parsed-tramp-file-name (expand-file-name filename) nil
-    (with-tramp-progress-reporter v 0 (format "Opening directory %s" filename)
-      (require 'ls-lisp)
-      (let (ls-lisp-use-insert-directory-program)
-       (tramp-run-real-handler
-        'insert-directory
-        (list filename switches wildcard full-directory-p))))))
-
 (defun tramp-gvfs-handle-make-directory (dir &optional parents)
   "Like `make-directory' for Tramp files."
   (with-parsed-tramp-file-name dir nil

=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el      2014-02-19 19:24:32 +0000
+++ b/lisp/net/tramp-sh.el      2014-02-20 14:24:13 +0000
@@ -2516,8 +2516,8 @@
   (with-parsed-tramp-file-name filename nil
     (if (and (featurep 'ls-lisp)
             (not (symbol-value 'ls-lisp-use-insert-directory-program)))
-       (tramp-run-real-handler
-        'insert-directory (list filename switches wildcard full-directory-p))
+       (tramp-handle-insert-directory
+        filename switches wildcard full-directory-p)
       (when (stringp switches)
         (setq switches (split-string switches)))
       (when (and (member "--dired" switches)

=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2014-02-19 19:24:32 +0000
+++ b/lisp/net/tramp.el 2014-02-20 14:24:13 +0000
@@ -49,9 +49,8 @@
 ;;            http://lists.gnu.org/mailman/listinfo/tramp-devel
 ;;
 ;; For the adventurous, the current development sources are available
-;; via CVS.  You can find instructions about this at the following URL:
+;; via Git.  You can find instructions about this at the following URL:
 ;;            http://savannah.gnu.org/projects/tramp/
-;; Click on "CVS" in the navigation bar near the top.
 ;;
 ;; Don't forget to put on your asbestos longjohns, first!
 
@@ -66,6 +65,7 @@
 (defvar directory-sep-char)
 (defvar eshell-path-env)
 (defvar file-notify-descriptors)
+(defvar ls-lisp-use-insert-directory-program)
 (defvar outline-regexp)
 
 ;;; User Customizable Internal Variables:
@@ -3007,6 +3007,38 @@
 
       (tramp-run-real-handler 'find-backup-file-name (list filename)))))
 
+(defun tramp-handle-insert-directory
+  (filename switches &optional wildcard full-directory-p)
+  "Like `insert-directory' for Tramp files."
+  (unless switches (setq switches ""))
+  ;; Mark trailing "/".
+  (when (and (zerop (length (file-name-nondirectory filename)))
+            (not full-directory-p))
+    (setq switches (concat switches "F")))
+  (with-parsed-tramp-file-name (expand-file-name filename) nil
+    (with-tramp-progress-reporter v 0 (format "Opening directory %s" filename)
+      (require 'ls-lisp)
+      (let (ls-lisp-use-insert-directory-program start)
+       (tramp-run-real-handler
+        'insert-directory
+        (list filename switches wildcard full-directory-p))
+       ;; `ls-lisp' always returns full listings.  We must remove
+       ;; superfluous parts.
+       (unless (string-match "l" switches)
+         (save-excursion
+           (goto-char (point-min))
+           (while (setq start
+                        (text-property-not-all
+                         (point) (point-at-eol) 'dired-filename t))
+             (delete-region
+              start
+              (or (text-property-any start (point-at-eol) 'dired-filename t)
+                  (point-at-eol)))
+             (if (=  (point-at-bol) (point-at-eol))
+                 ;; Empty line.
+                 (delete-region (point) (progn (forward-line) (point)))
+               (forward-line)))))))))
+
 (defun tramp-handle-insert-file-contents
   (filename &optional visit beg end replace)
   "Like `insert-file-contents' for Tramp files."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]