emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105316: * net/tramp-sh.el (tramp-bar


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105316: * net/tramp-sh.el (tramp-barf-unless-okay): Return the value of
Date: Sun, 24 Jul 2011 11:56:26 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105316
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Sun 2011-07-24 11:56:26 +0200
message:
  * net/tramp-sh.el (tramp-barf-unless-okay): Return the value of
  `tramp-send-command-and-check' if there is no error.
  (tramp-send-command-and-read): Suppress *all* errors if NOERROR.
modified:
  lisp/ChangeLog
  lisp/net/tramp-sh.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-07-22 12:53:46 +0000
+++ b/lisp/ChangeLog    2011-07-24 09:56:26 +0000
@@ -1,3 +1,9 @@
+2011-07-24  Michael Albinus  <address@hidden>
+
+       * net/tramp-sh.el (tramp-barf-unless-okay): Return the value of
+       `tramp-send-command-and-check' if there is no error.
+       (tramp-send-command-and-read): Suppress *all* errors if NOERROR.
+
 2011-07-22  Alan Mackenzie  <address@hidden>
 
        Prevent cc-langs.elc being loaded at run time.

=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el      2011-07-08 14:25:25 +0000
+++ b/lisp/net/tramp-sh.el      2011-07-24 09:56:26 +0000
@@ -4505,27 +4505,30 @@
   "Run COMMAND, check exit status, throw error if exit status not okay.
 Similar to `tramp-send-command-and-check' but accepts two more arguments
 FMT and ARGS which are passed to `error'."
-  (unless (tramp-send-command-and-check vec command)
-    (apply 'tramp-error vec 'file-error fmt args)))
+  (or (tramp-send-command-and-check vec command)
+      (apply 'tramp-error vec 'file-error fmt args)))
 
 (defun tramp-send-command-and-read (vec command &optional noerror)
   "Run COMMAND and return the output, which must be a Lisp expression.
 In case there is no valid Lisp expression and NOERROR is nil, it
 raises an error."
-  (tramp-barf-unless-okay vec command "`%s' returns with error" command)
-  (with-current-buffer (tramp-get-connection-buffer vec)
-    ;; Read the expression.
-    (goto-char (point-min))
-    (condition-case nil
-       (prog1 (read (current-buffer))
-         ;; Error handling.
-         (when (re-search-forward "\\S-" (point-at-eol) t)
-           (error nil)))
-      (error (unless noerror
-              (tramp-error
-               vec 'file-error
-               "`%s' does not return a valid Lisp expression: `%s'"
-               command (buffer-string)))))))
+  (when (if noerror
+           (tramp-send-command-and-check vec command)
+         (tramp-barf-unless-okay
+          vec command "`%s' returns with error" command))
+    (with-current-buffer (tramp-get-connection-buffer vec)
+      ;; Read the expression.
+      (goto-char (point-min))
+      (condition-case nil
+         (prog1 (read (current-buffer))
+           ;; Error handling.
+           (when (re-search-forward "\\S-" (point-at-eol) t)
+             (error nil)))
+       (error (unless noerror
+                (tramp-error
+                 vec 'file-error
+                 "`%s' does not return a valid Lisp expression: `%s'"
+                 command (buffer-string))))))))
 
 (defun tramp-convert-file-attributes (vec attr)
   "Convert file-attributes ATTR generated by perl script, stat or ls.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]