[sawfish] Implemented `init' for error-destination.



commit 4afcfc63a735206b5317c42a971b1ee6ed30cef6
Author: Teika kazura <teika lavabit com>
Date:   Tue Feb 1 14:21:25 2011 +0900

    Implemented `init' for error-destination.
    
    An error during initialization is printed to both screen and stderr by default.

 lisp/sawfish/wm/ext/error-handler.jl |   10 ++++++++++
 lisp/sawfish/wm/user.jl              |    7 ++++++-
 man/news.texi                        |    7 +++++++
 3 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/lisp/sawfish/wm/ext/error-handler.jl b/lisp/sawfish/wm/ext/error-handler.jl
index e6f9cb5..2be4403 100644
--- a/lisp/sawfish/wm/ext/error-handler.jl
+++ b/lisp/sawfish/wm/ext/error-handler.jl
@@ -68,6 +68,16 @@
 	 (write standard-error "Sawfish error:\n")
 	 (write standard-error text)
 	 (write standard-error #\newline))
+	((init)
+	 ;; If it's called now, then the message window is covered
+	 ;; by client windows.
+	 (add-hook 'after-initialization-hook
+		   (lambda ()
+		     (display-message
+		      (concat "Error:\n(Click to dismiss. Also printed to stderr)\n\n" text))))
+	 (write standard-error "Sawfish error:\n")
+	 (write standard-error text)
+	 (write standard-error #\newline))
 	((both)
 	 (display-message text)
 	 (write standard-error "Sawfish error:\n")
diff --git a/lisp/sawfish/wm/user.jl b/lisp/sawfish/wm/user.jl
index 199642f..4829f23 100644
--- a/lisp/sawfish/wm/user.jl
+++ b/lisp/sawfish/wm/user.jl
@@ -113,6 +113,7 @@ Possible values are \"kde\", \"gnome\", \"xfce\", or \"none\".")
 ;;; From here, executed at startup.
 
   ;; load ~/.sawfish/rc
+  (setq error-destination 'init)
   (unless (get-command-line-option "--no-rc")
     (condition-case error-data
 	(progn
@@ -190,7 +191,11 @@ Possible values are \"kde\", \"gnome\", \"xfce\", or \"none\".")
 	(do-load arg))
        ((member arg '("-q" "--quit"))
 	(throw 'quit 0))
-       (t (do-load arg))))))
+       (t (do-load arg)))))
+  
+  (when (eq error-destination 'init)
+    (setq error-destination 'standard-error))
+  )
 
 ;; prevent this file being loaded as a module
 nil
diff --git a/man/news.texi b/man/news.texi
index f027638..e8f9618 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -186,6 +186,13 @@ This new window-matcher is a companion to @code{toggle-or-exec}. When
 a window matched loses the focus, it gets hidden. Use this together
 with @code{toggle-or-exec} for greater toggle-window experience.
 
+ item Error printing during initialization [Teika Kazura]
+
+When an error occurs during initialization, and if you don't customize
+the option @code{error-handler}, then the error is reported to both
+the screen and standard-error. After Sawfish starts, it's printed to
+the standard-error only.
+
 @item New function @code{report-commands} [Teika kazura] *
 It returns the list of all commands. (@pxref{Operations on Commands}).
 @end itemize



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