aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2009-10-16 14:36:13 +0000
committerMichael Albinus2009-10-16 14:36:13 +0000
commit0c6f436e8475ec080701696418ec0c809284034a (patch)
treef78518f27b0decc4aa89c0c82f93695db71c616b
parent0dc7af67d584571ffbe765792a4432d7308dfc9c (diff)
downloademacs-0c6f436e8475ec080701696418ec0c809284034a.tar.gz
emacs-0c6f436e8475ec080701696418ec0c809284034a.zip
* net/tramp-smb.el (tramp-smb-version): New defvar.
(tramp-smb-maybe-open-connection): Use it, in order to avoid repeated checks.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/tramp-smb.el24
2 files changed, 21 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dc3b1541f27..ab9cecdc469 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12009-10-16 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp-smb.el (tramp-smb-version): New defvar.
4 (tramp-smb-maybe-open-connection): Use it, in order to avoid
5 repeated checks.
6
12009-10-16 Glenn Morris <rgm@gnu.org> 72009-10-16 Glenn Morris <rgm@gnu.org>
2 8
3 * emacs-lisp/byte-run.el (define-obsolete-variable-alias): Doc fix. 9 * emacs-lisp/byte-run.el (define-obsolete-variable-alias): Doc fix.
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index d09909f330e..c7ab6b00095 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -61,6 +61,9 @@
61 :group 'tramp 61 :group 'tramp
62 :type 'string) 62 :type 'string)
63 63
64(defvar tramp-smb-version nil
65 "*Version string of the SMB client.")
66
64(defconst tramp-smb-prompt "^smb: .+> \\|^\\s-+Server\\s-+Comment$" 67(defconst tramp-smb-prompt "^smb: .+> \\|^\\s-+Server\\s-+Comment$"
65 "Regexp used as prompt in smbclient.") 68 "Regexp used as prompt in smbclient.")
66 69
@@ -1209,13 +1212,15 @@ connection if a previous connection has died for some reason."
1209 "Cannot find command %s in %s" tramp-smb-program exec-path)) 1212 "Cannot find command %s in %s" tramp-smb-program exec-path))
1210 1213
1211 (let* ((default-directory (tramp-compat-temporary-file-directory)) 1214 (let* ((default-directory (tramp-compat-temporary-file-directory))
1212 (smbclient-version 1215 (smbclient-version tramp-smb-version))
1213 (shell-command-to-string (concat tramp-smb-program " -V")))) 1216 (unless smbclient-version
1214 (tramp-message vec 6 (concat tramp-smb-program " -V")) 1217 (setq smbclient-version
1215 (tramp-message vec 6 "\n%s" smbclient-version) 1218 (shell-command-to-string (concat tramp-smb-program " -V")))
1216 (if (string-match "[ \t\n\r]+\\'" smbclient-version) 1219 (tramp-message vec 6 (concat tramp-smb-program " -V"))
1217 (setq smbclient-version 1220 (tramp-message vec 6 "\n%s" smbclient-version)
1218 (replace-match "" nil nil smbclient-version))) 1221 (if (string-match "[ \t\n\r]+\\'" smbclient-version)
1222 (setq smbclient-version
1223 (replace-match "" nil nil smbclient-version))))
1219 (unless 1224 (unless
1220 (string-equal 1225 (string-equal
1221 smbclient-version 1226 smbclient-version
@@ -1223,8 +1228,9 @@ connection if a previous connection has died for some reason."
1223 vec "smbclient-version" smbclient-version)) 1228 vec "smbclient-version" smbclient-version))
1224 (tramp-flush-directory-property vec "") 1229 (tramp-flush-directory-property vec "")
1225 (tramp-flush-connection-property vec)) 1230 (tramp-flush-connection-property vec))
1226 (tramp-set-connection-property 1231 (setq tramp-smb-version
1227 vec "smbclient-version" smbclient-version))) 1232 (tramp-set-connection-property
1233 vec "smbclient-version" smbclient-version))))
1228 1234
1229 ;; If too much time has passed since last command was sent, look 1235 ;; If too much time has passed since last command was sent, look
1230 ;; whether there has been an error message; maybe due to 1236 ;; whether there has been an error message; maybe due to