Simplify code using take, ntake and butlast
* lisp/calc/calc-vec.el (calcFunc-rhead): * lisp/calc/calc.el (calc-top-list, calc-pop): * lisp/emacs-lisp/ert.el (ert-summarize-tests-batch-and-exit): Simplify.
This commit is contained in:
parent
7ece1c4840
commit
e99d7c4d62
4 changed files with 7 additions and 17 deletions
|
|
@ -647,9 +647,7 @@
|
|||
(defun calcFunc-rhead (vec)
|
||||
(if (and (Math-vectorp vec)
|
||||
(cdr vec))
|
||||
(let ((vec (copy-sequence vec)))
|
||||
(setcdr (nthcdr (- (length vec) 2) vec) nil)
|
||||
vec)
|
||||
(butlast vec)
|
||||
(calc-record-why 'vectorp vec)
|
||||
(list 'calcFunc-rhead vec)))
|
||||
|
||||
|
|
|
|||
|
|
@ -1959,12 +1959,8 @@ See calc-keypad for details."
|
|||
(or n (setq n 1))
|
||||
(or m (setq m 1))
|
||||
(calc-check-stack (+ n m -1))
|
||||
(and (> n 0)
|
||||
(let ((top (copy-sequence (nthcdr (+ m calc-stack-top -1)
|
||||
calc-stack))))
|
||||
(setcdr (nthcdr (1- n) top) nil)
|
||||
(nreverse
|
||||
(mapcar (lambda (x) (calc-get-stack-element x sel-mode)) top)))))
|
||||
(nreverse (mapcar (lambda (x) (calc-get-stack-element x sel-mode))
|
||||
(take n (nthcdr (+ m calc-stack-top -1) calc-stack)))))
|
||||
|
||||
(defun calc-top-list-n (&optional n m sel-mode)
|
||||
(mapcar #'math-check-complete
|
||||
|
|
@ -2291,9 +2287,7 @@ the United States."
|
|||
((and (null n)
|
||||
(eq (car-safe top) 'incomplete)
|
||||
(> (length top) (if (eq (nth 1 top) 'intv) 3 2)))
|
||||
(calc-pop-push-list 1 (let ((tt (copy-sequence top)))
|
||||
(setcdr (nthcdr (- (length tt) 2) tt) nil)
|
||||
(list tt))))
|
||||
(calc-pop-push-list 1 (list (butlast top))))
|
||||
((< nn 0)
|
||||
(if (and calc-any-selections
|
||||
(calc-top-selected 1 (- nn)))
|
||||
|
|
|
|||
|
|
@ -1813,8 +1813,7 @@ Ran \\([0-9]+\\) tests, \\([0-9]+\\) results as expected\
|
|||
(unless (or (null tests) (zerop high))
|
||||
(message "\nLONG-RUNNING TESTS")
|
||||
(message "------------------")
|
||||
(setq tests (sort tests (lambda (x y) (> (car x) (car y)))))
|
||||
(when (< high (length tests)) (setcdr (nthcdr (1- high) tests) nil))
|
||||
(setq tests (ntake high (sort tests (lambda (x y) (> (car x) (car y))))))
|
||||
(message "%s" (mapconcat #'cdr tests "\n")))
|
||||
;; More details on hydra and emba, where the logs are harder to get to.
|
||||
(when (and (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI"))
|
||||
|
|
|
|||
|
|
@ -2512,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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue