diff --git a/idec-db.el b/idec-db.el index ff5e3d8..08602c5 100644 --- a/idec-db.el +++ b/idec-db.el @@ -169,16 +169,30 @@ unread by default, but you can MARK-READ it." "Get ECHO messages ordered by time." (let (msgs) (setq msgs (make-list 0 (make-hash-table :test 'equal))) - (dolist (l (emacsql (open-echo-db echo) - [:select [id, tags, author, address, recipient, repto, echo, subj, body, time, unread] - :from messages - :order-by rowid - ;; :desc - ])) + (dolist (l (if idec-desc-local-echo-sort + (and (message "Desc select") + (idec-db-desc-echo-select echo)) + (and (message "Normal select") + (idec-db-normal-echo-select echo)))) (if (> (length l) 0) (setq msgs (append msgs (make-list 1 (make-hash-from-msg-list l)))))) msgs)) +(defun idec-db-normal-echo-select (echo) + "Select from ECHO in normal order." + (emacsql (open-echo-db echo) + [:select [id, tags, author, address, recipient, repto, echo, subj, body, time, unread] + :from messages + :order-by rowid])) + +(defun idec-db-desc-echo-select (echo) + "Select from ECHO in desc order." + (emacsql (open-echo-db echo) + [:select [id, tags, author, address, recipient, repto, echo, subj, body, time, unread] + :from messages + :order-by rowid + :desc])) + (defun get-echo-subjects (echo) "Get list of subjects from ECHO." (let (subjects) diff --git a/idec-mode.el b/idec-mode.el index c862809..b141a0f 100644 --- a/idec-mode.el +++ b/idec-mode.el @@ -90,6 +90,11 @@ Default to `idec-download-offset'" :type 'string :group 'idec) +(defcustom idec-desc-local-echo-sort nil + "Sort order in local echo display mode." + :type 'boolean + :group 'idec) + (defgroup idec-accounts nil "IDEC accounts settings." :group 'idec)