[sawfish] don't re-define beautify-symbol-name and remove-newlines functions over several modules. add sawfish



commit c66f44a451429d4d4db3cb899d0ada4cda1219af
Author: Christopher Roy Bratusek <zanghar freenet de>
Date:   Sun Sep 19 14:12:41 2010 +0200

    don't re-define beautify-symbol-name and remove-newlines
    functions over several modules. add sawfish.cfg.utils for them to be defined only once

 lisp/sawfish/cfg/Makefile.in             |    1 +
 lisp/sawfish/cfg/layout.jl               |   11 ++---------
 lisp/sawfish/cfg/widgets/command.jl      |   22 ++--------------------
 lisp/sawfish/cfg/widgets/keymap.jl       |   18 +++---------------
 lisp/sawfish/cfg/widgets/match-window.jl |   15 ++-------------
 5 files changed, 10 insertions(+), 57 deletions(-)
---
diff --git a/lisp/sawfish/cfg/Makefile.in b/lisp/sawfish/cfg/Makefile.in
index 88c4e89..fc43883 100644
--- a/lisp/sawfish/cfg/Makefile.in
+++ b/lisp/sawfish/cfg/Makefile.in
@@ -37,6 +37,7 @@ SRCS :=	apply.jl		\
 	main.jl			\
 	shell.jl		\
 	slot.jl			\
+	utils.jl                \
 	wm.jl
 
 W_SRCS := widgets/command.jl	\
diff --git a/lisp/sawfish/cfg/layout.jl b/lisp/sawfish/cfg/layout.jl
index 38f6423..ad02b87 100644
--- a/lisp/sawfish/cfg/layout.jl
+++ b/lisp/sawfish/cfg/layout.jl
@@ -30,7 +30,8 @@
 	   gui.gtk-2.gtk
 	   rep.regexp
 	   sawfish.cfg.slot
-	   sawfish.gtk.widget)
+	   sawfish.gtk.widget
+	   sawfish.cfg.utils)
      (access rep.structures))
 
   (define widget-ptr nil)
@@ -144,14 +145,6 @@
 	      (gtk-widget-show-all hbox)
 	      hbox))))))
 
-  (define (remove-newlines string)
-    (let loop ((point 0)
-	       (out '()))
-	 (if (string-match "\n" string point)
-	     (loop (match-end)
-		   (list* #\space (substring string point (match-start)) out))
-	   (apply concat (nreverse (cons (substring string point) out))))))
-
   (define (make-label text)
     (let ((label (gtk-label-new text)))
       (gtk-label-set-justify label 'left)
diff --git a/lisp/sawfish/cfg/widgets/command.jl b/lisp/sawfish/cfg/widgets/command.jl
index eafb440..a9a147d 100644
--- a/lisp/sawfish/cfg/widgets/command.jl
+++ b/lisp/sawfish/cfg/widgets/command.jl
@@ -26,7 +26,8 @@
           gui.gtk-2.gtk
           rep.regexp
           sawfish.gtk.widget
-          sawfish.cfg.wm)
+          sawfish.cfg.wm
+	  sawfish.cfg.utils)
 
   (define all-commands)
 
@@ -156,25 +157,6 @@
 
 ;;; utils
 
-  (define (beautify-symbol-name symbol)
-    (cond ((stringp symbol) symbol)
-	  ((not (symbolp symbol)) (format "%s" symbol))
-	  (t
-	   (let ((name (copy-sequence (symbol-name symbol))))
-	     (while (string-match "[-:]" name)
-	       (setq name (concat (substring name 0 (match-start))
-				  ?  (substring name (match-end)))))
-	     (aset name 0 (char-upcase (aref name 0)))
-	     name))))
-
-  (define (remove-newlines string)
-    (let loop ((point 0)
-	       (out '()))
-         (if (string-match "\n" string point)
-             (loop (match-end)
-                   (list* #\space (substring string point (match-start)) out))
-           (apply concat (nreverse (cons (substring string point) out))))))
-
   (define (command-index lst x)
     (let loop ((i 0) (rest lst))
          (cond ((null rest) nil)
diff --git a/lisp/sawfish/cfg/widgets/keymap.jl b/lisp/sawfish/cfg/widgets/keymap.jl
index ee3fa84..20aaa2d 100644
--- a/lisp/sawfish/cfg/widgets/keymap.jl
+++ b/lisp/sawfish/cfg/widgets/keymap.jl
@@ -26,7 +26,8 @@
           gui.gtk-2.gtk
           rep.regexp
           sawfish.gtk.widgets.simple-dialog
-          sawfish.gtk.widget)
+          sawfish.gtk.widget
+	  sawfish.cfg.utils)
 
 ;;; widget for representing keymaps
 
@@ -85,17 +86,4 @@
 			t t (start . middle))
 		 changed-callback))
 
-  (define-widget-type 'keymap:binding make-keymap:binding-item)
-
-;;; utils
-
-  (define (beautify-symbol-name symbol)
-    (cond ((stringp symbol) symbol)
-	  ((not (symbolp symbol)) (format "%s" symbol))
-	  (t
-	   (let ((name (copy-sequence (symbol-name symbol))))
-	     (while (string-match "[-:]" name)
-	       (setq name (concat (substring name 0 (match-start))
-				  ?  (substring name (match-end)))))
-	     (aset name 0 (char-upcase (aref name 0)))
-	     (_ name))))))
+  (define-widget-type 'keymap:binding make-keymap:binding-item))
diff --git a/lisp/sawfish/cfg/widgets/match-window.jl b/lisp/sawfish/cfg/widgets/match-window.jl
index 38f2353..0f9ddcc 100644
--- a/lisp/sawfish/cfg/widgets/match-window.jl
+++ b/lisp/sawfish/cfg/widgets/match-window.jl
@@ -27,7 +27,8 @@
           rep.regexp
           sawfish.gtk.widget
           sawfish.gtk.widgets.simple-dialog
-          sawfish.cfg.wm)
+          sawfish.cfg.wm
+	  sawfish.cfg.utils)
 
   (defconst matcher-count 3)
 
@@ -179,18 +180,6 @@
       (gtk-box-pack-start hbox (gtk-label-new string))
       hbox))
 
-  ;; also in sawfish-xgettext
-  (define (beautify-symbol-name symbol)
-    (cond ((stringp symbol) symbol)
-	  ((not (symbolp symbol)) (format "%s" symbol))
-	  (t
-	   (let ((name (copy-sequence (symbol-name symbol))))
-	     (while (string-match "[-:]" name)
-	       (setq name (concat (substring name 0 (match-start))
-				  ?  (substring name (match-end)))))
-	     (aset name 0 (char-upcase (aref name 0)))
-	     (_ name)))))
-
 ;;; the main widget
 
   ;; (match-window ...)



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