]> code.delx.au - gnu-emacs/commitdiff
* lisp/net/tramp.el (with-parsed-tramp-file-name): Silence compiler
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 3 Sep 2013 16:23:10 +0000 (12:23 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 3 Sep 2013 16:23:10 +0000 (12:23 -0400)
warnings, and factor our common code.

lisp/ChangeLog
lisp/net/tramp-compat.el
lisp/net/tramp.el

index 49c6caeceb773901eb7e3b74ac602111707ec0e1..fdd8bdabe641b8df1874648f8c55868876dfe0b6 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * net/tramp.el (with-parsed-tramp-file-name): Silence compiler
+       warnings, and factor our common code.
+
 2013-09-03  Dmitry Gutov  <dgutov@yandex.ru>
 
        * progmodes/ruby-mode.el (ruby-calculate-indent): Consider
@@ -7,8 +12,8 @@
 2013-09-02  Fabián Ezequiel Gallina  <fgallina@gnu.org>
 
        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  <michael.albinus@gmx.de>
index 3081c45cc7d0faf7b0d4467ac2d1679a7de333b3..8f9d9d8fee588a414790ec94ff816d9b364dfcc4 100644 (file)
 ;; `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)))
 
index ff0200c116180591f7d5f1150a07ed93c74f19d2..6c3ae376dc327913e53661565bdafd360953ba30 100644 (file)
@@ -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))