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."
(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)

View File

@ -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)