mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Use take where clearly safe to do so (bug#56521)
* lisp/emacs-lisp/seq.el (seq-take): * lisp/auth-source.el (auth-source-secrets-search) (auth-source-plstore-search): * lisp/gnus/message.el (message-insert-formatted-citation-line): * lisp/net/dbus.el (dbus-unregister-object): * lisp/replace.el (occur-context-lines): * test/src/print-tests.el (print-circular): Replace hand-written loop or `butlast` call with `take` for clarity, performance and validation. We have the equivalence (take N LIST) = (butlast LIST (- (length LIST) N)).
This commit is contained in:
parent
2d97fe2710
commit
5ad8f3e570
6 changed files with 14 additions and 16 deletions
|
|
@ -1622,7 +1622,7 @@ authentication tokens:
|
|||
(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
|
||||
|
|
@ -2080,7 +2080,7 @@ entries for git.gnus.org:
|
|||
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)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue