From 71e036af393543f324b9fe73077e94f295a22875 Mon Sep 17 00:00:00 2001 From: Dmitry Dzhus Date: Mon, 24 Aug 2009 19:12:46 +0000 Subject: [PATCH] (gdb-mapcar*): Replacement for `mapcar*' from cl package. (gdb-table-add-row, gdb-table-string): Use `gdb-mapcar*'. --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/gdb-mi.el | 22 ++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index eb11c0aaa8c..231b1d9c5fc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2009-08-24 Dmitry Dzhus + + * 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 * calc/calc-alg.el (math-trig-rewrite) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 4784eea0942..b5617bb2ab2 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -2119,6 +2119,20 @@ Return position where LINE begins." (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 @@ calling `gdb-table-string'." (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 @@ calling `gdb-table-string'." (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) -- 2.39.5