aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2008-11-16 14:14:03 +0000
committerMichael Albinus2008-11-16 14:14:03 +0000
commitc0fc617049a3a605b81e5d7c73a6bffe39558eef (patch)
tree4162dd00f6911bf830b3ffeedab8e848be3cf581
parentaeeedf76d1c6df3666134e6750cd95be1bde4ac1 (diff)
downloademacs-c0fc617049a3a605b81e5d7c73a6bffe39558eef.tar.gz
emacs-c0fc617049a3a605b81e5d7c73a6bffe39558eef.zip
* net/tramp.el (tramp-handle-file-name-as-directory): New defun.
(tramp-file-name-handler-alist): Handle `file-name-as-directory'.
-rw-r--r--lisp/net/tramp.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 218cef7734e..1bf29697aff 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1726,11 +1726,12 @@ This string is passed to `format', so percent characters need to be doubled.")
1726This is used to map a mode number to a permission string.") 1726This is used to map a mode number to a permission string.")
1727 1727
1728;; New handlers should be added here. The following operations can be 1728;; New handlers should be added here. The following operations can be
1729;; handled using the normal primitives: file-name-as-directory, 1729;; handled using the normal primitives: file-name-sans-versions,
1730;; file-name-sans-versions, get-file-buffer. 1730;; get-file-buffer.
1731(defconst tramp-file-name-handler-alist 1731(defconst tramp-file-name-handler-alist
1732 '((load . tramp-handle-load) 1732 '((load . tramp-handle-load)
1733 (make-symbolic-link . tramp-handle-make-symbolic-link) 1733 (make-symbolic-link . tramp-handle-make-symbolic-link)
1734 (file-name-as-directory . tramp-handle-file-name-as-directory)
1734 (file-name-directory . tramp-handle-file-name-directory) 1735 (file-name-directory . tramp-handle-file-name-directory)
1735 (file-name-nondirectory . tramp-handle-file-name-nondirectory) 1736 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
1736 (file-truename . tramp-handle-file-truename) 1737 (file-truename . tramp-handle-file-truename)
@@ -2207,6 +2208,19 @@ target of the symlink differ."
2207 t))) 2208 t)))
2208 2209
2209;; Localname manipulation functions that grok Tramp localnames... 2210;; Localname manipulation functions that grok Tramp localnames...
2211(defun tramp-handle-file-name-as-directory (file)
2212 "Like `file-name-as-directory' but aware of Tramp files."
2213 ;; `file-name-as-directory' would be sufficient except localname is
2214 ;; the empty string.
2215 (let ((v (tramp-dissect-file-name file t)))
2216 ;; Run the command on the localname portion only.
2217 (tramp-make-tramp-file-name
2218 (tramp-file-name-method v)
2219 (tramp-file-name-user v)
2220 (tramp-file-name-host v)
2221 (tramp-run-real-handler
2222 'file-name-as-directory (list (or (tramp-file-name-localname v) ""))))))
2223
2210(defun tramp-handle-file-name-directory (file) 2224(defun tramp-handle-file-name-directory (file)
2211 "Like `file-name-directory' but aware of Tramp files." 2225 "Like `file-name-directory' but aware of Tramp files."
2212 ;; Everything except the last filename thing is the directory. We 2226 ;; Everything except the last filename thing is the directory. We
@@ -7556,7 +7570,6 @@ Only works for Bourne-like shells."
7556;; Functions for file-name-handler-alist: 7570;; Functions for file-name-handler-alist:
7557;; diff-latest-backup-file -- in diff.el 7571;; diff-latest-backup-file -- in diff.el
7558;; dired-uncache -- this will be needed when we do insert-directory caching 7572;; dired-uncache -- this will be needed when we do insert-directory caching
7559;; file-name-as-directory -- use primitive?
7560;; file-name-sans-versions -- use primitive? 7573;; file-name-sans-versions -- use primitive?
7561;; get-file-buffer -- use primitive 7574;; get-file-buffer -- use primitive
7562;; vc-registered 7575;; vc-registered