aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2023-02-03 22:09:26 +0100
committerMaciej Barć <xgqt@gentoo.org>2023-02-03 22:09:26 +0100
commit7ef272b04f1f2f3e6ee244b53c352f77daeb3e5c (patch)
treeaee386d4b03bef0323a2104fa68f4374c5112c8c
parentelogt.el: add "files" keyword (diff)
downloademacs-elogt-7ef272b04f1f2f3e6ee244b53c352f77daeb3e5c.tar.gz
emacs-elogt-7ef272b04f1f2f3e6ee244b53c352f77daeb3e5c.tar.bz2
emacs-elogt-7ef272b04f1f2f3e6ee244b53c352f77daeb3e5c.zip
elogt.el: add elogv key bindings
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r--elogt.el31
1 files changed, 29 insertions, 2 deletions
diff --git a/elogt.el b/elogt.el
index ab57dd8..c621072 100644
--- a/elogt.el
+++ b/elogt.el
@@ -197,6 +197,26 @@ Return opened buffer (done via `find-file')."
(tabulated-list-print t)
(message "The ElogT table is ready."))
+(defun elogt-sort-package ()
+ "Sort the ElogT table by package, ascending."
+ (interactive)
+ (tabulated-list-sort 2))
+
+(defun elogt-sort-category ()
+ "Sort the ElogT table by category, ascending."
+ (interactive)
+ (tabulated-list-sort 1))
+
+(defun elogt-sort-priority ()
+ "Sort the ElogT table by priority, ascending."
+ (interactive)
+ (tabulated-list-sort 0))
+
+(defun elogt-sort-time ()
+ "Sort the ElogT table by time, descending."
+ (interactive)
+ (tabulated-list-sort 3))
+
;; Major mode
@@ -205,10 +225,17 @@ Return opened buffer (done via `find-file')."
(defvar elogt-mode-map
(let ((elogt-mode-map (make-keymap)))
- (define-key elogt-mode-map (kbd "/") #'isearch-forward)
+ ;; Standard key bindings.
(define-key elogt-mode-map (kbd "o") #'elogt-open-entry)
(define-key elogt-mode-map (kbd "d") #'elogt-delete-entry)
(define-key elogt-mode-map (kbd "g") #'elogt-refresh-table)
+ ;; Elogv key bindings.
+ (define-key elogt-mode-map (kbd "A") #'elogt-sort-package)
+ (define-key elogt-mode-map (kbd "a") #'elogt-sort-category)
+ (define-key elogt-mode-map (kbd "c") #'elogt-sort-priority)
+ (define-key elogt-mode-map (kbd "t") #'elogt-sort-time)
+ ;; Miscellaneous key bindings.
+ (define-key elogt-mode-map (kbd "/") #'isearch-forward)
elogt-mode-map)
"Key map for `elogt' major mode.")
@@ -221,7 +248,7 @@ Return opened buffer (done via `find-file')."
("Package" 30 t)
("Time" 20 t)
("Size" 10 t)])
- (setq tabulated-list-sort-key (cons "Time" t))
+ (setq tabulated-list-sort-key '("Time" . t))
(run-hooks 'elogt-mode-hook)
(use-local-map elogt-mode-map))