[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb 5101731 150/449: Improvements to TODOs made from
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb 5101731 150/449: Improvements to TODOs made from outgoing messages |
Date: |
Fri, 27 Nov 2020 23:15:28 -0500 (EST) |
branch: externals/gnorb
commit 5101731bb45c798be28f629b0227903eae12a8a9
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Improvements to TODOs made from outgoing messages
* lisp/gnorb-gnus.el (gnorb-gnus-check-outgoing-headers): We don't need
to store quite so much information, because we're using more existing
extraction functions later on.
(gnorb-gnus-outgoing-make-todo-1): Fix basically broken capturing when
a real link is available. Add more escapes when it isn't. Use
existing functions `org-add-link-props' and `org-store-link-props' to
integrate a little better.
Continued thanks to Alan Schmitt, Gnorb's first and possibly only user.
---
lisp/gnorb-gnus.el | 65 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 40 insertions(+), 25 deletions(-)
diff --git a/lisp/gnorb-gnus.el b/lisp/gnorb-gnus.el
index e50ce12..ab7ffdd 100644
--- a/lisp/gnorb-gnus.el
+++ b/lisp/gnorb-gnus.el
@@ -245,22 +245,19 @@ information about the outgoing message into
(to (if (message-news-p)
(mail-fetch-field "Newsgroups")
(mail-fetch-field "To")))
- ;; if there are multiple To addresses, only the first will
- ;; be extracted.
- (toname (nth 1 (mail-extract-address-components to)))
- (toaddress (nth 2 (mail-extract-address-components to)))
+ (from (mail-fetch-field "From"))
(subject (mail-fetch-field "Subject"))
(date (mail-fetch-field "Date"))
- ;; if we can get a link, that's awesome
+ ;; If we can get a link, that's awesome.
(link (or (and (mail-fetch-field "Gcc")
- (call-interactively 'org-store-link))
+ (org-store-link nil))
nil)))
- ;; if we can't, then save some information so we can fake it
+ ;; If we can't, then save some information so we can fake it.
(when refs
- (setq refs (split-string refs)))
+ (setq refs (split-string refs)))
(setq gnorb-gnus-sending-message-info
`(:subject ,subject :msg-id ,msg-id
- :to ,to :toname ,toname :toaddress ,toaddress
+ :to ,to :from ,from
:link ,link :date ,date :refs ,refs))
(if org-ids
(progn
@@ -268,7 +265,7 @@ information about the outgoing message into
(setq gnorb-message-org-ids org-ids)
;; `gnorb-org-setup-message' may have put this here, but
;; if we're working from a draft, or triggering this from
- ;; a reply, it might not be there yet
+ ;; a reply, it might not be there yet.
(add-to-list 'message-exit-actions
'gnorb-org-restore-after-send))
(setq gnorb-message-org-ids nil)))))
@@ -394,25 +391,43 @@ work."
(defun gnorb-gnus-outgoing-make-todo-1 ()
(unless gnorb-gnus-new-todo-capture-key
(error "No capture template key set, customize
gnorb-gnus-new-todo-capture-key"))
- (let* ((subject (plist-get gnorb-gnus-sending-message-info :subject))
- (to (plist-get gnorb-gnus-sending-message-info :to))
- (toname (plist-get gnorb-gnus-sending-message-info :toaddress))
- (toaddress (plist-get gnorb-gnus-sending-message-info :toaddress))
+ (let* ((link (plist-get gnorb-gnus-sending-message-info :link))
(date (plist-get gnorb-gnus-sending-message-info :date))
- (msg-id (plist-get gnorb-gnus-sending-message-info :msg-id))
- (link (plist-get gnorb-gnus-sending-message-info :link))
- ;; If we actually have a link, then make use of it.
- ;; Otherwise, fake it.
- (org-capture-link-is-already-stored
- (or link t)))
- (setq org-store-link-plist
- `(:subject ,subject :to ,to :toname ,toname
- :toaddress ,toaddress :date ,date))
+ (date-ts (and date
+ (ignore-errors
+ (format-time-string
+ (org-time-stamp-format t)
+ (date-to-time date)))))
+ (date-ts-ia (and date
+ (ignore-errors
+ (format-time-string
+ (org-time-stamp-format t t)
+ (date-to-time date)))))
+ ;; Convince Org we already have a link stored, even if we
+ ;; don't.
+ (org-capture-link-is-already-stored t))
+ (if link
+ ;; Even if you make a link to not-yet-sent messages, even if
+ ;; you've saved the draft and it has a Date header, that
+ ;; header isn't saved into the link plist. So fake that, too.
+ (org-add-link-props
+ :date date
+ :date-timestamp date-ts
+ :date-timestamp-inactive date-ts-ia
+ :annotation link)
+ (org-store-link-props
+ :subject (plist-get gnorb-gnus-sending-message-info :subject)
+ :to (plist-get gnorb-gnus-sending-message-info :to)
+ :date date
+ :date-timestamp date-ts
+ :date-timestamp-inactive date-ts-ia
+ :message-id (plist-get gnorb-gnus-sending-message-info :msg-id)
+ :annotation link))
(org-capture nil gnorb-gnus-new-todo-capture-key)
(when msg-id
(org-entry-put (point) gnorb-org-msg-id-key msg-id))
- ;; it would be better to only do this if we knew the capture went
- ;; through, ie wasn't aborted
+ ;; It would be better to only do this if we knew the capture went
+ ;; through, ie wasn't aborted.
(setq gnorb-gnus-sending-message-info nil)))
;;; If an incoming message should trigger state-change for a Org todo,
- [elpa] externals/gnorb 01e7b1e 206/449: New minor mode for nnir summary buffers, (continued)
- [elpa] externals/gnorb 01e7b1e 206/449: New minor mode for nnir summary buffers, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 69ddfd3 212/449: Delete duplicate org-ids for outgoing messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 36303d9 213/449: Do a better job of dealing with reference headers, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 01645a4 215/449: Allowing fetching attachments from specific IDs, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 305a704 216/449: Don't append the message-exit-action, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d0d196f 222/449: Check prefix arg correctly, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 9a76fad 226/449: Use org-element-interpret-data to get paragraph text, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 09346e0 141/449: BBDB message link list needs closing newline, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 69980d3 143/449: Improvements to nnir-run-gnorb, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ebce811 144/449: Also check for nnir when storing BBDB message links, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5101731 150/449: Improvements to TODOs made from outgoing messages,
Stefan Monnier <=
- [elpa] externals/gnorb b841d17 146/449: Wishlist changes, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 8958546 155/449: Backquote escape fail, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 38df7d0 166/449: Ignore a notes.org file, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 44f8d23 165/449: Begin shift to using the registry, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb c280ea4 160/449: Only add relevant sent messages in the registry, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4fc1075 172/449: Rename gnorb-org-window-conf to gnorb-window-conf, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb bb44a8c 174/449: Don't force id creation!, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b596ee7 157/449: Check for success when following gnus links, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 43fbd55 176/449: New function for restoring window layout, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb fe7d814 179/449: Provide initialization of gnorb email tracking, Stefan Monnier, 2020/11/27