[sawfish] define-command jump-or-exec; autoload jump-or-exec



commit 81b74b335c751b6e7200c6b4c1fb7d5c6096ac91
Author: Christopher Roy Bratusek <chris nanolx org>
Date:   Fri Jan 15 21:02:14 2010 +0100

    define-command jump-or-exec; autoload jump-or-exec

 ChangeLog                                |    1 +
 lisp/sawfish/wm/autoload.jl              |    1 +
 lisp/sawfish/wm/commands/jump-or-exec.jl |   38 +++++++++++++++--------------
 3 files changed, 22 insertions(+), 18 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9f3a61d..92c1317 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 2010-01-15  Christopher Bratusek <zanghar freenet de>
+	* lisp/sawfish/wm/autoload.jl
 	* lisp/sawfish/wm/commands/jump-or-exec.jl: added a modified version of jump-or-exec,
 	                                            which supports both matching against WM_NAME
 						    and WM_CLASS
diff --git a/lisp/sawfish/wm/autoload.jl b/lisp/sawfish/wm/autoload.jl
index 9c74019..4923eea 100644
--- a/lisp/sawfish/wm/autoload.jl
+++ b/lisp/sawfish/wm/autoload.jl
@@ -214,4 +214,5 @@
 (autoload-command 'set-window-viewport-linear:8 'sawfish.wm.commands.viewport-linear)
 (autoload-command 'set-viewport-linear:9 'sawfish.wm.commands.viewport-linear)
 (autoload-command 'set-window-viewport-linear:9 'sawfish.wm.commands.viewport-linear)
+(autoload-command 'jump-or-exec 'sawfish.wm.commands.jump-or-exec)
 ;;; ::autoload-end::
diff --git a/lisp/sawfish/wm/commands/jump-or-exec.jl b/lisp/sawfish/wm/commands/jump-or-exec.jl
index 995daf1..14fe76d 100644
--- a/lisp/sawfish/wm/commands/jump-or-exec.jl
+++ b/lisp/sawfish/wm/commands/jump-or-exec.jl
@@ -46,21 +46,23 @@
           sawfish.wm.windows
 	  sawfish.wm.util.display-window)
 
-(define (jump-or-exec re prog #!optional class onfocused)
-  "jump to a window matched by re, or start program otherwise."
-  (catch 'return
-    (let ((wind (if class
-                  (get-window-by-class-re re)
-                  (get-window-by-name-re re))))
-      (if (functionp onfocused) ; check if already focused
-          (let ((curwin (input-focus)))
-            (if curwin
-                (if (string-match re (window-name curwin))
-                    (progn
-                      (funcall onfocused wind)
-                      (throw 'return))))))
-      (if (windowp wind)
-          (display-window wind)
-        (if (functionp prog)
-            (funcall prog)
-          (system (concat prog "&"))))))))
+  (define (jump-or-exec re prog #!optional class onfocused)
+    "jump to a window matched by re, or start program otherwise."
+    (catch 'return
+      (let ((wind (if class
+                    (get-window-by-class-re re)
+                    (get-window-by-name-re re))))
+        (if (functionp onfocused) ; check if already focused
+            (let ((curwin (input-focus)))
+              (if curwin
+                  (if (string-match re (window-name curwin))
+                      (progn
+                        (funcall onfocused wind)
+                        (throw 'return))))))
+        (if (windowp wind)
+            (display-window wind)
+          (if (functionp prog)
+                (funcall prog)
+              (system (concat prog "&")))))))
+
+  (define-command 'jump-or-exec jump-or-exec #:class default))



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