[sawfish: 2/4] Let repl-iterate handle ",quit".
- From: Christopher Bratusek <chrisb src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [sawfish: 2/4] Let repl-iterate handle ",quit".
- Date: Wed, 28 Oct 2009 16:33:44 +0000 (UTC)
commit 821c6349450dcb1f1508835260c82323292a6f02
Author: Timo Korvola <tkorvola iki fi>
Date: Sun Oct 25 18:55:57 2009 +0200
Let repl-iterate handle ",quit".
Just redefine ,quit in Sawfish so that it throws another exception
instead of quit, and catch that exception. This means that (quit) still
quits.
scripts/sawfish-client.jl | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/scripts/sawfish-client.jl b/scripts/sawfish-client.jl
index c0c37ae..fea6d4a 100644
--- a/scripts/sawfish-client.jl
+++ b/scripts/sawfish-client.jl
@@ -100,6 +100,8 @@ sawfish comes with ABSOLUTELY NO WARRANTY; for details see the file COPYING\n"
(let ((r (sawfish-client-eval
`(progn
(require 'rep.util.repl)
+ (define-repl-command 'quit
+ (lambda () (throw 'sawfish-client-exit)))
(make-repl 'user)))))
(let-fluids ((current-repl r))
(write standard-output "\nEnter `,help' to list commands.\n")
@@ -107,8 +109,7 @@ sawfish comes with ABSOLUTELY NO WARRANTY; for details see the file COPYING\n"
(let ((input (readline
(format nil (if (repl-pending r) "" "%s> ")
(repl-struct r)))))
- (when (and input
- (not (equal ",quit\n" input)))
+ (when input
(let ((out (sawfish-client-eval
`(progn
(require 'rep.util.repl)
@@ -116,7 +117,9 @@ sawfish comes with ABSOLUTELY NO WARRANTY; for details see the file COPYING\n"
(make-string-output-stream))
(standard-error standard-output)
(r ',r))
- (cons (and (repl-iterate r ',input) r)
+ (cons (catch 'sawfish-client-exit
+ (and (repl-iterate r ',input)
+ r))
(get-output-stream-string
standard-output)))))))
(setq r (car out))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]