(not (string-match label item)))
collect item)))
;; TODO: respect max in `secrets-search-items', not after the fact
- (items (butlast items (- (length items) max)))
+ (items (take max items))
;; convert the item name to a full plist
(items (mapcar (lambda (item)
(append
search-keys)))
(items (plstore-find store search-spec))
(item-names (mapcar #'car items))
- (items (butlast items (- (length items) max)))
+ (items (take max items))
;; convert the item to a full plist
(items (mapcar (lambda (item)
(let* ((plist (copy-tree (cdr item)))
(cl-defmethod seq-take ((list list) n)
"Optimized implementation of `seq-take' for lists."
- (let ((result '()))
- (while (and list (> n 0))
- (setq n (1- n))
- (push (pop list) result))
- (nreverse result)))
+ (if (eval-when-compile (fboundp 'take))
+ (take n list)
+ (let ((result '()))
+ (while (and list (> n 0))
+ (setq n (1- n))
+ (push (pop list) result))
+ (nreverse result))))
(cl-defmethod seq-drop-while (pred (list list))
"Optimized implementation of `seq-drop-while' for lists."
(setq fname (car names)
lname (string-join (cdr names) " ")))
((> count 3)
- (setq fname (string-join (butlast names (- count 2))
- " ")
+ (setq fname (string-join (take 2 names) " ")
lname (string-join (nthcdr 2 names) " "))))
(when (string-match "\\(.*\\),\\'" fname)
(let ((newlname (match-string 1 fname)))
;; Loop over the registered functions.
(dolist (elt entry)
- (when (equal
- value
- (butlast (cdr elt) (- (length (cdr elt)) (length value))))
+ (when (equal value (take (length value) (cdr elt)))
(setq ret t)
;; Compute new hash value. If it is empty, remove it from the
;; hash table.
(if (>= (+ prev-line (length prev-after-lines))
(- curr-line (length before-lines)))
(setq prev-after-lines
- (butlast prev-after-lines
- (- (length prev-after-lines)
- (- curr-line prev-line (length before-lines) 1))))
+ (take (- curr-line prev-line (length before-lines) 1)
+ prev-after-lines))
;; Separate non-overlapping context lines with a dashed line.
(setq separator "-------\n")))
(should (< lead (length numbers)))
(should (<= lead loopback-index))
(should (< loopback-index (length numbers)))
- (let ((lead-part (butlast numbers (- (length numbers) lead)))
+ (let ((lead-part (take lead numbers))
(loop-part (nthcdr lead numbers)))
;; The lead part must match exactly.
(should (equal lead-part (number-sequence 1 lead)))