[sawfish] Errors of asynchronous connection are printed to Sawfish's output.



commit 88ed9165d9a1fcf89bfbeb4815b04daf769943b8
Author: Teika kazura <teika lavabit com>
Date:   Sat Jul 3 13:19:11 2010 +0900

    Errors of asynchronous connection are printed to Sawfish's output.

 lisp/sawfish/wm/server.jl |    8 +++++++-
 man/news.texi             |   12 ++++++++++--
 src/server.c              |    8 +++++++-
 3 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/lisp/sawfish/wm/server.jl b/lisp/sawfish/wm/server.jl
index d5f9e7c..be601ba 100644
--- a/lisp/sawfish/wm/server.jl
+++ b/lisp/sawfish/wm/server.jl
@@ -55,7 +55,9 @@
 
   (define server-window nil)
 
-  (define (server-eval form)
+  ;; Set `print-error' to non-nil for example for an async call.
+  ;; Then the error is printed here.
+  (define (server-eval form #!optional print-error)
     (let ((print-escape t))
       (condition-case error-data
 	  ;; This enables backtrace printing inside of sawfish-client
@@ -63,6 +65,10 @@
 	    (setq form (read-from-string form))
 	    (format nil "\001%S" (user-eval form)))
 	(error
+	 (when print-error
+	   (let ((error-handler-beep nil)
+		 (error-destination 'standard-error))
+	     (error-handler-function 'error error-data)))
 	 (format nil "\002%S" error-data)))))
 
   (define (server-client-message-handler w type data)
diff --git a/man/news.texi b/man/news.texi
index 7aa1b24..784a85b 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -70,8 +70,16 @@ See the item ``Keyboard layout switching support'' above.
 A ``border'' of a window surrounds the window and all other frame
 parts. (@pxref{Frame Part Definition})
 
- item If you're using librep >= 0.90.7, then the backtrace is printed for
-sawfish-client, too. [Teika Kazura]
+ item More error and backtrace printing [Teika Kazura]
+
+If you're using librep >= 0.90.7, then the backtrace is printed for
+sawfish-client, too.
+
+Previously when you connect to Sawfish as a server asynchronously,
+then the error is not printed. Now it is printed to Sawfish's 
+output. (A client which connects synchronously receives the error
+message.) Practically, this means sawfish-pager's errors are printed
+to Sawfish's output. 
 @end itemize
 
 @item Miscellaneous Changes
diff --git a/src/server.c b/src/server.c
index 1e9c416..7667f79 100644
--- a/src/server.c
+++ b/src/server.c
@@ -107,7 +107,13 @@ server_handle_request(int fd)
 	   || sock_read(fd, rep_STR(val), len) != len)
 	    goto io_error;
 	rep_STR(val)[len] = 0;
-	val = rep_call_lisp1 (global_symbol_value (Qserver_eval), val);
+	if (req != req_eval_async){
+	  val = rep_call_lisp2 (global_symbol_value (Qserver_eval),
+				val, Qnil);
+	}else{
+	  val = rep_call_lisp2 (global_symbol_value (Qserver_eval),
+				val, Qt);
+	}
 	if (req != req_eval_async)
 	{
 	    if(val && rep_STRINGP(val))



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