From 2a4f6fb5ac71e0805d145dec52a6e8e2ea6d9d76 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 5 Jun 2021 17:13:49 -0400 Subject: lei query: Add piem-lei-show wrapper for displaying line's message Message-Id: <20210605211402.20304-6-kyle@kyleam.com> --- piem-lei.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- cgit v1.2.3