diff options
author | Maciej Barć <xgqt@gentoo.org> | 2023-02-03 22:17:03 +0100 |
---|---|---|
committer | Maciej Barć <xgqt@gentoo.org> | 2023-02-03 22:17:03 +0100 |
commit | 9c05ff477f5c31a863401f93e99c35a4b34f6e32 (patch) | |
tree | 066156ef0cd726d5953a18f3f549932df95f6460 | |
parent | elogt.el: add elogv key bindings (diff) | |
download | emacs-elogt-9c05ff477f5c31a863401f93e99c35a4b34f6e32.tar.gz emacs-elogt-9c05ff477f5c31a863401f93e99c35a4b34f6e32.tar.bz2 emacs-elogt-9c05ff477f5c31a863401f93e99c35a4b34f6e32.zip |
elogt.el: name the indexes
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r-- | elogt.el | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -59,6 +59,18 @@ (warn . ,(propertize "Warn" 'font-lock-face '(:foreground "orange"))) (none . ,(propertize "None" 'font-lock-face '(:foreground "purple"))))) +(defconst elogt--index-priority 0 + "Position index of the priority field inside the ElogT table.") + +(defconst elogt--index-category 1 + "Position index of the category field inside the ElogT table.") + +(defconst elogt--index-package 2 + "Position index of the package field inside the ElogT table.") + +(defconst elogt--index-time 3 + "Position index of the time field inside the ElogT table.") + ;; Customization @@ -154,9 +166,9 @@ A logfile priority level is one of: None, Info, Warn, Error." "Return a logfile path of a given ElogT TABLE-ENTRY." (format "%s/%s:%s:%s.log" elogt-portage-log-dir - (aref table-entry 1) - (substring-no-properties (aref table-entry 2)) - (substring-no-properties (aref table-entry 3)))) + (aref table-entry elogt--index-category) + (substring-no-properties (aref table-entry elogt--index-package)) + (substring-no-properties (aref table-entry elogt--index-time)))) (defun elogt--get-table-entry-logfile-path () "Return a logfile path of current ElogT table entry." @@ -200,22 +212,22 @@ Return opened buffer (done via `find-file')." (defun elogt-sort-package () "Sort the ElogT table by package, ascending." (interactive) - (tabulated-list-sort 2)) + (tabulated-list-sort elogt--index-package)) (defun elogt-sort-category () "Sort the ElogT table by category, ascending." (interactive) - (tabulated-list-sort 1)) + (tabulated-list-sort elogt--index-category)) (defun elogt-sort-priority () "Sort the ElogT table by priority, ascending." (interactive) - (tabulated-list-sort 0)) + (tabulated-list-sort elogt--index-priority)) (defun elogt-sort-time () "Sort the ElogT table by time, descending." (interactive) - (tabulated-list-sort 3)) + (tabulated-list-sort elogt--index-time)) ;; Major mode |