APPROVE COMMIT 21.5
# HG changeset patch
# Parent eec2a31de9d67f78b606314136ed13abb364046d
Sort buffers list before truncating.
diff -r eec2a31de9d6 lisp/ChangeLog
--- a/lisp/ChangeLog Sat Apr 22 00:23:36 2017 +0100
+++ b/lisp/ChangeLog Tue Nov 14 14:02:31 2017 +0900
@@ -156,6 +156,11 @@
* subr.el (safe-length): New. Moved here from data.c, there's no
indication to have this in C.
+2017-01-25 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * gutter-items.el (buffers-tab-items):
+ Sort list before shortening, clarify logic, remove comment.
+
2017-01-15 Aidan Kehoe <kehoea(a)parhasard.net>
* subr.el (with-output-to-string):
diff -r eec2a31de9d6 lisp/gutter-items.el
--- a/lisp/gutter-items.el Sat Apr 22 00:23:36 2017 +0100
+++ b/lisp/gutter-items.el Tue Nov 14 14:02:31 2017 +0900
@@ -261,7 +261,7 @@
;; context buffer before they get run.
(let* ((buffers (delete-if
buffers-tab-omit-function (buffer-list frame)))
- (first-buf (car buffers)) tail)
+ (first-buf (car buffers)))
;; maybe force the selected window
(when (and force-selection
(not in-deletion)
@@ -282,16 +282,16 @@
buffers-tab-filter-functions)
(list buffer)))
buffers)))
- ;; maybe shorten list of buffers
- (let ((n (1-
- ;; Error on non-number, non-nil buffers-tab-max-size
- (or buffers-tab-max-size most-positive-fixnum))))
- (and (> n 0)
- (setf tail (nthcdr n buffers)) ;; Length greater than (1+ n)?
- (setf (cdr tail) nil)))
;; sort buffers in group (default is most-recently-selected)
(when buffers-tab-sort-function
(setq buffers (funcall buffers-tab-sort-function buffers)))
+ ;; maybe shorten list of buffers
+ (when (fixnump buffers-tab-max-size)
+ (let ((n (1- buffers-tab-max-size))
+ tail)
+ (and (> n 0)
+ (setf tail (nthcdr n buffers)) ;; Length greater than (1+ n)?
+ (setf (cdr tail) nil)))
(labels
((build-buffers-tab-internal (buffers)
"Convert BUFFERS to a list of structures used by the tab widget."
Show replies by date