GNU bug report logs - #17815
24.4.50; (process-file) erroneously raises its buffer when running with TRAMP

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Fri, 20 Jun 2014 08:11:02 UTC

Severity: normal

Found in version 24.4.50

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Dima Kogan <dima <at> secretsauce.net>, 17815-done <at> debbugs.gnu.org
Subject: bug#17815: 24.4.50; (process-file) erroneously raises its buffer when running with TRAMP
Date: Sun, 22 Jun 2014 08:55:43 -0400
> Well, all handlers I could factor out for several backends, live in
> tramp.el as `tramp-handle-...'. `tramp-adb-handle-process-file' and
> `tramp-sh-handle-process-file' contain subtle differences, it will be
> harder to refactor them.

Those functions are almost 100 lines long and yet the diff between the
two is only the little thing below.  Clearly, there's room for a good
refactoring.  Maybe you can't replace them with a single function, but
you can create a third function that holds most of the code.


        Stefan


--- mine/tramp-sh.el
+++ other/tramp-sh.el
@@ -1,4 +1,4 @@
-(defun tramp-sh-handle-process-file
+(defun tramp-adb-handle-process-file
   (program &optional infile destination display &rest args)
   "Like `process-file' for Tramp files."
   ;; The implementation is not complete yet.
@@ -66,20 +66,16 @@
       ;; it.  Call it in a subshell, in order to preserve working
       ;; directory.
       (condition-case nil
-	  (unwind-protect
-              (setq ret
-		    (if (tramp-send-command-and-check
-			 v (format "\\cd %s; %s"
-				   (tramp-shell-quote-argument localname)
-				   command)
-			 t t)
-			0 1))
+	  (progn
+	    (setq ret 0)
+	    (tramp-adb-barf-unless-okay
+	     v (format "(cd %s; %s)"
+		       (tramp-shell-quote-argument localname) command)
+	     "")
 	    ;; We should add the output anyway.
 	    (when outbuf
 	      (with-current-buffer outbuf
-                (insert
-                 (with-current-buffer (tramp-get-connection-buffer v)
-                   (buffer-string))))
+		(insert-buffer-substring (tramp-get-connection-buffer v)))
 	      (when (and display (get-buffer-window outbuf t)) (redisplay))))
 	;; When the user did interrupt, we should do it also.  We use
 	;; return code -1 as marker.
@@ -101,7 +97,7 @@
       ;; `process-file-side-effects' has been introduced with GNU
       ;; Emacs 23.2.  If set to `nil', no remote file will be changed
       ;; by `program'.  If it doesn't exist, we assume its default
-      ;; value `t'.
+      ;; value 't'.
       (unless (and (boundp 'process-file-side-effects)
 		   (not (symbol-value 'process-file-side-effects)))
         (tramp-flush-directory-property v ""))




This bug report was last modified 10 years and 341 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.