branch: externals/bufferlo commit 85aa26a6ba5c5ba7d94355c1526951c862bf703c Author: Florian Rommel <m...@florommel.de> Commit: Florian Rommel <m...@florommel.de>
Use seq-mapcat Simplifies the code. --- bufferlo.el | 55 ++++++++++++++++++++++++------------------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/bufferlo.el b/bufferlo.el index 4a87f21319..61ed0d8abc 100644 --- a/bufferlo.el +++ b/bufferlo.el @@ -358,11 +358,11 @@ If FRAME is nil, the current frame is selected. If TABNUM is nil, the current tab is selected. If TABNUM is \\='all, all tabs of the frame are selected." (cond ((eq tabnum 'all) - (seq-uniq (mapcan (lambda (tb) - (if (eq 'current-tab (car tb)) - (bufferlo--current-buffers frame) - (bufferlo--get-tab-buffers tb))) - (funcall tab-bar-tabs-function frame)))) + (seq-uniq (seq-mapcat (lambda (tb) + (if (eq 'current-tab (car tb)) + (bufferlo--current-buffers frame) + (bufferlo--get-tab-buffers tb))) + (funcall tab-bar-tabs-function frame)))) (tabnum (let ((tab (nth tabnum (funcall tab-bar-tabs-function frame)))) (if (eq 'current-tab (car tab)) @@ -512,29 +512,25 @@ and ignore EXCLUDE-TABNUM." (let* ((exclude-tab (when (and exclude-tabnum (not (eq exclude-tabnum 'all))) (nth exclude-tabnum (funcall tab-bar-tabs-function exclude-frame)))) - (flatten (lambda (list) - (apply #'append (append list '(nil))))) (get-inactive-tabs-buffers (lambda (f) - (funcall flatten - (mapcar - (lambda (tb) - (unless (and (eq f exclude-frame) - (or (eq exclude-tabnum 'all) - (eq tb exclude-tab))) - (bufferlo--get-tab-buffers tb))) - (funcall tab-bar-tabs-function f))))) + (seq-mapcat + (lambda (tb) + (unless (and (eq f exclude-frame) + (or (eq exclude-tabnum 'all) + (eq tb exclude-tab))) + (bufferlo--get-tab-buffers tb))) + (funcall tab-bar-tabs-function f)))) (get-frames-buffers (lambda () - (funcall flatten - (mapcar - (lambda (f) - (unless (and (eq f exclude-frame) - (or (eq exclude-tabnum 'all) - (not exclude-tab) - (eq 'current-tab (car exclude-tab)))) - (bufferlo--current-buffers f))) - (frame-list)))))) + (seq-mapcat + (lambda (f) + (unless (and (eq f exclude-frame) + (or (eq exclude-tabnum 'all) + (not exclude-tab) + (eq 'current-tab (car exclude-tab)))) + (bufferlo--current-buffers f))) + (frame-list))))) (seq-uniq (append (seq-mapcat get-inactive-tabs-buffers (frame-list)) (funcall get-frames-buffers))))) @@ -651,8 +647,6 @@ This does not select the buffer -- just the containing frame and tab." (interactive "b") (bufferlo--warn) (let* ((buffer (get-buffer buffer-or-name)) - (flatten (lambda (list) - (apply #'append (append list '())))) (search-tabs (lambda (f) (let ((i 0)) (mapcar @@ -674,11 +668,10 @@ This does not select the buffer -- just the containing frame and tab." (eq f (selected-frame)) nil nil))))))) (candidates (seq-filter 'identity - (funcall flatten - (mapcar - (lambda (f) - (funcall search-frames f)) - (frame-list))))) + (seq-mapcat + (lambda (f) + (funcall search-frames f)) + (frame-list)))) (candidates (mapcar (lambda (c) (let ((sel (if (nth 2 c) " [this]" ""))