aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-06-05 17:13:49 -0400
committerKyle Meyer <kyle@kyleam.com>2021-06-07 00:12:06 -0400
commit2a4f6fb5ac71e0805d145dec52a6e8e2ea6d9d76 (patch)
tree61771e9595193770d706d2e07c4912f60c8d1b93
parent941e347c49caa46c71ba9d9842e4a47270cac452 (diff)
downloadpiem-2a4f6fb5ac71e0805d145dec52a6e8e2ea6d9d76.tar.gz
lei query: Add piem-lei-show wrapper for displaying line's message
-rw-r--r--piem-lei.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/piem-lei.el b/piem-lei.el
index ed153c2..12ccd87 100644
--- a/piem-lei.el
+++ b/piem-lei.el
@@ -200,6 +200,24 @@ QUERY is split according to `split-string-and-unquote'."
(piem-lei-query-mode)
(pop-to-buffer-same-window (current-buffer))))
+(defun piem-lei-query-get-mid (&optional pos)
+ "Return message ID for position POS in a `piem-lei-query-mode' buffer.
+When POS is nil, use the position at the start of the current
+line."
+ (cdr (assq 'm (get-text-property (or pos (line-beginning-position))
+ 'piem-lei-query-result))))
+
+(defun piem-lei-query-show ()
+ "Display message for current `piem-lei-query-mode' line."
+ (interactive)
+ (display-buffer
+ (piem-lei-show
+ (or (piem-lei-query-get-mid)
+ (user-error "No Message ID associated with current line")))
+ '(display-buffer-below-selected
+ (inhibit-same-window . t)
+ (window-height . 0.8))))
+
(define-derived-mode piem-lei-query-mode special-mode "lei-query"
"Major mode for displaying overview of `lei q' results."
:group 'piem-lei