aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2023-02-03 19:16:22 +0100
committerMaciej Barć <xgqt@gentoo.org>2023-02-03 19:16:22 +0100
commit4812edd842565d31dd8f7376fe931d4edaed2cee (patch)
tree7fc6dd020dec83d36f5ad4bd2831adf3f24bac2c
parentelogt.el: message on refreshes (diff)
downloademacs-elogt-4812edd842565d31dd8f7376fe931d4edaed2cee.tar.gz
emacs-elogt-4812edd842565d31dd8f7376fe931d4edaed2cee.tar.bz2
emacs-elogt-4812edd842565d31dd8f7376fe931d4edaed2cee.zip
elogt.el: implement elogt-open-entry
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r--elogt.el21
1 files changed, 17 insertions, 4 deletions
diff --git a/elogt.el b/elogt.el
index db51cc0..46ea319 100644
--- a/elogt.el
+++ b/elogt.el
@@ -121,12 +121,25 @@ A logfile priority level is one of: None, Info, Warn, Error."
;; Table interaction
-(defun elogt-open-entry ()
+(defun elogt--entry-logfile-path (table-entry)
+ "Return a logfile path of a ElogT TABLE-ENTRY entry."
+ (format "%s/%s:%s:%s.log"
+ elogt-portage-log-dir
+ (aref table-entry 1)
+ (aref table-entry 2)
+ (aref table-entry 3)))
+
+(defun elogt--open-entry-file ()
"Open specified ElogT table entry."
- (interactive)
+ (find-file (elogt--entry-logfile-path (tabulated-list-get-entry))))
- ;; TODO: Implement.
- nil)
+(defun elogt-open-entry ()
+ "Open specified ElogT table entry and put it in a mode for viewing only."
+ (interactive)
+ (let ((buffer (elogt--open-entry-file)))
+ (with-current-buffer buffer
+ (fundamental-mode)
+ (view-mode))))
(defun elogt-delete-entry ()
"Delete specified ElogT table entry."