[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(mu4e-message-at-point)
From: |
Eduardo Ochs |
Subject: |
(mu4e-message-at-point) |
Date: |
Sun, 6 Jun 2021 05:02:25 -0300 |
Hi Erich!
I want to ressurect this mailing list... can we use it for the
discussion? It seems that you are trying to write a function with
`find-find-links-links-new' - see:
(find-eev "eev-tlinks.el" "find-find-links-links-new")
http://angg.twu.net/eev-current/eev-tlinks.el.html#find-find-links-links-new
and `ee-template0', and I never wrote proper docs for that...
Here's a fixed & updated copy of the e-mail that I sent you.
You are in the right direction, but I haven't been able to make mu4e
work here yet... I have had to deal with situations similar to that a
handful of times - in which I had to learn how to use data structures
that are poorly documented - so I can sort of tell you what my hacking
tools looked like after N incarnations. I'll try to adapt them to your
case; the code is below. Note that will needs dynamic binding - see:
;; Here are some messages in help-gnu-emacs about dynamic binding
;; being deprecated:
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-06/msg00054.html
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-06/msg00085.html
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-06/msg00095.html
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2021-06/msg00096.html
Here is the code. By using `M-x m4s' to save a mu4e message in the
variable m4m we can use non-mu4e buffers for writing code and tests.
Note that the code below doesn't use `ee-template0' or
`find-find-links-links-new' yet, that will be the next step...
(setq m4m nil)
(defun m4s ()
"Save the result of (mu4e-message-at-point) in the variable m4m."
(interactive)
(setq m4m (mu4e-message-at-point)))
(defun m4-eval (msg code)
"Eval CODE in an environment in which some extra variables are available."
(let* ((xid (mu4e-message-field msg :message-id))
(xsubject (mu4e-message-field msg :subject))
(xmail-nr (mu4e-message-field msg :docid))
(xfrom (mu4e-message-field msg :from))
(fromname (car (car xfrom)))
(fromadr (cdr (car xfrom)))
(xpath (mu4e-message-field msg :path))
(xmaildir (mu4e-message-field msg :maildir))
(xto (mu4e-message-field msg :to)))
(eval code)))
;; (list (list "xid:" 'xid) (list "xsubject:" 'xsubject))
;; (find-epp (list (list "xid:" 'xid) (list "xsubject:" 'xsubject)))
(defun m4-main-fields ()
(list (list "xid:" xid)
(list "xsubject:" xsubject)
(list "xmail-nr:" xmail-nr)
(list "xfrom:" xfrom)
(list "fromname:" fromname)
(list "fromadr:" fromadr)
(list "xpath:" xpath)
(list "xmaildir:" xmaildir)
(list "xto:" xto)))
;; Tests:
;; (find-epp m4m)
;; (find-epp (m4-eval m4m 'msg))
;; (find-epp (m4-eval m4m '(m4-main-fields)))
;; (find-epp (m4-eval m4m '(list xfrom fromname)))
Please feel free to ask any questions!
Cheers, E. =)
- (mu4e-message-at-point),
Eduardo Ochs <=