changeset 104567:81d782e3337d

(gdb-mapcar*): Replacement for `mapcar*' from cl package. (gdb-table-add-row, gdb-table-string): Use `gdb-mapcar*'.
author Dmitry Dzhus <dima@sphinx.net.ru>
date Mon, 24 Aug 2009 19:12:46 +0000
parents 305e338bced3
children e6841301fe4d
files lisp/ChangeLog lisp/progmodes/gdb-mi.el
diffstat 2 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Aug 24 18:43:50 2009 +0000
+++ b/lisp/ChangeLog	Mon Aug 24 19:12:46 2009 +0000
@@ -1,3 +1,9 @@
+2009-08-24  Dmitry Dzhus  <dima@sphinx.net.ru>
+
+	* progmodes/gdb-mi.el (gdb-mapcar*): Replacement for `mapcar*'
+	from cl package.
+	(gdb-table-add-row, gdb-table-string): Use `gdb-mapcar*'.
+
 2009-08-24  Jay Belanger  <jay.p.belanger@gmail.com>
 
 	* calc/calc-alg.el (math-trig-rewrite)
--- a/lisp/progmodes/gdb-mi.el	Mon Aug 24 18:43:50 2009 +0000
+++ b/lisp/progmodes/gdb-mi.el	Mon Aug 24 19:12:46 2009 +0000
@@ -2119,6 +2119,20 @@
   (row-properties nil)
   (right-align nil))
 
+(defun gdb-mapcar* (function &rest seqs)
+  "Apply FUNCTION to each element of SEQS, and make a list of the results.
+If there are several SEQS, FUNCTION is called with that many
+arugments, and mapping stops as sson as the shortest list runs
+out."
+  (let ((shortest (apply #'min (mapcar #'length seqs))))
+    (mapcar (lambda (i)
+              (apply function
+                     (mapcar
+                      (lambda (seq)
+                        (nth i seq))
+                      seqs)))
+            (number-sequence 0 (1- shortest)))))
+
 (defun gdb-table-add-row (table row &optional properties)
   "Add ROW of string to TABLE and recalculate column sizes.
 
@@ -2136,7 +2150,7 @@
     (setf (gdb-table-row-properties table)
           (append row-properties (list properties)))
     (setf (gdb-table-column-sizes table)
-          (mapcar* (lambda (x s)
+          (gdb-mapcar* (lambda (x s)
                      (let ((new-x
                             (max (abs x) (string-width (or s "")))))
                        (if right-align new-x (- new-x))))
@@ -2152,12 +2166,12 @@
         (res ""))
     (mapconcat
      'identity
-     (mapcar*
+     (gdb-mapcar*
       (lambda (row properties)
         (apply 'propertize
                (mapconcat 'identity
-                          (mapcar* (lambda (s x) (gdb-pad-string s x))
-                                   row column-sizes)
+                          (gdb-mapcar* (lambda (s x) (gdb-pad-string s x))
+                                       row column-sizes)
                           sep)
                properties))
       (gdb-table-rows table)