From 9d3f707c59f69f357c8ff2cdea313bfe771dbfc4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 3 Sep 2013 12:23:10 -0400 Subject: [PATCH] * lisp/net/tramp.el (with-parsed-tramp-file-name): Silence compiler warnings, and factor our common code. --- lisp/ChangeLog | 9 +++++++-- lisp/net/tramp-compat.el | 2 +- lisp/net/tramp.el | 25 +++++++++++++------------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 49c6caeceb7..fdd8bdabe64 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-09-03 Stefan Monnier + + * net/tramp.el (with-parsed-tramp-file-name): Silence compiler + warnings, and factor our common code. + 2013-09-03 Dmitry Gutov * progmodes/ruby-mode.el (ruby-calculate-indent): Consider @@ -7,8 +12,8 @@ 2013-09-02 Fabián Ezequiel Gallina Format code sent to Python shell for robustness. - * progmodes/python.el (python-shell-buffer-substring): New - function. + * progmodes/python.el (python-shell-buffer-substring): + New function. (python-shell-send-region, python-shell-send-buffer): Use it. 2013-09-02 Michael Albinus diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 3081c45cc7d..8f9d9d8fee5 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -186,7 +186,7 @@ ;; `with-temp-message' does not exist in XEmacs. (if (fboundp 'with-temp-message) (defalias 'tramp-compat-with-temp-message 'with-temp-message) - (defmacro tramp-compat-with-temp-message (message &rest body) + (defmacro tramp-compat-with-temp-message (_message &rest body) "Display MESSAGE temporarily if non-nil while BODY is evaluated." `(progn ,@body))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index ff0200c1161..6c3ae376dc3 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1632,18 +1632,19 @@ Remaining args are Lisp expressions to be evaluated (inside an implicit If VAR is nil, then we bind `v' to the structure and `method', `user', `host', `localname', `hop' to the components." - `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename)) - (,(if var (intern (concat (symbol-name var) "-method")) 'method) - (tramp-file-name-method ,(or var 'v))) - (,(if var (intern (concat (symbol-name var) "-user")) 'user) - (tramp-file-name-user ,(or var 'v))) - (,(if var (intern (concat (symbol-name var) "-host")) 'host) - (tramp-file-name-host ,(or var 'v))) - (,(if var (intern (concat (symbol-name var) "-localname")) 'localname) - (tramp-file-name-localname ,(or var 'v))) - (,(if var (intern (concat (symbol-name var) "-hop")) 'hop) - (tramp-file-name-hop ,(or var 'v)))) - ,@body)) + (let ((bindings + (mapcar (lambda (elem) + `(,(if var (intern (format "%s-%s" var elem)) elem) + (,(intern (format "tramp-file-name-%s" elem)) + ,(or var 'v)))) + '(method user host localname hop)))) + `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename)) + ,@bindings) + ;; We don't know which of those vars will be used, so we bind them all, + ;; and then add here a dummy use of all those variables, so we don't get + ;; flooded by warnings about those vars `body' didn't use. + (ignore ,@(mapcar #'car bindings)) + ,@body))) (put 'with-parsed-tramp-file-name 'lisp-indent-function 2) (put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body)) -- 2.39.2