summaryrefslogtreecommitdiff
path: root/lisp/progmodes/gdb-mi.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/gdb-mi.el')
-rw-r--r--lisp/progmodes/gdb-mi.el28
1 files changed, 15 insertions, 13 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 9c2c6405253..c256198b3c1 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -92,6 +92,7 @@
(require 'cl-seq)
(require 'bindat)
(eval-when-compile (require 'pcase))
+(require 'subr-x) ; `string-pad'
(declare-function speedbar-change-initial-expansion-list
"speedbar" (new-default))
@@ -2511,9 +2512,8 @@ means to decode using the coding-system set for the GDB process."
;; Record transactions if logging is enabled.
(when gdb-enable-debug
(push (cons 'recv string) gdb-debug-log)
- (if (and gdb-debug-log-max
- (> (length gdb-debug-log) gdb-debug-log-max))
- (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil)))
+ (when gdb-debug-log-max
+ (setq gdb-debug-log (ntake gdb-debug-log-max gdb-debug-log))))
;; Recall the left over gud-marker-acc from last time.
(setq gud-marker-acc (concat gud-marker-acc string))
@@ -2943,7 +2943,8 @@ Return position where LINE begins."
start-posn)))
(defun gdb-pad-string (string padding)
- (format (concat "%" (number-to-string padding) "s") string))
+ (declare (obsolete string-pad "29.1"))
+ (string-pad string padding nil t))
;; gdb-table struct is a way to programmatically construct simple
;; tables. It help to reliably align columns of data in GDB buffers
@@ -2985,13 +2986,13 @@ calling `gdb-table-string'."
"Return TABLE as a string with columns separated with SEP."
(let ((column-sizes (gdb-table-column-sizes table)))
(mapconcat
- 'identity
+ #'identity
(cl-mapcar
(lambda (row properties)
- (apply 'propertize
- (mapconcat 'identity
- (cl-mapcar (lambda (s x) (gdb-pad-string s x))
- row column-sizes)
+ (apply #'propertize
+ (mapconcat #'identity
+ (cl-mapcar (lambda (s x) (string-pad s x nil t))
+ row column-sizes)
sep)
properties))
(gdb-table-rows table)
@@ -3688,10 +3689,11 @@ in `gdb-memory-format'."
(dolist (row memory)
(insert (concat (gdb-mi--field row 'addr) ":"))
(dolist (column (gdb-mi--field row 'data))
- (insert (gdb-pad-string column
- (+ 2 (gdb-memory-column-width
- gdb-memory-unit
- gdb-memory-format)))))
+ (insert (string-pad column
+ (+ 2 (gdb-memory-column-width
+ gdb-memory-unit
+ gdb-memory-format))
+ nil t)))
(newline)))
;; Show last page instead of empty buffer when out of bounds
(when gdb-memory-last-address