mirror of https://github.com/djcb/mu.git
mu4e: add command mu4e-sexp-at-point
Add command ~mu4e-sexp-at-point~ for showing/hiding the s-expression for the message-at-point. Useful for development / debugging. Bound to ~,~ in headers and view mode.
This commit is contained in:
parent
619c1c81fe
commit
aea2f58c77
4
NEWS.org
4
NEWS.org
|
@ -119,6 +119,10 @@
|
||||||
- Removed header-fields ~:attachments~, ~:signature~, ~:encryption~ and
|
- Removed header-fields ~:attachments~, ~:signature~, ~:encryption~ and
|
||||||
~:user-agent~. They're obsolete with the Gnus-based message viewer.
|
~:user-agent~. They're obsolete with the Gnus-based message viewer.
|
||||||
|
|
||||||
|
- Add command ~mu4e-sexp-at-point~ for showing/hiding the s-expression for the
|
||||||
|
message-at-point. Useful for development / debugging. Bound to ~,~ in headers
|
||||||
|
and view mode.
|
||||||
|
|
||||||
- undo is now supported across message-saves
|
- undo is now supported across message-saves
|
||||||
|
|
||||||
- a lot of the internals have been changed:
|
- a lot of the internals have been changed:
|
||||||
|
|
|
@ -932,6 +932,8 @@ after the end of the search results."
|
||||||
(define-key map "t" 'mu4e-headers-mark-subthread)
|
(define-key map "t" 'mu4e-headers-mark-subthread)
|
||||||
(define-key map "T" 'mu4e-headers-mark-thread)
|
(define-key map "T" 'mu4e-headers-mark-thread)
|
||||||
|
|
||||||
|
(define-key map "," #'mu4e-sexp-at-point)
|
||||||
|
|
||||||
;; navigation between messages
|
;; navigation between messages
|
||||||
(define-key map "p" 'mu4e-headers-prev)
|
(define-key map "p" 'mu4e-headers-prev)
|
||||||
(define-key map "n" 'mu4e-headers-next)
|
(define-key map "n" 'mu4e-headers-next)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
(require 'mu4e-contacts)
|
(require 'mu4e-contacts)
|
||||||
(require 'flow-fill)
|
(require 'flow-fill)
|
||||||
(require 'shr)
|
(require 'shr)
|
||||||
|
(require 'pp)
|
||||||
|
|
||||||
(declare-function mu4e-error "mu4e-helpers")
|
(declare-function mu4e-error "mu4e-helpers")
|
||||||
(declare-function mu4e-warn "mu4e-helpers")
|
(declare-function mu4e-warn "mu4e-helpers")
|
||||||
|
@ -47,9 +48,9 @@
|
||||||
|
|
||||||
(defsubst mu4e-message-field-raw (msg field)
|
(defsubst mu4e-message-field-raw (msg field)
|
||||||
"Retrieve FIELD from message plist MSG.
|
"Retrieve FIELD from message plist MSG.
|
||||||
FIELD is one of :from, :to, :cc, :bcc, :subject, :data,
|
|
||||||
:message-id, :path, :maildir, :priority, :attachments,
|
See \"mu fields\" for the full list of field, in particular the
|
||||||
:references, :in-reply-to, :body-txt, :body-html
|
\"sexp\" column.
|
||||||
|
|
||||||
Returns nil if the field does not exist.
|
Returns nil if the field does not exist.
|
||||||
|
|
||||||
|
@ -66,13 +67,6 @@ A message plist looks something like:
|
||||||
:maildir \"/INBOX\"
|
:maildir \"/INBOX\"
|
||||||
:priority normal
|
:priority normal
|
||||||
:flags (seen)
|
:flags (seen)
|
||||||
:attachments
|
|
||||||
((:index 2 :name \"photo.jpg\" :mime-type \"image/jpeg\" :size 147331)
|
|
||||||
(:index 3 :name \"book.pdf\" :mime-type \"application/pdf\" :size 192220))
|
|
||||||
:references (\"238C8384574032D81EE81AF0114E4E74@123213.mail.example.com\"
|
|
||||||
\"6BDC23465F79238203498230942D81EE81AF0114E4E74@123213.mail.example.com\")
|
|
||||||
:in-reply-to \"238203498230942D81EE81AF0114E4E74@123213.mail.example.com\"
|
|
||||||
:body-txt \"Hi Tom, ...\"
|
|
||||||
\)).
|
\)).
|
||||||
Some notes on the format:
|
Some notes on the format:
|
||||||
- The address fields are lists of plist (:name NAME :email EMAIL),
|
- The address fields are lists of plist (:name NAME :email EMAIL),
|
||||||
|
@ -228,6 +222,19 @@ If MSG is nil, use `mu4e-message-at-point'."
|
||||||
(kill-new path)
|
(kill-new path)
|
||||||
(mu4e-message "Saved '%s' to kill-ring" path)))
|
(mu4e-message "Saved '%s' to kill-ring" path)))
|
||||||
|
|
||||||
|
(defconst mu4e--sexp-buffer-name " *mu4e-sexp-at-point"
|
||||||
|
"Buffer name for sexp buffers.")
|
||||||
|
|
||||||
|
(defun mu4e-sexp-at-point ()
|
||||||
|
"Show or hide the s-expression for the message-at-point, if any."
|
||||||
|
(interactive)
|
||||||
|
(if-let ((win (get-buffer-window mu4e--sexp-buffer-name)))
|
||||||
|
(delete-window win)
|
||||||
|
(when-let ((msg (mu4e-message-at-point 'noerror)))
|
||||||
|
(with-current-buffer-window mu4e--sexp-buffer-name nil nil
|
||||||
|
;; the "pretty-printing" is not very pretty...
|
||||||
|
(insert (pp-to-string msg))))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
(provide 'mu4e-message)
|
(provide 'mu4e-message)
|
||||||
;;; mu4e-message.el ends here
|
;;; mu4e-message.el ends here
|
||||||
|
|
|
@ -887,6 +887,7 @@ This is useful for advising some Gnus-functionality that does not work in mu4e."
|
||||||
(define-key map "E" #'mu4e-compose-edit)
|
(define-key map "E" #'mu4e-compose-edit)
|
||||||
|
|
||||||
(define-key map "." #'mu4e-view-raw-message)
|
(define-key map "." #'mu4e-view-raw-message)
|
||||||
|
(define-key map "," #'mu4e-sexp-at-point)
|
||||||
(define-key map "|" #'mu4e-view-pipe)
|
(define-key map "|" #'mu4e-view-pipe)
|
||||||
(define-key map "a" #'mu4e-view-action)
|
(define-key map "a" #'mu4e-view-action)
|
||||||
(define-key map "A" #'mu4e-view-mime-part-action)
|
(define-key map "A" #'mu4e-view-mime-part-action)
|
||||||
|
|
Loading…
Reference in New Issue