diff options
| author | Dmitry Dzhus | 2009-08-24 19:12:46 +0000 |
|---|---|---|
| committer | Dmitry Dzhus | 2009-08-24 19:12:46 +0000 |
| commit | 71e036af393543f324b9fe73077e94f295a22875 (patch) | |
| tree | e0b92aa0e225f835bffe1998e99cf46bfc16c00c | |
| parent | 42110eaf95a7ca8c08d15926e901eb0301e8a751 (diff) | |
| download | emacs-71e036af393543f324b9fe73077e94f295a22875.tar.gz emacs-71e036af393543f324b9fe73077e94f295a22875.zip | |
(gdb-mapcar*): Replacement for `mapcar*'
from cl package.
(gdb-table-add-row, gdb-table-string): Use `gdb-mapcar*'.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2009-08-24 Dmitry Dzhus <dima@sphinx.net.ru> | ||
| 2 | |||
| 3 | * progmodes/gdb-mi.el (gdb-mapcar*): Replacement for `mapcar*' | ||
| 4 | from cl package. | ||
| 5 | (gdb-table-add-row, gdb-table-string): Use `gdb-mapcar*'. | ||
| 6 | |||
| 1 | 2009-08-24 Jay Belanger <jay.p.belanger@gmail.com> | 7 | 2009-08-24 Jay Belanger <jay.p.belanger@gmail.com> |
| 2 | 8 | ||
| 3 | * calc/calc-alg.el (math-trig-rewrite) | 9 | * 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." | |||
| 2119 | (row-properties nil) | 2119 | (row-properties nil) |
| 2120 | (right-align nil)) | 2120 | (right-align nil)) |
| 2121 | 2121 | ||
| 2122 | (defun gdb-mapcar* (function &rest seqs) | ||
| 2123 | "Apply FUNCTION to each element of SEQS, and make a list of the results. | ||
| 2124 | If there are several SEQS, FUNCTION is called with that many | ||
| 2125 | arugments, and mapping stops as sson as the shortest list runs | ||
| 2126 | out." | ||
| 2127 | (let ((shortest (apply #'min (mapcar #'length seqs)))) | ||
| 2128 | (mapcar (lambda (i) | ||
| 2129 | (apply function | ||
| 2130 | (mapcar | ||
| 2131 | (lambda (seq) | ||
| 2132 | (nth i seq)) | ||
| 2133 | seqs))) | ||
| 2134 | (number-sequence 0 (1- shortest))))) | ||
| 2135 | |||
| 2122 | (defun gdb-table-add-row (table row &optional properties) | 2136 | (defun gdb-table-add-row (table row &optional properties) |
| 2123 | "Add ROW of string to TABLE and recalculate column sizes. | 2137 | "Add ROW of string to TABLE and recalculate column sizes. |
| 2124 | 2138 | ||
| @@ -2136,7 +2150,7 @@ calling `gdb-table-string'." | |||
| 2136 | (setf (gdb-table-row-properties table) | 2150 | (setf (gdb-table-row-properties table) |
| 2137 | (append row-properties (list properties))) | 2151 | (append row-properties (list properties))) |
| 2138 | (setf (gdb-table-column-sizes table) | 2152 | (setf (gdb-table-column-sizes table) |
| 2139 | (mapcar* (lambda (x s) | 2153 | (gdb-mapcar* (lambda (x s) |
| 2140 | (let ((new-x | 2154 | (let ((new-x |
| 2141 | (max (abs x) (string-width (or s ""))))) | 2155 | (max (abs x) (string-width (or s ""))))) |
| 2142 | (if right-align new-x (- new-x)))) | 2156 | (if right-align new-x (- new-x)))) |
| @@ -2152,12 +2166,12 @@ calling `gdb-table-string'." | |||
| 2152 | (res "")) | 2166 | (res "")) |
| 2153 | (mapconcat | 2167 | (mapconcat |
| 2154 | 'identity | 2168 | 'identity |
| 2155 | (mapcar* | 2169 | (gdb-mapcar* |
| 2156 | (lambda (row properties) | 2170 | (lambda (row properties) |
| 2157 | (apply 'propertize | 2171 | (apply 'propertize |
| 2158 | (mapconcat 'identity | 2172 | (mapconcat 'identity |
| 2159 | (mapcar* (lambda (s x) (gdb-pad-string s x)) | 2173 | (gdb-mapcar* (lambda (s x) (gdb-pad-string s x)) |
| 2160 | row column-sizes) | 2174 | row column-sizes) |
| 2161 | sep) | 2175 | sep) |
| 2162 | properties)) | 2176 | properties)) |
| 2163 | (gdb-table-rows table) | 2177 | (gdb-table-rows table) |