aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2023-02-03 20:23:40 +0100
committerMaciej Barć <xgqt@gentoo.org>2023-02-03 20:23:40 +0100
commit9fd888528a6ced9bc55349cd667efd31caeb1ff2 (patch)
tree89a9a7cb38b8606d41865994a5377050dbb655e0
parentelogt.el: lower Emacs version requirements to 24.3 (diff)
downloademacs-elogt-9fd888528a6ced9bc55349cd667efd31caeb1ff2.tar.gz
emacs-elogt-9fd888528a6ced9bc55349cd667efd31caeb1ff2.tar.bz2
emacs-elogt-9fd888528a6ced9bc55349cd667efd31caeb1ff2.zip
elogt.el: show logfile size
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r--elogt.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/elogt.el b/elogt.el
index 8e73d48..c5c20a6 100644
--- a/elogt.el
+++ b/elogt.el
@@ -25,7 +25,7 @@
;; Version: 0.0.0
;; Keywords: convenience
;; Homepage: https://gitweb.gentoo.org/proj/emacs-elogt.git
-;; Package-Requires: ((emacs "24.3"))
+;; Package-Requires: ((emacs "27.1"))
;; SPDX-License-Identifier: GPL-2.0-or-later
@@ -116,10 +116,16 @@ A logfile priority level is one of: None, Info, Warn, Error."
((member 'warn found-stars) (elogt--priority-level-property 'warn))
(t (elogt--priority-level-property 'info)))))
+(defun elogt--file-size (file-path)
+ "Return size of a given file at FILE-PATH."
+ (file-size-human-readable-iec
+ (file-attribute-size (file-attributes file-path))))
+
(defun elogt--logfile-properties (file-name)
"Extract the properties form given FILE-NAME."
- (apply #'vector (cons (elogt--logfile-priority-level file-name)
- (split-string (file-name-base file-name) ":"))))
+ (apply #'vector `(,(elogt--logfile-priority-level file-name)
+ ,@(split-string (file-name-base file-name) ":")
+ ,(elogt--file-size file-name))))
(defun elogt--make-log-table-contents ()
"Make ElogT table contents."
@@ -203,7 +209,8 @@ Return opened buffer (done via `find-file')."
[("Priority" 10 t)
("Category" 20 t)
("Package" 30 t)
- ("Time" 20 t)])
+ ("Time" 20 t)
+ ("Size" 10 t)])
(setq tabulated-list-sort-key (cons "Time" t))
(run-hooks 'elogt-mode-hook)
(use-local-map elogt-mode-map))