annotate lisp/net/tramp-smb.el @ 105524:e781cac84553

* net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the case both directories are remote. (tramp-smb-handle-expand-file-name): Implement "~" expansion. (tramp-smb-maybe-open-connection): Flush the cache only if necessary.
author Michael Albinus <michael.albinus@gmx.de>
date Thu, 08 Oct 2009 15:21:19 +0000
parents 69bf209a4707
children 2025d7d04cb9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
82201
b3182f0c969c * net/tramp.el:
Michael Albinus <michael.albinus@gmx.de>
parents: 82140
diff changeset
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
100857
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008,
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
4 ;; 2009 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
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
48973
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
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; (at your option) any later version.
48973
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
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; along with GNU Emacs. If not, see <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
23
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
24 ;;; Commentary:
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
25
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
26 ;; 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
27
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
28 ;;; Code:
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
29
96186
c66f10196d81 Require 'cl when compiling.
Glenn Morris <rgm@gnu.org>
parents: 94677
diff changeset
30 (eval-when-compile (require 'cl)) ; block, return
48973
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
100857
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
47 `(nil ,tramp-prefix-domain-regexp ,tramp-smb-method))
81758
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
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
71 '(;; Connection error / timeout / unknown command.
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"
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
75 "\\S-+: command not found"
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
76 "Server doesn't support UNIX CIFS calls"
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
77 ;; Samba.
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
78 "ERRDOS"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
79 "ERRSRV"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
80 "ERRbadfile"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
81 "ERRbadpw"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
82 "ERRfilexists"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
83 "ERRnoaccess"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
84 "ERRnomem"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
85 "ERRnosuchshare"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
86 ;; Windows 4.0 (Windows NT), Windows 5.0 (Windows 2000),
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
87 ;; 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
88 "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
89 "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
90 "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
91 "NT_STATUS_CANNOT_DELETE"
105354
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
92 "NT_STATUS_CONNECTION_REFUSED"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
93 "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
94 "NT_STATUS_DUPLICATE_NAME"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
95 "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
96 "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
97 "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
98 "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
99 "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
100 "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
101 "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
102 "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
103 "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
104 "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
105 "\\|")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
106 "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
107 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
108
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
109 (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
110 '((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
111 (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
112 (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
113 (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
114 (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
115 "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
116 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
117
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
118 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
119
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
120 (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
121 '((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
122 (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
123 (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
124 (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
125 "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
126 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
127
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
128 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
129
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
130 ;; 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
131 (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
132 '(
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
133 ;; `access-file' performed by default handler.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
134 (add-name-to-file . tramp-smb-handle-copy-file) ;; we're on Windows, honey.
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
135 ;; `byte-compiler-base-file-name' performed by default handler.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
136 (copy-directory . tramp-smb-handle-copy-directory)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
137 (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
138 (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
139 (delete-file . tramp-smb-handle-delete-file)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
140 ;; `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
141 (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
142 (directory-files . tramp-smb-handle-directory-files)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
143 (directory-files-and-attributes
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
144 . 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
145 (dired-call-process . ignore)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
146 (dired-compress-file . ignore)
103531
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
147 (dired-uncache . tramp-handle-dired-uncache)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
148 (expand-file-name . tramp-smb-handle-expand-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
149 (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
150 (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
151 (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
152 (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
153 (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
154 (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
155 (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
156 (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
157 (file-name-all-completions . tramp-smb-handle-file-name-all-completions)
99617
0ba4a2790571 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Handle
Michael Albinus <michael.albinus@gmx.de>
parents: 97037
diff changeset
158 (file-name-as-directory . tramp-handle-file-name-as-directory)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
159 (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
160 (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
161 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
162 ;; `file-name-sans-versions' performed by default handler.
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-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
164 (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
165 (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
166 (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
167 (file-symlink-p . tramp-handle-file-symlink-p)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
168 ;; `file-truename' performed by default handler.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
169 (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
170 (find-backup-file-name . tramp-handle-find-backup-file-name)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
171 ;; `find-file-noselect' performed by default handler.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
172 ;; `get-file-buffer' performed by default handler.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
173 (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
174 (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
175 (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
176 (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
177 (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
178 (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
179 (rename-file . tramp-smb-handle-rename-file)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
180 (set-file-modes . tramp-smb-handle-set-file-modes)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
181 (set-file-times . ignore)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
182 (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
183 (shell-command . ignore)
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
184 (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
185 (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
186 (vc-registered . ignore)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
187 (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
188 (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
189 )
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
190 "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
191 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
192
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
193 (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
194 "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
195 (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
196 (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
197
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
198 (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
199 "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
200 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
201 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
202 (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
203 (if fn
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
204 (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
205 (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
206
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
207 (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
208 (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
209
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
210
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
211 ;; File name primitives.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
212
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
213 (defun tramp-smb-handle-copy-directory
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
214 (dirname newname &optional keep-date parents)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
215 "Like `copy-directory' for Tramp files."
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
216 (setq dirname (expand-file-name dirname)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
217 newname (expand-file-name newname))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
218 (let ((t1 (tramp-tramp-file-p dirname))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
219 (t2 (tramp-tramp-file-p newname)))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
220 (with-parsed-tramp-file-name (if t1 dirname newname) nil
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
221 (cond
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
222 ((and t1 t2)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
223 ;; We must copy, using a local temporary directory.
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
224 (let ((tmpdir
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
225 (make-temp-name
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
226 (expand-file-name
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
227 tramp-temp-name-prefix
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
228 (tramp-compat-temporary-file-directory)))))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
229 (unwind-protect
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
230 (progn
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
231 (copy-directory dirname tmpdir keep-date parents)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
232 (copy-directory tmpdir newname keep-date parents))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
233 (delete-directory tmpdir 'recursive))))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
234 ((or t1 t2)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
235 ;; We can copy recursively.
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
236 (let ((prompt (tramp-smb-send-command v "prompt"))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
237 (recurse (tramp-smb-send-command v "recurse")))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
238 (unless (file-directory-p newname)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
239 (make-directory newname parents))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
240 (unwind-protect
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
241 (unless
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
242 (and
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
243 prompt recurse
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
244 (tramp-smb-send-command
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
245 v (format "cd \"%s\""
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
246 (tramp-smb-get-localname localname t)))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
247 (tramp-smb-send-command
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
248 v (format "lcd \"%s\"" (if t1 newname dirname)))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
249 (if t1
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
250 (tramp-smb-send-command v "mget *")
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
251 (tramp-smb-send-command v "mput *")))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
252 ;; Error.
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
253 (with-current-buffer (tramp-get-connection-buffer v)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
254 (goto-char (point-min))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
255 (search-forward-regexp tramp-smb-errors nil t)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
256 (tramp-error
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
257 v 'file-error
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
258 "%s `%s'" (match-string 0) (if t1 dirname newname))))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
259 ;; Always go home.
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
260 (tramp-smb-send-command v (format "cd \\"))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
261 ;; Toggle prompt and recurse OFF.
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
262 (if prompt (tramp-smb-send-command v "prompt"))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
263 (if recurse (tramp-smb-send-command v "recurse")))))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
264 (t
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
265 ;; We must do it file-wise.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
266 (tramp-run-real-handler
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
267 'copy-directory (list dirname newname keep-date parents)))))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
268
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
269 (defun tramp-smb-handle-copy-file
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
270 (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
271 "Like `copy-file' for Tramp files.
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
272 KEEP-DATE is not handled in case NEWNAME resides on an SMB server.
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
273 PRESERVE-UID-GID is completely ignored."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
274 (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
275 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
276
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
277 (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
278
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
279 (if tmpfile
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
280 ;; Remote filename.
100923
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
281 (condition-case err
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
282 (rename-file tmpfile newname ok-if-already-exists)
100931
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
283 ((error quit)
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
284 (delete-file tmpfile)
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
285 (signal (car err) (cdr err))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
286
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
287 ;; 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
288 (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
289 (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
290 (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
291
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
292 (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
293 (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
294 (file-exists-p newname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
295 (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
296
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
297 ;; 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
298 ;; 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
299 (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
300 (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
301 (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
302 (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
303 (unless share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
304 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
305 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
306 (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
307 (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
308 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
309 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
310 v 0 "Copying file %s to file %s...done" filename newname)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
311 (tramp-error v 'file-error "Cannot copy `%s'" filename))))))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
312
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
313 ;; KEEP-DATE handling.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
314 (when keep-date (set-file-times newname (nth 5 (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
315
105354
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
316 (defun tramp-smb-handle-delete-directory (directory &optional recursive)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
317 "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
318 (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
319 (when (file-exists-p directory)
105354
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
320 (if recursive
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
321 (mapc
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
322 (lambda (file)
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
323 (if (file-directory-p file)
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
324 (delete-directory file recursive)
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
325 (delete-file file)))
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
326 ;; We do not want to delete "." and "..".
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
327 (directory-files
5077632c39ef * net/tramp-smb.el (tramp-smb-errors): Add error message for
Michael Albinus <michael.albinus@gmx.de>
parents: 105276
diff changeset
328 directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
329 (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
330 ;; 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
331 ;; 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
332 (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
333 (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
334 (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
335 (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
336 (unwind-protect
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
337 (unless (and
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
338 (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
339 (tramp-smb-send-command v (format "rmdir \"%s\"" file)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
340 ;; Error.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
341 (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
342 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
343 (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
344 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
345 v 'file-error "%s `%s'" (match-string 0) directory)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
346 ;; Always go home.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
347 (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
348
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
349 (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
350 "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
351 (setq filename (expand-file-name filename))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
352 (when (file-exists-p filename)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
353 (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
354 ;; 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
355 ;; 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
356 (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
357 (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
358 (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
359 (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
360 (unwind-protect
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
361 (unless (and
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
362 (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
363 (tramp-smb-send-command v (format "rm \"%s\"" file)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
364 ;; Error.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
365 (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
366 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
367 (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
368 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
369 v 'file-error "%s `%s'" (match-string 0) filename)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
370 ;; Always go home.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
371 (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
372
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
373 (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
374 (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
375 "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
376 (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
377 (file-name-all-completions "" directory))))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
378 ;; Discriminate with regexp.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
379 (when match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
380 (setq result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
381 (delete nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
382 (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
383 result))))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
384 ;; Append directory.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
385 (when full
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
386 (setq result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
387 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
388 (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
389 result)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
390 ;; Sort them if necessary.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
391 (unless nosort (setq result (sort result 'string-lessp)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
392 ;; That's it.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
393 result))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
394
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
395 (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
396 (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
397 "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
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)
105276
0c6bc9d2b10c (tramp-smb-handle-directory-files-and-attributes): Use
Glenn Morris <rgm@gnu.org>
parents: 105249
diff changeset
400 (cons x (tramp-compat-file-attributes
105249
99d98ed749b9 * net/tramp-smb.el (tramp-smb-handle-directory-files-and-attributes):
Michael Albinus <michael.albinus@gmx.de>
parents: 103531
diff changeset
401 (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
402 (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
403
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
404 (defun tramp-smb-handle-expand-file-name (name &optional dir)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
405 "Like `expand-file-name' for Tramp files."
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
406 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
407 (setq dir (or dir default-directory "/"))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
408 ;; Unless NAME is absolute, concat DIR and NAME.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
409 (unless (file-name-absolute-p name)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
410 (setq name (concat (file-name-as-directory dir) name)))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
411 ;; If NAME is not a Tramp file, run the real handler.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
412 (if (not (tramp-tramp-file-p name))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
413 (tramp-run-real-handler 'expand-file-name (list name nil))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
414 ;; Dissect NAME.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
415 (with-parsed-tramp-file-name name nil
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
416 ;; Tilde expansion if necessary. We use the user name as share,
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
417 ;; which is offen the case in domains.
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
418 (when (string-match "\\`/?~\\([^/]*\\)" localname)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
419 (setq localname
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
420 (replace-match
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
421 (if (zerop (length (match-string 1 localname)))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
422 (tramp-file-name-real-user v)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
423 (match-string 1 localname))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
424 nil nil localname)))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
425 ;; Make the file name absolute.
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
426 (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
427 (setq localname (concat "/" localname)))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
428 ;; No tilde characters in file name, do normal
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
429 ;; `expand-file-name' (this does "/./" and "/../").
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
430 (tramp-make-tramp-file-name
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
431 method user host
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
432 (tramp-run-real-handler 'expand-file-name (list localname))))))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
433
53206
0c19f1a19b2b (tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 52401
diff changeset
434 (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
435 "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
436 ;; 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
437 ;; 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
438 ;; 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
439 ;; 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
440 ;; 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
441 (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
442 (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
443 (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
444 (file-name-directory filename)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
445 (entry (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
446 (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
447 (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
448 (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
449 (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
450
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
451 ;; 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
452 (when entry
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
453 (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
454 t) ;0 file type
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
455 -1 ;1 link count
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
456 uid ;2 uid
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
457 gid ;3 gid
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
458 '(0 0) ;4 atime
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
459 (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
460 '(0 0) ;6 ctime
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
461 (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
462 (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
463 nil ;9 gid weird
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
464 inode ;10 inode number
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
465 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
466
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
467 (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
468 "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
469 (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
470 (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
471
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
472 (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
473 "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
474 (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
475
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
476 (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
477 "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
478 (with-parsed-tramp-file-name filename nil
103531
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
479 (unless (file-exists-p filename)
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
480 (tramp-error
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
481 v 'file-error
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
482 "Cannot make local copy of non-existing file `%s'" filename))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
483 (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
484 (tmpfile (tramp-compat-make-temp-file filename)))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
485 (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
486 (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
487 (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
488 v 4 "Fetching %s to tmp file %s...done" filename tmpfile)
103531
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
489 ;; Oops, an error. We shall cleanup.
74d482177a44 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 100931
diff changeset
490 (delete-file tmpfile)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
491 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
492 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
493 "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
494 tmpfile)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
495
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
496 ;; 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
497 ;; files.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
498 (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
499 "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
500 (all-completions
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
501 filename
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
502 (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
503 (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
504 (save-match-data
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
505 (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
506 (mapcar
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
507 (lambda (x)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
508 (list
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
509 (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
510 (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
511 (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
512 entries)))))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
513
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
514 (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
515 "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
516 (cond
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
517 ((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
518 ((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
519 (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
520 (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
521
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
522 (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
523 "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
524 (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
525 (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
526 (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
527 (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
528 (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
529
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
530 (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
531 (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
532 "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
533 (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
534 (when full-directory-p
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
535 ;; 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
536 (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
537 (with-parsed-tramp-file-name filename nil
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
538 (save-match-data
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
539 (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
540 ;; 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
541 (entries (copy-sequence
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
542 (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
543 (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
544
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
545 (when wildcard
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
546 (string-match "\\." base)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
547 (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
548 (string-match "\\*" base)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
549 (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
550 (string-match "\\?" base)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
551 (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
552
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
553 ;; Filter entries.
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
554 (setq entries
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
555 (delq
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
556 nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
557 (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
558 ;; Check for matching entries.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
559 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
560 (lambda (x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
561 (when (string-match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
562 (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
563 x))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
564 entries)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
565 ;; 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
566 (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
567
87368
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
568 ;; Sort entries.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
569 (setq entries
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
570 (sort
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
571 entries
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
572 (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
573 (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
574 ;; Sort by date.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
575 (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
576 ;; 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
577 (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
578
87368
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
579 ;; Handle "-F" switch.
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
580 (when (string-match "F" switches)
87559
59f471917fe0 (tramp-smb-handle-insert-directory): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents: 87368
diff changeset
581 (mapc
87368
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
582 (lambda (x)
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
583 (when (not (zerop (length (car x))))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
584 (cond
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
585 ((char-equal ?d (string-to-char (nth 1 x)))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
586 (setcar x (concat (car x) "/")))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
587 ((char-equal ?x (string-to-char (nth 1 x)))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
588 (setcar x (concat (car x) "*"))))))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
589 entries))
8b57223acf6b Sync with Tramp 2.1.12.
Michael Albinus <michael.albinus@gmx.de>
parents: 85962
diff changeset
590
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
591 ;; 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
592 (mapcar
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
593 (lambda (x)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
594 (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
595 (insert
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
596 (format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
597 "%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
598 (nth 1 x) ; mode
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
599 1 "nobody" "nogroup"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
600 (nth 2 x) ; size
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
601 (format-time-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
602 (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
603 (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
604 tramp-half-a-year)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
605 "%b %e %R"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
606 "%b %e %Y")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
607 (nth 3 x)) ; date
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
608 (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
609 (forward-line)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
610 (beginning-of-line)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
611 entries)))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
612
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
613 (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
614 "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
615 (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
616 (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
617 (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
618 (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
619 (save-match-data
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
620 (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
621 (ldir (file-name-directory dir)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
622 ;; Make missing directory parts.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
623 (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
624 (make-directory ldir parents))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
625 ;; Just do it.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
626 (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
627 (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
628 (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
629 (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
630
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
631 (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
632 "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
633 (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
634 (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
635 (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
636 (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
637 (save-match-data
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
638 (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
639 (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
640 (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
641 ;; 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
642 ;; file-attributes reads the values from there.
105383
56aa7f20f7da *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 105354
diff changeset
643 (tramp-flush-file-property v localname)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
644 (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
645 (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
646 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
647 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
648
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
649 (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
650 (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
651 "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
652 (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
653 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
654
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
655 (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
656
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
657 (if tmpfile
100923
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
658 ;; Remote filename.
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
659 (condition-case err
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
660 (rename-file tmpfile newname ok-if-already-exists)
100931
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
661 ((error quit)
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
662 (delete-file tmpfile)
3b92ee10ce02 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100923
diff changeset
663 (signal (car err) (cdr err))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
664
100923
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
665 ;; 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
666 (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
667 (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
668 (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
669
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
670 (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
671 (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
672 (file-exists-p newname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
673 (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
674 ;; 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
675 ;; 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
676 (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
677 (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
678 (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
679 (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
680 (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
681 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
682 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
683 (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
684
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
685 (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
686
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
687 (defun tramp-smb-handle-set-file-modes (filename mode)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
688 "Like `set-file-modes' for Tramp files."
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
689 (with-parsed-tramp-file-name filename nil
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
690 (tramp-flush-file-property v localname)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
691 (unless (tramp-smb-send-command
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
692 v (format "chmod \"%s\" %s"
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
693 (tramp-smb-get-localname localname t)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
694 (tramp-decimal-to-octal mode)))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
695 (tramp-error
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
696 v 'file-error "Error while changing file's mode %s" filename))))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
697
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
698 (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
699 "Like `handle-substitute-in-file-name' for Tramp files.
85962
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
700 \"//\" substitutes only in the local filename part. Catches
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
701 errors for shares like \"C$/\", which are common in Microsoft Windows."
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
702 (with-parsed-tramp-file-name filename nil
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
703 ;; Ignore in LOCALNAME everything before "//".
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
704 (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
705 (setq filename
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
706 (concat (file-remote-p filename)
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
707 (replace-match "\\1" nil nil localname)))))
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
708 (condition-case nil
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
709 (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
710 (error filename)))
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
711
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
712 (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
713 (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
714 "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
715 (setq filename (expand-file-name filename))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 59996
diff changeset
716 (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
717 (unless (eq append nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
718 (tramp-error
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
719 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
720 ;; 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
721 (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
722 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
723 (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
724 filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
725 (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
726 ;; We must also flush the cache of the directory, because
85962
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85694
diff changeset
727 ;; `file-attributes' reads the values from there.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
728 (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
729 (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
730 (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
731 (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
732 (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
733 ;; 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
734 ;; 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
735 ;; `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
736 (tramp-run-real-handler
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
737 'write-region
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
738 (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
739 (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
740 (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
741
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
742 (tramp-message v 5 "Writing tmp file %s to file %s..." tmpfile filename)
100923
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
743 (unwind-protect
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
744 (if (tramp-smb-send-command v (format "put %s \"%s\"" tmpfile file))
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
745 (tramp-message
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
746 v 5 "Writing tmp file %s to file %s...done" tmpfile filename)
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
747 (tramp-error v 'file-error "Cannot write `%s'" filename))
7bf074994867 * net/tramp-smb.el (tramp-smb-handle-copy-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 100857
diff changeset
748 (delete-file tmpfile))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
749
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
750 (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
751 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
752 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
753 "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
754 (when (eq visit t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
755 (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
756
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
757
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
758 ;; Internal file name functions.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
759
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
760 (defun tramp-smb-get-share (localname)
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
761 "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
762 (save-match-data
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
763 (when (string-match "^/?\\([^/]+\\)/" localname)
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
764 (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
765
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
766 (defun tramp-smb-get-localname (localname convert)
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
767 "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
768 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
769 (save-match-data
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
770 (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
771
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
772 (setq
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
773 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
774 (if convert
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
775 (mapconcat
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
776 (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
777 (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
778 (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
779 (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
780 (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
781 "")))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
782
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
783 ;; Sometimes we have discarded `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
784 (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
785 (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
786
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
787 res)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
788
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
789 ;; 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
790 ;; 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
791 (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
792 "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
793 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
794 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
795 (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
796 (setq localname (or localname "/"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
797 (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
798 (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
799 (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
800 (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
801 (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
802 res entry)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
803
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
804 (if (and (not share) cache)
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
805 ;; Return cached shares.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
806 (setq res cache)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
807
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
808 ;; Read entries.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
809 (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
810 (when (string-match "^\\./" file)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
811 (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
812 (if share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
813 (tramp-smb-send-command v (format "dir \"%s*\"" file))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
814 ;; `tramp-smb-maybe-open-connection' lists also the share names.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
815 (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
816
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
817 ;; Loop the listing.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
818 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
819 (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
820 (while (not (eobp))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
821 (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
822 (forward-line)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
823 (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
824
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
825 ;; Cache share entries.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
826 (unless share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
827 (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
828
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
829 ;; Add directory itself.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
830 (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
831
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
832 ;; 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
833 ;; 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
834 (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
835
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
836 ;; Return entries.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
837 (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
838
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
839 ;; Return either a share name (if SHARE is nil), or a 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
840 ;;
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
841 ;; If shares are listed, the following format is expected:
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
842 ;;
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
843 ;; \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
844 ;; \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
845 ;; \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
846 ;; \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
847 ;; \(\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
848 ;;
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
849 ;; 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
850 ;; 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
851 ;;
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
852 ;; \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
853 ;; \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
854 ;; \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
855 ;; \s- - space delimeter
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
856 ;; \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
857 ;; \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
858 ;; \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
859 ;; \s- - space delimeter
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
860 ;; \w\{3,3\} - month
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
861 ;; \s- - space delimeter
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
862 ;; [ 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
863 ;; \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
864 ;; [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
865 ;; \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
866 ;; [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
867 ;;
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
868 ;; 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
869 ;; has function display_finfo:
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
870 ;;
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
871 ;; 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
872 ;; finfo->name,
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
873 ;; attrib_string(finfo->mode),
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
874 ;; (double)finfo->size,
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
875 ;; asctime(LocalTime(&t)));
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
876 ;;
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
877 ;; 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
878 ;;
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
879 ;; 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
880 ;; CNV_LANG(finfo->name),
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
881 ;; attrib_string(finfo->mode),
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
882 ;; finfo->size,
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
883 ;; asctime(LocalTime(&t))));
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
884 ;;
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
885 ;; Problems:
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
886 ;; * 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
887 ;; 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
888 ;; * 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
889 ;; * 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
890 ;; * 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
891 ;;
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
892 ;; 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
893 (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
894 "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
895 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
896 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
897 ;; 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
898 ;; current buffer.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
899 (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
900 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
901
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
902 (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
903
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
904 ;; Read share entries.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
905 (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
906 (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
907 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
908 size 0))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
909
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
910 ;; 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
911 (block nil
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
912
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
913 ;; year.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
914 (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
915 (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
916 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
917 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
918
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
919 ;; time.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
920 (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
921 (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
922 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
923 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
924 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
925 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
926
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
927 ;; day.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
928 (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
929 (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
930 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
931 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
932
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
933 ;; month.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
934 (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
935 (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
936 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
937 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
938
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
939 ;; weekday.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
940 (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
941 (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
942 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
943
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
944 ;; size.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
945 (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
946 (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
947 (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
948 (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
949 (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
950 (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
951 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
952
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
953 ;; mode: ARCH, DIR, HIDDEN, RONLY, SYSTEM, VOLID.
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
954 (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
955 (setq
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
956 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
957 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
958 "%s%s"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
959 (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
960 (mapconcat
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
961 (lambda (x) "") " "
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
962 (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
963 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
964 (return))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
965
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
966 ;; localname.
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
967 (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
968 (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
969 (return))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
970
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
971 (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
972 (setq mtime
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
973 (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
974 (encode-time
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
975 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
976 (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
977 year)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
978 '(0 0)))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
979 (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
980
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
981
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
982 ;; Connection functions.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
983
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
984 (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
985 "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
986 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
987 (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
988 (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
989 (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
990 (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
991
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
992 (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
993 "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
994 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
995 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
996 (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
997 (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
998 (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
999
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1000 ;; Check whether we still have the same smbclient version.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1001 ;; Otherwise, we must delete the connection cache, because
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1002 ;; capabilities migh have changed.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1003 (unless (processp p)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1004 (unless (let ((default-directory
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1005 (tramp-compat-temporary-file-directory)))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1006 (executable-find tramp-smb-program))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1007 (tramp-error
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1008 vec 'file-error
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1009 "Cannot find command %s in %s" tramp-smb-program exec-path))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1010
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1011 (let* ((default-directory (tramp-compat-temporary-file-directory))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1012 (smbclient-version
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1013 (shell-command-to-string (concat tramp-smb-program " -V"))))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1014 (unless (string-equal
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1015 smbclient-version
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1016 (tramp-get-connection-property vec "smbclient-version" ""))
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1017 (when (tramp-get-connection-property vec "smbclient-version" nil)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1018 (tramp-flush-directory-property vec "")
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1019 (tramp-flush-connection-property vec)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1020 ); (setq buf (tramp-get-buffer vec)))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1021 (tramp-set-connection-property
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1022 vec "smbclient-version" smbclient-version))))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1023
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1024 ;; If too much time has passed since last command was sent, look
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1025 ;; whether there has been an error message; maybe due to
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1026 ;; connection timeout.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1027 (with-current-buffer buf
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1028 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1029 (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
1030 (current-time)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1031 (tramp-get-connection-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1032 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
1033 60)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1034 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
1035 (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
1036 (delete-process p)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1037 (setq p nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1038
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1039 ;; 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
1040 (unless
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1041 (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
1042 (string-equal
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1043 share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1044 (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
1045
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1046 (save-match-data
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1047 ;; 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
1048 (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
1049 (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
1050
100857
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1051 (let* ((user (tramp-file-name-user vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1052 (host (tramp-file-name-host vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1053 (real-user (tramp-file-name-real-user vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1054 (real-host (tramp-file-name-real-host vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1055 (domain (tramp-file-name-domain vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1056 (port (tramp-file-name-port vec))
51f12f881f02 * net/tramp-smb.el (top): Use `tramp-prefix-domain-regexp'.
Michael Albinus <michael.albinus@gmx.de>
parents: 99617
diff changeset
1057 args)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1058
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1059 (if share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1060 (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
1061 (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
1062
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1063 (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
1064 (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
1065 (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
1066
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1067 (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
1068 (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
1069 (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
1070
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1071 ;; OK, let's go.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1072 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1073 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
1074 (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
1075 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
1076
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1077 (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
1078 (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
1079 (p (let ((default-directory
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
1080 (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
1081 (apply #'start-process
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1082 (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
1083 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
1084
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1085 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1086 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
1087 (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
1088
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1089 ;; 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
1090 (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
1091 tramp-current-user user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1092 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
1093
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1094 ;; Play login scenario.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1095 (tramp-process-actions
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1096 p vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1097 (if share
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1098 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
1099 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
1100
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1101 ;; Check server version.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1102 (with-current-buffer (tramp-get-connection-buffer vec)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1103 (goto-char (point-min))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1104 (search-forward-regexp
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1105 "Domain=\\[[^]]*\\] OS=\\[[^]]*\\] Server=\\[[^]]*\\]" nil t)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1106 (let ((smbserver-version (match-string 0)))
105524
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1107 (unless (string-equal
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1108 smbserver-version
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1109 (tramp-get-connection-property
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1110 vec "smbserver-version" ""))
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1111 (when (tramp-get-connection-property
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1112 vec "smbserver-version" nil)
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1113 (tramp-flush-directory-property vec "")
e781cac84553 * net/tramp-smb.el (tramp-smb-handle-copy-directory): Handle the
Michael Albinus <michael.albinus@gmx.de>
parents: 105509
diff changeset
1114 (tramp-flush-connection-property vec))
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1115 (tramp-set-connection-property
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1116 vec "smbserver-version" smbserver-version))))
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1117
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1118 ;; Set chunksize. Otherwise, `tramp-send-string' might
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1119 ;; try it itself.
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1120 (tramp-set-connection-property p "smb-share" share)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1121 (tramp-set-connection-property p "chunksize" tramp-chunksize)
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1122
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1123 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1124 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
1125 (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
1126 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
1127
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1128 ;; 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
1129 (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
1130 "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
1131 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
1132 (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
1133 (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
1134 (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
1135 (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
1136 (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
1137 (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
1138
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1139 ;; 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
1140 ;; 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
1141 ;; 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
1142 (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
1143
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1144 ;; Accept pending output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1145 (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
1146
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1147 ;; Search for prompt.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1148 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1149 (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
1150
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1151 ;; Search for errors.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1152 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1153 (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
1154
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1155 ;; 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
1156 (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
1157
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1158 ;; Accept pending output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1159 (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
1160
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1161 ;; Search for prompt.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1162 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1163 (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
1164
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1165 ;; 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
1166 (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
1167 (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
1168
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1169
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1170 (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
1171
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1172 ;;; TODO:
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1173
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1174 ;; * 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
1175 ;; * Read password from "~/.netrc".
105509
69bf209a4707 * net/tramp-smb.el (tramp-smb-errors): Add error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 105383
diff changeset
1176 ;; * Return more comprehensive file permission string.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1177 ;; * 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
1178 ;; * 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
1179 ;; 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
1180 ;; * (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
1181 ;; regular again.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1182 ;; * 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
1183
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91489
diff changeset
1184 ;; 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
1185 ;;; tramp-smb.el ends here