Mercurial > emacs
annotate lisp/net/tramp-smb.el @ 85282:f89fc9388782
(idlwave-complete-in-buffer): Use mapc rather than mapcar.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 13 Oct 2007 22:55:36 +0000 |
parents | a42b8750a992 |
children | 21983e7c844a bdb3fe0ba9fa |
rev | line source |
---|---|
82201 | 1 ;;; tramp-smb.el --- Tramp access functions for SMB servers |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
2 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
4 ;; 2007 Free Software Foundation, Inc. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
5 |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
6 ;; Author: Michael Albinus <michael.albinus@gmx.de> |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
7 ;; Keywords: comm, processes |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
8 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
10 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
78230
84cf1e2214c5
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77986
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
14 ;; any later version. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
15 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
20 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
22 ;; along with GNU Emacs; see the file COPYING. If not, see |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
23 ;; <http://www.gnu.org/licenses/>. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
24 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
25 ;;; Commentary: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
26 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
27 ;; Access functions for SMB servers like SAMBA or M$ Windows from Tramp. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
28 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
29 ;;; Code: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
30 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
31 (require 'tramp) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
32 (require 'tramp-cache) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84739
diff
changeset
|
33 (require 'tramp-compat) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
34 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
35 ;; Define SMB method ... |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
36 (defcustom tramp-smb-method "smb" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
37 "*Method to connect SAMBA and M$ SMB servers." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
38 :group 'tramp |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
39 :type 'string) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
40 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
41 ;; ... and add it to the method list. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
42 (add-to-list 'tramp-methods (cons tramp-smb-method nil)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
43 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
44 ;; Add a default for `tramp-default-method-alist'. Rule: If there is |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
45 ;; a domain in USER, it must be the SMB method. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
46 (add-to-list 'tramp-default-method-alist |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
47 `(nil "%" ,tramp-smb-method)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
48 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
49 ;; Add a default for `tramp-default-user-alist'. Rule: For the SMB method, |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
50 ;; the anonymous user is chosen. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
51 (add-to-list 'tramp-default-user-alist |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
52 `(,tramp-smb-method nil "")) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
53 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
54 ;; Add completion function for SMB method. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
55 (tramp-set-completion-function |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
56 tramp-smb-method |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
57 '((tramp-parse-netrc "~/.netrc"))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
58 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
59 (defcustom tramp-smb-program "smbclient" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
60 "*Name of SMB client to run." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
61 :group 'tramp |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
62 :type 'string) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
63 |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
64 (defconst tramp-smb-prompt "^smb: .+> \\|^\\s-+Server\\s-+Comment$" |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
65 "Regexp used as prompt in smbclient.") |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
66 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
67 (defconst tramp-smb-errors |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
68 ;; `regexp-opt' not possible because of first string. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
69 (mapconcat |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
70 'identity |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
71 '(;; Connection error / timeout |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
72 "Connection to \\S-+ failed" |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
73 "Read from server failed, maybe it closed the connection" |
84739
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
74 "Call timed out: server did not respond" |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
75 ;; Samba |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
76 "ERRDOS" |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
77 "ERRSRV" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
78 "ERRbadfile" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
79 "ERRbadpw" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
80 "ERRfilexists" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
81 "ERRnoaccess" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
82 "ERRnomem" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
83 "ERRnosuchshare" |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
84 ;; Windows 4.0 (Windows NT), Windows 5.0 (Windows 2000), |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
85 ;; Windows 5.1 (Windows XP), Windows 5.2 (Windows Server 2003) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
86 "NT_STATUS_ACCESS_DENIED" |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
87 "NT_STATUS_ACCOUNT_LOCKED_OUT" |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
88 "NT_STATUS_BAD_NETWORK_NAME" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
89 "NT_STATUS_CANNOT_DELETE" |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
90 "NT_STATUS_DIRECTORY_NOT_EMPTY" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
91 "NT_STATUS_DUPLICATE_NAME" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
92 "NT_STATUS_FILE_IS_A_DIRECTORY" |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
93 "NT_STATUS_LOGON_FAILURE" |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
94 "NT_STATUS_NETWORK_ACCESS_DENIED" |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
95 "NT_STATUS_NO_SUCH_FILE" |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
96 "NT_STATUS_OBJECT_NAME_COLLISION" |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
97 "NT_STATUS_OBJECT_NAME_INVALID" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
98 "NT_STATUS_OBJECT_NAME_NOT_FOUND" |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
99 "NT_STATUS_SHARING_VIOLATION" |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
100 "NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE" |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
101 "NT_STATUS_WRONG_PASSWORD") |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
102 "\\|") |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
103 "Regexp for possible error strings of SMB servers. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
104 Used instead of analyzing error codes of commands.") |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
105 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
106 (defconst tramp-smb-actions-with-share |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
107 '((tramp-smb-prompt tramp-action-succeed) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
108 (tramp-password-prompt-regexp tramp-action-password) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
109 (tramp-wrong-passwd-regexp tramp-action-permission-denied) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
110 (tramp-smb-errors tramp-action-permission-denied) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
111 (tramp-process-alive-regexp tramp-action-process-alive)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
112 "List of pattern/action pairs. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
113 This list is used for login to SMB servers. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
114 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
115 See `tramp-actions-before-shell' for more info.") |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
116 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
117 (defconst tramp-smb-actions-without-share |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
118 '((tramp-password-prompt-regexp tramp-action-password) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
119 (tramp-wrong-passwd-regexp tramp-action-permission-denied) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
120 (tramp-smb-errors tramp-action-permission-denied) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
121 (tramp-process-alive-regexp tramp-action-out-of-band)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
122 "List of pattern/action pairs. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
123 This list is used for login to SMB servers. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
124 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
125 See `tramp-actions-before-shell' for more info.") |
49612
407d6516031a
2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49598
diff
changeset
|
126 |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
127 ;; New handlers should be added here. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
128 (defconst tramp-smb-file-name-handler-alist |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
129 '( |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
130 ;; `access-file' performed by default handler |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
131 (add-name-to-file . tramp-smb-handle-copy-file) ;; we're on Windows, honey. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
132 ;; `byte-compiler-base-file-name' performed by default handler |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
133 (copy-file . tramp-smb-handle-copy-file) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
134 (delete-directory . tramp-smb-handle-delete-directory) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
135 (delete-file . tramp-smb-handle-delete-file) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
136 ;; `diff-latest-backup-file' performed by default handler |
49612
407d6516031a
2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49598
diff
changeset
|
137 (directory-file-name . tramp-handle-directory-file-name) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
138 (directory-files . tramp-smb-handle-directory-files) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
139 (directory-files-and-attributes . tramp-smb-handle-directory-files-and-attributes) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
140 (dired-call-process . ignore) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
141 (dired-compress-file . ignore) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
142 ;; `dired-uncache' performed by default handler |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
143 ;; `expand-file-name' not necessary because we cannot expand "~/" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
144 (file-accessible-directory-p . tramp-smb-handle-file-directory-p) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
145 (file-attributes . tramp-smb-handle-file-attributes) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
146 (file-directory-p . tramp-smb-handle-file-directory-p) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
147 (file-executable-p . tramp-smb-handle-file-exists-p) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
148 (file-exists-p . tramp-smb-handle-file-exists-p) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
149 (file-local-copy . tramp-smb-handle-file-local-copy) |
55844
4bc6cb45c326
Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents:
55420
diff
changeset
|
150 (file-remote-p . tramp-handle-file-remote-p) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
151 (file-modes . tramp-handle-file-modes) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
152 (file-name-all-completions . tramp-smb-handle-file-name-all-completions) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
153 ;; `file-name-as-directory' performed by default handler |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
154 (file-name-completion . tramp-handle-file-name-completion) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
155 (file-name-directory . tramp-handle-file-name-directory) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
156 (file-name-nondirectory . tramp-handle-file-name-nondirectory) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
157 ;; `file-name-sans-versions' performed by default handler |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
158 (file-newer-than-file-p . tramp-smb-handle-file-newer-than-file-p) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
159 (file-ownership-preserved-p . ignore) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
160 (file-readable-p . tramp-smb-handle-file-exists-p) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
161 (file-regular-p . tramp-handle-file-regular-p) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
162 (file-symlink-p . tramp-handle-file-symlink-p) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
163 ;; `file-truename' performed by default handler |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
164 (file-writable-p . tramp-smb-handle-file-writable-p) |
55420
c44f9de543e3
2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
54198
diff
changeset
|
165 (find-backup-file-name . tramp-handle-find-backup-file-name) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
166 ;; `find-file-noselect' performed by default handler |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
167 ;; `get-file-buffer' performed by default handler |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
168 (insert-directory . tramp-smb-handle-insert-directory) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
169 (insert-file-contents . tramp-handle-insert-file-contents) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
170 (load . tramp-handle-load) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
171 (make-directory . tramp-smb-handle-make-directory) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
172 (make-directory-internal . tramp-smb-handle-make-directory-internal) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
173 (make-symbolic-link . ignore) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
174 (rename-file . tramp-smb-handle-rename-file) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
175 (set-file-modes . ignore) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
176 (set-visited-file-modtime . ignore) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
177 (shell-command . ignore) |
59582
92796330257a
Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents:
59031
diff
changeset
|
178 (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
179 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
180 (vc-registered . ignore) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
181 (verify-visited-file-modtime . ignore) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
182 (write-region . tramp-smb-handle-write-region) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
183 ) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
184 "Alist of handler functions for Tramp SMB method. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
185 Operations not mentioned here will be handled by the default Emacs primitives.") |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
186 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
187 (defun tramp-smb-file-name-p (filename) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
188 "Check if it's a filename for SMB servers." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
189 (let ((v (tramp-dissect-file-name filename))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
190 (string= (tramp-file-name-method v) tramp-smb-method))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
191 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
192 (defun tramp-smb-file-name-handler (operation &rest args) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
193 "Invoke the SMB related OPERATION. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
194 First arg specifies the OPERATION, second arg is a list of arguments to |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
195 pass to the OPERATION." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
196 (let ((fn (assoc operation tramp-smb-file-name-handler-alist))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
197 (if fn |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
198 (save-match-data (apply (cdr fn) args)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
199 (tramp-run-real-handler operation args)))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
200 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
201 (add-to-list 'tramp-foreign-file-name-handler-alist |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
202 (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
203 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
204 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
205 ;; File name primitives |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
206 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
207 (defun tramp-smb-handle-copy-file |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
208 (filename newname &optional ok-if-already-exists keep-date) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
209 "Like `copy-file' for Tramp files. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
210 KEEP-DATE is not handled in case NEWNAME resides on an SMB server." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
211 (setq filename (expand-file-name filename) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
212 newname (expand-file-name newname)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
213 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
214 (let ((tmpfile (file-local-copy filename))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
215 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
216 (if tmpfile |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
217 ;; Remote filename. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
218 (rename-file tmpfile newname ok-if-already-exists) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
219 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
220 ;; Remote newname. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
221 (when (file-directory-p newname) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
222 (setq newname (expand-file-name |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
223 (file-name-nondirectory filename) newname))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
224 |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
225 (with-parsed-tramp-file-name newname nil |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
226 (when (and (not ok-if-already-exists) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
227 (file-exists-p newname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
228 (tramp-error v 'file-already-exists newname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
229 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
230 ;; We must also flush the cache of the directory, because |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
231 ;; file-attributes reads the values from there. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
232 (tramp-flush-file-property v (file-name-directory localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
233 (tramp-flush-file-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
234 (let ((share (tramp-smb-get-share localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
235 (file (tramp-smb-get-localname localname t))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
236 (unless share |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
237 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
238 v 'file-error "Target `%s' must contain a share name" newname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
239 (tramp-message v 0 "Copying file %s to file %s..." filename newname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
240 (if (tramp-smb-send-command |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
241 v (format "put %s \"%s\"" filename file)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
242 (tramp-message |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
243 v 0 "Copying file %s to file %s...done" filename newname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
244 (tramp-error v 'file-error "Cannot copy `%s'" filename))))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
245 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
246 (defun tramp-smb-handle-delete-directory (directory) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
247 "Like `delete-directory' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
248 (setq directory (directory-file-name (expand-file-name directory))) |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
249 (when (file-exists-p directory) |
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
250 (with-parsed-tramp-file-name directory nil |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
251 ;; We must also flush the cache of the directory, because |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
252 ;; file-attributes reads the values from there. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
253 (tramp-flush-file-property v (file-name-directory localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
254 (tramp-flush-directory-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
255 (let ((dir (tramp-smb-get-localname (file-name-directory localname) t)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
256 (file (file-name-nondirectory localname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
257 (unwind-protect |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
258 (unless (and |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
259 (tramp-smb-send-command v (format "cd \"%s\"" dir)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
260 (tramp-smb-send-command v (format "rmdir \"%s\"" file))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
261 ;; Error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
262 (with-current-buffer (tramp-get-connection-buffer v) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
263 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
264 (search-forward-regexp tramp-smb-errors nil t) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
265 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
266 v 'file-error "%s `%s'" (match-string 0) directory))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
267 ;; Always go home |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
268 (tramp-smb-send-command v (format "cd \\"))))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
269 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
270 (defun tramp-smb-handle-delete-file (filename) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
271 "Like `delete-file' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
272 (setq filename (expand-file-name filename)) |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
273 (when (file-exists-p filename) |
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
274 (with-parsed-tramp-file-name filename nil |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
275 ;; We must also flush the cache of the directory, because |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
276 ;; file-attributes reads the values from there. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
277 (tramp-flush-file-property v (file-name-directory localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
278 (tramp-flush-file-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
279 (let ((dir (tramp-smb-get-localname (file-name-directory localname) t)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
280 (file (file-name-nondirectory localname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
281 (unwind-protect |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
282 (unless (and |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
283 (tramp-smb-send-command v (format "cd \"%s\"" dir)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
284 (tramp-smb-send-command v (format "rm \"%s\"" file))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
285 ;; Error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
286 (with-current-buffer (tramp-get-connection-buffer v) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
287 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
288 (search-forward-regexp tramp-smb-errors nil t) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
289 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
290 v 'file-error "%s `%s'" (match-string 0) filename))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
291 ;; Always go home |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
292 (tramp-smb-send-command v (format "cd \\"))))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
293 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
294 (defun tramp-smb-handle-directory-files |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
295 (directory &optional full match nosort) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
296 "Like `directory-files' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
297 (let ((result (mapcar 'directory-file-name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
298 (file-name-all-completions "" directory)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
299 ;; Discriminate with regexp |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
300 (when match |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
301 (setq result |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
302 (delete nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
303 (mapcar (lambda (x) (when (string-match match x) x)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
304 result)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
305 ;; Append directory |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
306 (when full |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
307 (setq result |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
308 (mapcar |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
309 (lambda (x) (expand-file-name x directory)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
310 result))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
311 ;; Sort them if necessary |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
312 (unless nosort (setq result (sort result 'string-lessp))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
313 ;; That's it |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
314 result)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
315 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
316 (defun tramp-smb-handle-directory-files-and-attributes |
53206
0c19f1a19b2b
(tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
52401
diff
changeset
|
317 (directory &optional full match nosort id-format) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
318 "Like `directory-files-and-attributes' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
319 (mapcar |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
320 (lambda (x) |
53206
0c19f1a19b2b
(tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
52401
diff
changeset
|
321 ;; We cannot call `file-attributes' for backward compatibility reasons. |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
322 ;; Its optional parameter ID-FORMAT is introduced with Emacs 22. |
53206
0c19f1a19b2b
(tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
52401
diff
changeset
|
323 (cons x (tramp-smb-handle-file-attributes |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
324 (if full x (expand-file-name x directory)) id-format))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
325 (directory-files directory full match nosort))) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59582
diff
changeset
|
326 |
53206
0c19f1a19b2b
(tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
52401
diff
changeset
|
327 (defun tramp-smb-handle-file-attributes (filename &optional id-format) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
328 "Like `file-attributes' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
329 ;; Reading just the filename entry via "dir localname" is not |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
330 ;; possible, because when filename is a directory, some smbclient |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
331 ;; versions return the content of the directory, and other versions |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
332 ;; don't. Therefore, the whole content of the upper directory is |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
333 ;; retrieved, and the entry of the filename is extracted from. |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
334 (with-parsed-tramp-file-name filename nil |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
335 (with-file-property v localname (format "file-attributes-%s" id-format) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
336 (let* ((entries (tramp-smb-get-file-entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
337 (file-name-directory filename))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
338 (entry (and entries |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
339 (assoc (file-name-nondirectory filename) entries))) |
53206
0c19f1a19b2b
(tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
52401
diff
changeset
|
340 (uid (if (and id-format (equal id-format 'string)) "nobody" -1)) |
0c19f1a19b2b
(tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
52401
diff
changeset
|
341 (gid (if (and id-format (equal id-format 'string)) "nogroup" -1)) |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81758
diff
changeset
|
342 (inode (tramp-get-inode v)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
343 (device (tramp-get-device v))) |
49612
407d6516031a
2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49598
diff
changeset
|
344 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
345 ;; Check result. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
346 (when entry |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
347 (list (and (string-match "d" (nth 1 entry)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
348 t) ;0 file type |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
349 -1 ;1 link count |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
350 uid ;2 uid |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
351 gid ;3 gid |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
352 '(0 0) ;4 atime |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
353 (nth 3 entry) ;5 mtime |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
354 '(0 0) ;6 ctime |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
355 (nth 2 entry) ;7 size |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
356 (nth 1 entry) ;8 mode |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
357 nil ;9 gid weird |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
358 inode ;10 inode number |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
359 device)))))) ;11 file system number |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
360 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
361 (defun tramp-smb-handle-file-directory-p (filename) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
362 "Like `file-directory-p' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
363 (and (file-exists-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
364 (eq ?d (aref (nth 8 (file-attributes filename)) 0)))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
365 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
366 (defun tramp-smb-handle-file-exists-p (filename) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
367 "Like `file-exists-p' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
368 (not (null (file-attributes filename)))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
369 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
370 (defun tramp-smb-handle-file-local-copy (filename) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
371 "Like `file-local-copy' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
372 (with-parsed-tramp-file-name filename nil |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
373 (let ((file (tramp-smb-get-localname localname t)) |
85041
a42b8750a992
* net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
85024
diff
changeset
|
374 (tmpfile (tramp-compat-make-temp-file filename))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
375 (unless (file-exists-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
376 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
377 v 'file-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
378 "Cannot make local copy of non-existing file `%s'" filename)) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
379 (tramp-message v 4 "Fetching %s to tmp file %s..." filename tmpfile) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
380 (if (tramp-smb-send-command v (format "get \"%s\" %s" file tmpfile)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
381 (tramp-message |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
382 v 4 "Fetching %s to tmp file %s...done" filename tmpfile) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
383 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
384 v 'file-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
385 "Cannot make local copy of file `%s'" filename)) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
386 tmpfile))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
387 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
388 ;; This function should return "foo/" for directories and "bar" for |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
389 ;; files. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
390 (defun tramp-smb-handle-file-name-all-completions (filename directory) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
391 "Like `file-name-all-completions' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
392 (all-completions |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
393 filename |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
394 (with-parsed-tramp-file-name directory nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
395 (with-file-property v localname "file-name-all-completions" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
396 (save-match-data |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
397 (let ((entries (tramp-smb-get-file-entries directory))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
398 (mapcar |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
399 (lambda (x) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
400 (list |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
401 (if (string-match "d" (nth 1 x)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
402 (file-name-as-directory (nth 0 x)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
403 (nth 0 x)))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
404 entries))))))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
405 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
406 (defun tramp-smb-handle-file-newer-than-file-p (file1 file2) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
407 "Like `file-newer-than-file-p' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
408 (cond |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
409 ((not (file-exists-p file1)) nil) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
410 ((not (file-exists-p file2)) t) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
411 (t (tramp-time-less-p (nth 5 (file-attributes file2)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
412 (nth 5 (file-attributes file1)))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
413 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
414 (defun tramp-smb-handle-file-writable-p (filename) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
415 "Like `file-writable-p' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
416 (if (file-exists-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
417 (string-match "w" (or (nth 8 (file-attributes filename)) "")) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
418 (let ((dir (file-name-directory filename))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
419 (and (file-exists-p dir) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
420 (file-writable-p dir))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
421 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
422 (defun tramp-smb-handle-insert-directory |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
423 (filename switches &optional wildcard full-directory-p) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
424 "Like `insert-directory' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
425 (setq filename (expand-file-name filename)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
426 (when full-directory-p |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
427 ;; Called from `dired-add-entry'. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
428 (setq filename (file-name-as-directory filename))) |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
429 (with-parsed-tramp-file-name filename nil |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
430 (tramp-flush-file-property v (file-name-directory localname)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
431 (save-match-data |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
432 (let ((base (file-name-nondirectory filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
433 ;; We should not destroy the cache entry. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
434 (entries (copy-sequence |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
435 (tramp-smb-get-file-entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
436 (file-name-directory filename))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
437 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
438 (when wildcard |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
439 (string-match "\\." base) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
440 (setq base (replace-match "\\\\." nil nil base)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
441 (string-match "\\*" base) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
442 (setq base (replace-match ".*" nil nil base)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
443 (string-match "\\?" base) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
444 (setq base (replace-match ".?" nil nil base))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
445 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
446 ;; Filter entries. |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59582
diff
changeset
|
447 (setq entries |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
448 (delq |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
449 nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
450 (if (or wildcard (zerop (length base))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
451 ;; Check for matching entries. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
452 (mapcar |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
453 (lambda (x) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
454 (when (string-match |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
455 (format "^%s" base) (nth 0 x)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
456 x)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
457 entries) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
458 ;; We just need the only and only entry FILENAME. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
459 (list (assoc base entries))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
460 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
461 ;; Sort entries |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
462 (setq entries |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
463 (sort |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
464 entries |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
465 (lambda (x y) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
466 (if (string-match "t" switches) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
467 ;; Sort by date. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
468 (tramp-time-less-p (nth 3 y) (nth 3 x)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
469 ;; Sort by name. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
470 (string-lessp (nth 0 x) (nth 0 y)))))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
471 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
472 ;; Print entries. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
473 (mapcar |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
474 (lambda (x) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
475 (when (not (zerop (length (nth 0 x)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
476 (insert |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
477 (format |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
478 "%10s %3d %-8s %-8s %8s %s %s\n" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
479 (nth 1 x) ; mode |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
480 1 "nobody" "nogroup" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
481 (nth 2 x) ; size |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
482 (format-time-string |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
483 (if (tramp-time-less-p |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
484 (tramp-time-subtract (current-time) (nth 3 x)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
485 tramp-half-a-year) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
486 "%b %e %R" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
487 "%b %e %Y") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
488 (nth 3 x)) ; date |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
489 (nth 0 x))) ; file name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
490 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
491 (beginning-of-line))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
492 entries))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
493 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
494 (defun tramp-smb-handle-make-directory (dir &optional parents) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
495 "Like `make-directory' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
496 (setq dir (directory-file-name (expand-file-name dir))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
497 (unless (file-name-absolute-p dir) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
498 (setq dir (expand-file-name dir default-directory))) |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
499 (with-parsed-tramp-file-name dir nil |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
500 (save-match-data |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
501 (let* ((share (tramp-smb-get-share localname)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
502 (ldir (file-name-directory dir))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
503 ;; Make missing directory parts |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
504 (when (and parents share (not (file-directory-p ldir))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
505 (make-directory ldir parents)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
506 ;; Just do it |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
507 (when (file-directory-p ldir) |
49612
407d6516031a
2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49598
diff
changeset
|
508 (make-directory-internal dir)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
509 (unless (file-directory-p dir) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
510 (tramp-error v 'file-error "Couldn't make directory %s" dir)))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
511 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
512 (defun tramp-smb-handle-make-directory-internal (directory) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
513 "Like `make-directory-internal' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
514 (setq directory (directory-file-name (expand-file-name directory))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
515 (unless (file-name-absolute-p directory) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
516 (setq directory (expand-file-name directory default-directory))) |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
517 (with-parsed-tramp-file-name directory nil |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
518 (save-match-data |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
519 (let* ((file (tramp-smb-get-localname localname t))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
520 (when (file-directory-p (file-name-directory directory)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
521 (tramp-smb-send-command v (format "mkdir \"%s\"" file)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
522 ;; We must also flush the cache of the directory, because |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
523 ;; file-attributes reads the values from there. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
524 (tramp-flush-file-property v (file-name-directory localname))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
525 (unless (file-directory-p directory) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
526 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
527 v 'file-error "Couldn't make directory %s" directory)))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
528 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
529 (defun tramp-smb-handle-rename-file |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
530 (filename newname &optional ok-if-already-exists) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
531 "Like `rename-file' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
532 (setq filename (expand-file-name filename) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
533 newname (expand-file-name newname)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
534 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
535 (let ((tmpfile (file-local-copy filename))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
536 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
537 (if tmpfile |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
538 ;; remote filename |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
539 (rename-file tmpfile newname ok-if-already-exists) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
540 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
541 ;; remote newname |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
542 (when (file-directory-p newname) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
543 (setq newname (expand-file-name |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
544 (file-name-nondirectory filename) newname))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
545 |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
546 (with-parsed-tramp-file-name newname nil |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
547 (when (and (not ok-if-already-exists) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
548 (file-exists-p newname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
549 (tramp-error v 'file-already-exists newname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
550 ;; We must also flush the cache of the directory, because |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
551 ;; file-attributes reads the values from there. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
552 (tramp-flush-file-property v (file-name-directory localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
553 (tramp-flush-file-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
554 (let ((file (tramp-smb-get-localname localname t))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
555 (tramp-message v 0 "Copying file %s to file %s..." filename newname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
556 (if (tramp-smb-send-command v (format "put %s \"%s\"" filename file)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
557 (tramp-message |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
558 v 0 "Copying file %s to file %s...done" filename newname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
559 (tramp-error v 'file-error "Cannot rename `%s'" filename)))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
560 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
561 (delete-file filename)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
562 |
59582
92796330257a
Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents:
59031
diff
changeset
|
563 (defun tramp-smb-handle-substitute-in-file-name (filename) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
564 "Like `handle-substitute-in-file-name' for Tramp files. |
59582
92796330257a
Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents:
59031
diff
changeset
|
565 Catches errors for shares like \"C$/\", which are common in Microsoft Windows." |
92796330257a
Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents:
59031
diff
changeset
|
566 (condition-case nil |
92796330257a
Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents:
59031
diff
changeset
|
567 (tramp-run-real-handler 'substitute-in-file-name (list filename)) |
92796330257a
Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents:
59031
diff
changeset
|
568 (error filename))) |
92796330257a
Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents:
59031
diff
changeset
|
569 |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
570 (defun tramp-smb-handle-write-region |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
571 (start end filename &optional append visit lockname confirm) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
572 "Like `write-region' for Tramp files." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
573 (setq filename (expand-file-name filename)) |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
574 (with-parsed-tramp-file-name filename nil |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
575 (unless (eq append nil) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
576 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
577 v 'file-error "Cannot append to file using tramp (`%s')" filename)) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
578 ;; XEmacs takes a coding system as the seventh argument, not `confirm'. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
579 (when (and (not (featurep 'xemacs)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
580 confirm (file-exists-p filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
581 (unless (y-or-n-p (format "File %s exists; overwrite anyway? " |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
582 filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
583 (tramp-error v 'file-error "File not overwritten"))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
584 ;; We must also flush the cache of the directory, because |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
585 ;; file-attributes reads the values from there. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
586 (tramp-flush-file-property v (file-name-directory localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
587 (tramp-flush-file-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
588 (let ((file (tramp-smb-get-localname localname t)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
589 (curbuf (current-buffer)) |
85041
a42b8750a992
* net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
85024
diff
changeset
|
590 (tmpfile (tramp-compat-make-temp-file filename))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
591 ;; We say `no-message' here because we don't want the visited file |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
592 ;; modtime data to be clobbered from the temp file. We call |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
593 ;; `set-visited-file-modtime' ourselves later on. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
594 (tramp-run-real-handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
595 'write-region |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
596 (if confirm ; don't pass this arg unless defined for backward compat. |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
597 (list start end tmpfile append 'no-message lockname confirm) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
598 (list start end tmpfile append 'no-message lockname))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
599 |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
600 (tramp-message v 5 "Writing tmp file %s to file %s..." tmpfile filename) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
601 (if (tramp-smb-send-command v (format "put %s \"%s\"" tmpfile file)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
602 (tramp-message |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
603 v 5 "Writing tmp file %s to file %s...done" tmpfile filename) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
604 (tramp-error v 'file-error "Cannot write `%s'" filename)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
605 |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
606 (delete-file tmpfile) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
607 (unless (equal curbuf (current-buffer)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
608 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
609 v 'file-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
610 "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
611 (when (eq visit t) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
612 (set-visited-file-modtime))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
613 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
614 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
615 ;; Internal file name functions |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
616 |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
617 (defun tramp-smb-get-share (localname) |
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
618 "Returns the share name of LOCALNAME." |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
619 (save-match-data |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
620 (when (string-match "^/?\\([^/]+\\)/" localname) |
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
621 (match-string 1 localname)))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
622 |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
623 (defun tramp-smb-get-localname (localname convert) |
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
624 "Returns the file name of LOCALNAME. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
625 If CONVERT is non-nil exchange \"/\" by \"\\\\\"." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
626 (save-match-data |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
627 (let ((res localname)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
628 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
629 (setq |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
630 res (if (string-match "^/?[^/]+/\\(.*\\)" res) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
631 (if convert |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
632 (mapconcat |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
633 (lambda (x) (if (equal x ?/) "\\" (char-to-string x))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
634 (match-string 1 res) "") |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
635 (match-string 1 res)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
636 (if (string-match "^/?\\([^/]+\\)$" res) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
637 (match-string 1 res) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
638 ""))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
639 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
640 ;; Sometimes we have discarded `substitute-in-file-name' |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
641 (when (string-match "\\(\\$\\$\\)\\(/\\|$\\)" res) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
642 (setq res (replace-match "$" nil nil res 1))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
643 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
644 res))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
645 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
646 ;; Share names of a host are cached. It is very unlikely that the |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
647 ;; shares do change during connection. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
648 (defun tramp-smb-get-file-entries (directory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
649 "Read entries which match DIRECTORY. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
650 Either the shares are listed, or the `dir' command is executed. |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
651 Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)." |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
652 (with-parsed-tramp-file-name directory nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
653 (setq localname (or localname "/")) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
654 (with-file-property v localname "file-entries" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
655 (with-current-buffer (tramp-get-buffer v) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
656 (let* ((share (tramp-smb-get-share localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
657 (file (tramp-smb-get-localname localname nil)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
658 (cache (tramp-get-connection-property v "share-cache" nil)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
659 res entry) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
660 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
661 (if (and (not share) cache) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
662 ;; Return cached shares |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
663 (setq res cache) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
664 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
665 ;; Read entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
666 (setq file (file-name-as-directory file)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
667 (when (string-match "^\\./" file) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
668 (setq file (substring file 1))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
669 (if share |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
670 (tramp-smb-send-command v (format "dir \"%s*\"" file)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
671 ;; `tramp-smb-maybe-open-connection' lists also the share names |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
672 (tramp-smb-maybe-open-connection v)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
673 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
674 ;; Loop the listing |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
675 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
676 (unless (re-search-forward tramp-smb-errors nil t) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
677 (while (not (eobp)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
678 (setq entry (tramp-smb-read-file-entry share)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
679 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
680 (when entry (add-to-list 'res entry)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
681 |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
682 ;; Cache share entries |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
683 (unless share |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
684 (tramp-set-connection-property v "share-cache" res))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
685 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
686 ;; Add directory itself |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
687 (add-to-list 'res '("" "drwxrwxrwx" 0 (0 0))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
688 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
689 ;; There's a very strange error (debugged with XEmacs 21.4.14) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
690 ;; If there's no short delay, it returns nil. No idea about. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
691 (when (featurep 'xemacs) (sleep-for 0.01)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
692 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
693 ;; Return entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
694 (delq nil res)))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
695 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
696 ;; Return either a share name (if SHARE is nil), or a file name |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
697 ;; |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
698 ;; If shares are listed, the following format is expected |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
699 ;; |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
700 ;; \s-\{8,8} - leading spaces |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
701 ;; \S-\(.*\S-\)\s-* - share name, 14 char |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
702 ;; \s- - space delimeter |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
703 ;; \S-+\s-* - type, 8 char, "Disk " expected |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
704 ;; \(\s-\{2,2\}.*\)? - space delimeter, comment |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
705 ;; |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
706 ;; Entries provided by smbclient DIR aren't fully regular. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
707 ;; They should have the format |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
708 ;; |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
709 ;; \s-\{2,2} - leading spaces |
50338
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
710 ;; \S-\(.*\S-\)\s-* - file name, 30 chars, left bound |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
711 ;; \s-+[ADHRSV]* - permissions, 7 chars, right bound |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
712 ;; \s- - space delimeter |
50338
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
713 ;; \s-+[0-9]+ - size, 8 chars, right bound |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
714 ;; \s-\{2,2\} - space delimeter |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
715 ;; \w\{3,3\} - weekday |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
716 ;; \s- - space delimeter |
50338
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
717 ;; \w\{3,3\} - month |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
718 ;; \s- - space delimeter |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
719 ;; [ 12][0-9] - day |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
720 ;; \s- - space delimeter |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
721 ;; [0-9]\{2,2\}:[0-9]\{2,2\}:[0-9]\{2,2\} - time |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
722 ;; \s- - space delimeter |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
723 ;; [0-9]\{4,4\} - year |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
724 ;; |
50338
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
725 ;; samba/src/client.c (http://samba.org/doxygen/samba/client_8c-source.html) |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
726 ;; has function display_finfo: |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
727 ;; |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
728 ;; d_printf(" %-30s%7.7s %8.0f %s", |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
729 ;; finfo->name, |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
730 ;; attrib_string(finfo->mode), |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
731 ;; (double)finfo->size, |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
732 ;; asctime(LocalTime(&t))); |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
733 ;; |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
734 ;; in Samba 1.9, there's the following code: |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
735 ;; |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
736 ;; DEBUG(0,(" %-30s%7.7s%10d %s", |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
737 ;; CNV_LANG(finfo->name), |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
738 ;; attrib_string(finfo->mode), |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
739 ;; finfo->size, |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
740 ;; asctime(LocalTime(&t)))); |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
741 ;; |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
742 ;; Problems: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
743 ;; * Modern regexp constructs, like spy groups and counted repetitions, aren't |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
744 ;; available in older Emacsen. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
745 ;; * The length of constructs (file name, size) might exceed the default. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
746 ;; * File names might contain spaces. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
747 ;; * Permissions might be empty. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
748 ;; |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
749 ;; So we try to analyze backwards. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
750 (defun tramp-smb-read-file-entry (share) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
751 "Parse entry in SMB output buffer. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
752 If SHARE is result, entries are of type dir. Otherwise, shares are listed. |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
753 Result is the list (LOCALNAME MODE SIZE MTIME)." |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
754 ;; We are called from `tramp-smb-get-file-entries', which sets the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
755 ;; current buffer. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84739
diff
changeset
|
756 (let ((line (buffer-substring (point) (tramp-compat-line-end-position))) |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
757 localname mode size month day hour min sec year mtime) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
758 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
759 (if (not share) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
760 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
761 ;; Read share entries. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
762 (when (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-+Disk" line) |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
763 (setq localname (match-string 1 line) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
764 mode "dr-xr-xr-x" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
765 size 0)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
766 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
767 ;; Real listing. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
768 (block nil |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
769 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
770 ;; year |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
771 (if (string-match "\\([0-9]+\\)$" line) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
772 (setq year (string-to-number (match-string 1 line)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
773 line (substring line 0 -5)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
774 (return)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
775 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
776 ;; time |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
777 (if (string-match "\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)$" line) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
778 (setq hour (string-to-number (match-string 1 line)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
779 min (string-to-number (match-string 2 line)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
780 sec (string-to-number (match-string 3 line)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
781 line (substring line 0 -9)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
782 (return)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
783 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
784 ;; day |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
785 (if (string-match "\\([0-9]+\\)$" line) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
786 (setq day (string-to-number (match-string 1 line)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
787 line (substring line 0 -3)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
788 (return)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
789 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
790 ;; month |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
791 (if (string-match "\\(\\w+\\)$" line) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
792 (setq month (match-string 1 line) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
793 line (substring line 0 -4)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
794 (return)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
795 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
796 ;; weekday |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
797 (if (string-match "\\(\\w+\\)$" line) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
798 (setq line (substring line 0 -5)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
799 (return)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
800 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
801 ;; size |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
802 (if (string-match "\\([0-9]+\\)$" line) |
50338
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
803 (let ((length (- (max 10 (1+ (length (match-string 1 line))))))) |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
804 (setq size (string-to-number (match-string 1 line))) |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
805 (when (string-match "\\([ADHRSV]+\\)" (substring line length)) |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
806 (setq length (+ length (match-end 0)))) |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
807 (setq line (substring line 0 length))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
808 (return)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
809 |
50338
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
810 ;; mode: ARCH, DIR, HIDDEN, RONLY, SYSTEM, VOLID |
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
811 (if (string-match "\\([ADHRSV]+\\)?$" line) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
812 (setq |
50338
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
813 mode (or (match-string 1 line) "") |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
814 mode (save-match-data (format |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
815 "%s%s" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
816 (if (string-match "D" mode) "d" "-") |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
817 (mapconcat |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
818 (lambda (x) "") " " |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
819 (concat "r" (if (string-match "R" mode) "-" "w") "x")))) |
50338
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
820 line (substring line 0 -7)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
821 (return)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
822 |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
823 ;; localname |
50338
155b4b78aa3b
* tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49995
diff
changeset
|
824 (if (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-*$" line) |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
825 (setq localname (match-string 1 line)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
826 (return)))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
827 |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
828 (when (and localname mode size) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
829 (setq mtime |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
830 (if (and sec min hour day month year) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
831 (encode-time |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
832 sec min hour day |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
833 (cdr (assoc (downcase month) tramp-parse-time-months)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
834 year) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
835 '(0 0))) |
49995
a0e8a85259ed
Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
836 (list localname mode size mtime)))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
837 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
838 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
839 ;; Connection functions |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
840 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
841 (defun tramp-smb-send-command (vec command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
842 "Send the COMMAND to connection VEC. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
843 Returns nil if there has been an error message from smbclient." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
844 (tramp-smb-maybe-open-connection vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
845 (tramp-message vec 6 "%s" command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
846 (tramp-send-string vec command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
847 (tramp-smb-wait-for-output vec)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
848 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
849 (defun tramp-smb-maybe-open-connection (vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
850 "Maybe open a connection to HOST, log in as USER, using `tramp-smb-program'. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
851 Does not do anything if a connection is already open, but re-opens the |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
852 connection if a previous connection has died for some reason." |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
853 (let* ((share (tramp-smb-get-share (tramp-file-name-localname vec))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
854 (buf (tramp-get-buffer vec)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
855 (p (get-buffer-process buf))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
856 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
857 ;; If too much time has passed since last command was sent, look |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
858 ;; whether has been an error message; maybe due to connection timeout. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
859 (with-current-buffer buf |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
860 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
861 (when (and (> (tramp-time-diff |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
862 (current-time) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
863 (tramp-get-connection-property |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
864 p "last-cmd-time" '(0 0 0))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
865 60) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
866 p (processp p) (memq (process-status p) '(run open)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
867 (re-search-forward tramp-smb-errors nil t)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
868 (delete-process p) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
869 (setq p nil))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
870 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
871 ;; Check whether it is still the same share. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
872 (unless |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
873 (and p (processp p) (memq (process-status p) '(run open)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
874 (string-equal |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
875 share |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
876 (tramp-get-connection-property p "smb-share" ""))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
877 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
878 (save-match-data |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
879 ;; There might be unread output from checking for share names. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
880 (when buf (with-current-buffer buf (erase-buffer))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
881 (when (and p (processp p)) (delete-process p)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
882 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
883 (unless (let ((default-directory |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84739
diff
changeset
|
884 (tramp-compat-temporary-file-directory))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
885 (executable-find tramp-smb-program)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
886 (error "Cannot find command %s in %s" tramp-smb-program exec-path)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
887 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
888 (let* ((user (tramp-file-name-user vec)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
889 (host (tramp-file-name-host vec)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
890 (real-user user) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
891 (real-host host) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
892 domain port args) |
60763
3ba8f94e9cfa
Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents:
59996
diff
changeset
|
893 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
894 ;; Check for domain ("user%domain") and port ("host#port"). |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
895 (when (and user (string-match "\\(.+\\)%\\(.+\\)" user)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
896 (setq real-user (or (match-string 1 user) user) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
897 domain (match-string 2 user))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
898 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
899 (when (and host (string-match "\\(.+\\)#\\(.+\\)" host)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
900 (setq real-host (or (match-string 1 host) host) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
901 port (match-string 2 host))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
902 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
903 (if share |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
904 (setq args (list (concat "//" real-host "/" share))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
905 (setq args (list "-L" real-host ))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
906 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
907 (if (not (zerop (length real-user))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
908 (setq args (append args (list "-U" real-user))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
909 (setq args (append args (list "-N")))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
910 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
911 (when domain (setq args (append args (list "-W" domain)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
912 (when port (setq args (append args (list "-p" port)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
913 (setq args (append args (list "-s" "/dev/null"))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
914 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
915 ;; OK, let's go. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
916 (tramp-message |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
917 vec 3 "Opening connection for //%s%s/%s..." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
918 (if (not (zerop (length user))) (concat user "@") "") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
919 host (or share "")) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
920 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
921 (let* ((coding-system-for-read nil) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
922 (process-connection-type tramp-process-connection-type) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84739
diff
changeset
|
923 (p (let ((default-directory |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84739
diff
changeset
|
924 (tramp-compat-temporary-file-directory))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
925 (apply #'start-process |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
926 (tramp-buffer-name vec) (tramp-get-buffer vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
927 tramp-smb-program args)))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
928 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
929 (tramp-message |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
930 vec 6 "%s" (mapconcat 'identity (process-command p) " ")) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
931 (set-process-sentinel p 'tramp-flush-connection-property) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
932 (tramp-set-process-query-on-exit-flag p nil) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
933 (tramp-set-connection-property p "smb-share" share) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
934 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
935 ;; Set variables for computing the prompt for reading password. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
936 (setq tramp-current-method tramp-smb-method |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
937 tramp-current-user user |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
938 tramp-current-host host) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
939 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
940 ;; Set chunksize. Otherwise, `tramp-send-string' might |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
941 ;; try it itself. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
942 (tramp-set-connection-property p "chunksize" tramp-chunksize) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
943 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
944 ;; Play login scenario. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
945 (tramp-process-actions |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
946 p vec |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
947 (if share |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
948 tramp-smb-actions-with-share |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
949 tramp-smb-actions-without-share)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
950 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
951 (tramp-message |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
952 vec 3 "Opening connection for //%s%s/%s...done" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
953 (if (not (zerop (length user))) (concat user "@") "") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
954 host (or share "")))))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
955 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
956 ;; We don't use timeouts. If needed, the caller shall wrap around. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
957 (defun tramp-smb-wait-for-output (vec) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
958 "Wait for output from smbclient command. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
959 Returns nil if an error message has appeared." |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
960 (with-current-buffer (tramp-get-buffer vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
961 (let ((p (get-buffer-process (current-buffer))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
962 (found (progn (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
963 (re-search-forward tramp-smb-prompt nil t))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
964 (err (progn (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
965 (re-search-forward tramp-smb-errors nil t)))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
966 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
967 ;; Algorithm: get waiting output. See if last line contains |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
968 ;; tramp-smb-prompt sentinel or tramp-smb-errors strings. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
969 ;; If not, wait a bit and again get waiting output. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
970 (while (and (not found) (not err)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
971 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
972 ;; Accept pending output. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
973 (tramp-accept-process-output p) |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
974 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
975 ;; Search for prompt. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
976 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
977 (setq found (re-search-forward tramp-smb-prompt nil t)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
978 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
979 ;; Search for errors. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
980 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
981 (setq err (re-search-forward tramp-smb-errors nil t))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
982 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
983 ;; When the process is still alive, read pending output. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
984 (while (and (not found) (memq (process-status p) '(run open))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
985 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
986 ;; Accept pending output. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
987 (tramp-accept-process-output p) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
988 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
989 ;; Search for prompt. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
990 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
991 (setq found (re-search-forward tramp-smb-prompt nil t))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
992 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
993 ;; Return value is whether no error message has appeared. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
994 (tramp-message vec 6 "\n%s" (buffer-string)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
995 (not err)))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
996 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
997 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
998 (provide 'tramp-smb) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
999 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1000 ;;; TODO: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1001 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1002 ;; * Error handling in case password is wrong. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1003 ;; * Read password from "~/.netrc". |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1004 ;; * Return more comprehensive file permission string. Think whether it is |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1005 ;; possible to implement `set-file-modes'. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1006 ;; * Handle links (FILENAME.LNK). |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1007 ;; * Maybe local tmp files should have the same extension like the original |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1008 ;; files. Strange behaviour with jka-compr otherwise? |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1009 ;; * Try to remove the inclusion of dummy "" directory. Seems to be at |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1010 ;; several places, especially in `tramp-smb-handle-insert-directory'. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1011 ;; * (RMS) Use unwind-protect to clean up the state so as to make the state |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1012 ;; regular again. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
1013 ;; * Make it multi-hop capable. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1014 |
52401 | 1015 ;;; arch-tag: fcc9dbec-7503-4d73-b638-3c8aa59575f5 |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
1016 ;;; tramp-smb.el ends here |