[uim-commit] r3116 - trunk/emacs

nosuke at freedesktop.org nosuke at freedesktop.org
Sat Feb 18 01:24:57 PST 2006


Author: nosuke
Date: 2006-02-18 01:24:53 -0800 (Sat, 18 Feb 2006)
New Revision: 3116

Modified:
   trunk/emacs/prop.c
   trunk/emacs/uim.el
Log:
* emacs/uim.el
* emacs/prop.c
  - Add partial support of new helper protocol.



Modified: trunk/emacs/prop.c
===================================================================
--- trunk/emacs/prop.c	2006-02-17 20:22:10 UTC (rev 3115)
+++ trunk/emacs/prop.c	2006-02-18 09:24:53 UTC (rev 3116)
@@ -118,6 +118,7 @@
 show_prop(property *prop)
 {
   char *buf;
+  char *head, *tail;
   char *p[4];
   
   /* output new prop_list for Emacs */
@@ -134,25 +135,32 @@
   buf = (char *)malloc(strlen(prop->list) + 1);
   strcpy(buf, prop->list);
 
-  p[0] = buf;
+  head = buf;
 
-  while (p[0] && *p[0]) { 
+  while (head && *head) { 
 
-	p[1] = strchr(p[0], '\n');
+	/* 
+	 * head: beginning of each line
+	 * tail: end of each line 
+	 * p[n]: token
+	 */
+	tail = strchr(head, '\n');
 
-	if (p[1]) 
-	  *p[1] = '\0';
+	if (tail)
+	  *tail = '\0';
 	else
 	  break;
 
-	/* p[0] always not equal NULL */
-	if (strlen(p[0]) >= 6 && strncmp(p[0], "branch", 6) == 0) {
-	  if ((p[2] = strchr(p[0], '\t')) && (p[3] = strchr(p[2] + 1, '\t'))) {
-		*p[2] = *p[3] = '\0';
-		a_printf(" ( \"%s\" \"%s\" ) ", p[2] + 1, p[3] + 1);
+	/* head always not equal NULL */
+	if (strlen(head) >= 6 && strncmp(head, "branch", 6) == 0) {
+	  if ((p[0] = strchr(head, '\t')) 
+		  && (p[1] = strchr(p[0] + 1, '\t'))
+		  && (p[2] = strchr(p[1] + 1, '\t'))) {
+		*p[0] = *p[1] = *p[2] = '\0';
+		a_printf(" ( \"%s\" \"%s\" \"%s\" ) ", p[0] + 1, p[1] + 1, p[2] + 1);
 	  }
 	}
-	p[0] = p[1] + 1;
+	head = tail + 1;
   }
 
   free(buf);

Modified: trunk/emacs/uim.el
===================================================================
--- trunk/emacs/uim.el	2006-02-17 20:22:10 UTC (rev 3115)
+++ trunk/emacs/uim.el	2006-02-18 09:24:53 UTC (rev 3116)
@@ -576,26 +576,14 @@
 ;; Update property label
 ;;
 (defun uim-update-label (label)
-  ;; label: ( ("label_abbr"  "label") ... )
-  (let (label1 label2 mode-str)
-    ;; current IM engine name
-    (setq label1 (car label))
-    (setq label (cdr label))
-
-    (when label
-      (setq label2 (car label)))
-
-    ;; Update mode-line string to "label1 label2".
-    (setq mode-str (format "%s" (car label1)))
-
-    (if label2 
-	(setq mode-str (concat mode-str (format "%s" (car label2)))))
-
+  ;; label: ( ("indication_id" "iconic_label"  "buttontooltip_string") ... )
+  (let ((mode-str ""))
+    (mapcar
+     '(lambda (x)
+	(setq mode-str (concat mode-str (nth 1 x))))
+     label)
     (setq uim-mode-line-string 
-	  (format " U %s[%s]" uim-current-im-engine mode-str))
-
-
-    )
+	  (format " U %s[%s]" uim-current-im-engine mode-str)))
   )
 
 



More information about the uim-commit mailing list