平衡点
2023/08/04
_ Wanderlust の返信順ソート関数
元ネタは Re: wanderlust で GMail 風、新着レス順にソート.
flet
の挙動が変わった際には sigma/el-x: Emacs lisp extensions にある dflet
を使っていたのだけれど,
cl-letf
を使う様に書き換えてみたり.
(defun wl-summary-overview-entity-compare-by-reply-date (a b)
"Compare message A and B by latest date of replies including thread."
(cl-letf (((symbol-function 'string-max2)
(lambda (x y) (cond ((string< x y) y) ;;>
('t x))))
((symbol-function 'elmo-entity-to-number)
(lambda (x) (elt (cddr x) 0)))
((symbol-function 'thread-number-get-date)
(lambda (x) (timezone-make-date-sortable
(elmo-msgdb-overview-entity-get-date
(elmo-message-entity
wl-summary-buffer-elmo-folder
x)))))
((symbol-function 'thread-get-family)
(lambda (x)
(cons x (wl-thread-entity-get-descendant
(wl-thread-get-entity x)))))
((symbol-function 'max-reply-date)
(lambda (x) (cond ((eq 'nil x)
'nil)
((eq 'nil (cdr x))
(thread-number-get-date (car x)))
('t
(string-max2 (thread-number-get-date (car x))
(max-reply-date (cdr x)))))))
)
(string< ;;>
(max-reply-date (thread-get-family (elmo-entity-to-number a)))
(max-reply-date (thread-get-family (elmo-entity-to-number b))))))
(add-to-list 'wl-summary-sort-specs 'reply-date)
(setq wl-summary-default-sort-spec 'reply-date)
とっても場当たり的なんですが, まあ, 動くからヨシ, ということで.