From: Michael Albinus Date: Fri, 16 Oct 2009 14:36:13 +0000 (+0000) Subject: * net/tramp-smb.el (tramp-smb-version): New defvar. X-Git-Tag: emacs-pretest-23.1.90~773 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0c6f436e8475ec080701696418ec0c809284034a;p=emacs.git * net/tramp-smb.el (tramp-smb-version): New defvar. (tramp-smb-maybe-open-connection): Use it, in order to avoid repeated checks. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dc3b1541f27..ab9cecdc469 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2009-10-16 Michael Albinus + + * net/tramp-smb.el (tramp-smb-version): New defvar. + (tramp-smb-maybe-open-connection): Use it, in order to avoid + repeated checks. + 2009-10-16 Glenn Morris * 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 @@ :group 'tramp :type 'string) +(defvar tramp-smb-version nil + "*Version string of the SMB client.") + (defconst tramp-smb-prompt "^smb: .+> \\|^\\s-+Server\\s-+Comment$" "Regexp used as prompt in smbclient.") @@ -1209,13 +1212,15 @@ connection if a previous connection has died for some reason." "Cannot find command %s in %s" tramp-smb-program exec-path)) (let* ((default-directory (tramp-compat-temporary-file-directory)) - (smbclient-version - (shell-command-to-string (concat tramp-smb-program " -V")))) - (tramp-message vec 6 (concat tramp-smb-program " -V")) - (tramp-message vec 6 "\n%s" smbclient-version) - (if (string-match "[ \t\n\r]+\\'" smbclient-version) - (setq smbclient-version - (replace-match "" nil nil smbclient-version))) + (smbclient-version tramp-smb-version)) + (unless smbclient-version + (setq smbclient-version + (shell-command-to-string (concat tramp-smb-program " -V"))) + (tramp-message vec 6 (concat tramp-smb-program " -V")) + (tramp-message vec 6 "\n%s" smbclient-version) + (if (string-match "[ \t\n\r]+\\'" smbclient-version) + (setq smbclient-version + (replace-match "" nil nil smbclient-version)))) (unless (string-equal smbclient-version @@ -1223,8 +1228,9 @@ connection if a previous connection has died for some reason." vec "smbclient-version" smbclient-version)) (tramp-flush-directory-property vec "") (tramp-flush-connection-property vec)) - (tramp-set-connection-property - vec "smbclient-version" smbclient-version))) + (setq tramp-smb-version + (tramp-set-connection-property + vec "smbclient-version" smbclient-version)))) ;; If too much time has passed since last command was sent, look ;; whether there has been an error message; maybe due to