Sort order

This commit is contained in:
difrex 2018-06-28 21:38:30 +03:00 committed by Denis Zheleztsov
parent 7c5d2d1041
commit b3e534448d
2 changed files with 25 additions and 6 deletions

View File

@ -169,16 +169,30 @@ unread by default, but you can MARK-READ it."
"Get ECHO messages ordered by time." "Get ECHO messages ordered by time."
(let (msgs) (let (msgs)
(setq msgs (make-list 0 (make-hash-table :test 'equal))) (setq msgs (make-list 0 (make-hash-table :test 'equal)))
(dolist (l (emacsql (open-echo-db echo) (dolist (l (if idec-desc-local-echo-sort
[:select [id, tags, author, address, recipient, repto, echo, subj, body, time, unread] (and (message "Desc select")
:from messages (idec-db-desc-echo-select echo))
:order-by rowid (and (message "Normal select")
;; :desc (idec-db-normal-echo-select echo))))
]))
(if (> (length l) 0) (if (> (length l) 0)
(setq msgs (append msgs (make-list 1 (make-hash-from-msg-list l)))))) (setq msgs (append msgs (make-list 1 (make-hash-from-msg-list l))))))
msgs)) 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) (defun get-echo-subjects (echo)
"Get list of subjects from ECHO." "Get list of subjects from ECHO."
(let (subjects) (let (subjects)

View File

@ -90,6 +90,11 @@ Default to `idec-download-offset'"
:type 'string :type 'string
:group 'idec) :group 'idec)
(defcustom idec-desc-local-echo-sort nil
"Sort order in local echo display mode."
:type 'boolean
:group 'idec)
(defgroup idec-accounts nil (defgroup idec-accounts nil
"IDEC accounts settings." "IDEC accounts settings."
:group 'idec) :group 'idec)