emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/gnorb a9d7518 113/449: Make sure we're visiting an id w


From: Stefan Monnier
Subject: [elpa] externals/gnorb a9d7518 113/449: Make sure we're visiting an id when we cache it
Date: Fri, 27 Nov 2020 23:15:20 -0500 (EST)

branch: externals/gnorb
commit a9d75184e8864dffa8e35c0bb831f4a93bd44251
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Make sure we're visiting an id when we cache it
    
    This might want some further rethinking at some point, anyway it works.
    
    lisp/gnorb-org.el: Function `gnorb-org-add-id-hash-entry' will sometimes
                   need to visit the proper heading first.
    
    lisp/gnorb-utils.el: Function `gnorb-trigger-todo-action' needs to tell
                     `gnorb-org-add-id-hash-entry where to go.
---
 lisp/gnorb-org.el   | 23 +++++++++++++++++++++++
 lisp/gnorb-utils.el |  2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/lisp/gnorb-org.el b/lisp/gnorb-org.el
index 41821e3..0a4511f 100644
--- a/lisp/gnorb-org.el
+++ b/lisp/gnorb-org.el
@@ -433,6 +433,29 @@ current heading."
                  (append (list new-val) old-val)
                (list new-val))
              gnorb-msg-id-to-heading-table))))
+(defun gnorb-org-add-id-hash-entry (msg-id &optional marker)
+  (org-with-point-at (or marker (point))
+    (let ((old-val (gethash msg-id gnorb-msg-id-to-heading-table))
+         (new-val (list
+                   (org-id-get-create)
+                   (append
+                    (list
+                     (file-name-nondirectory
+                      (buffer-file-name
+                       (current-buffer))))
+                    (org-get-outline-path)
+                    (list
+                     (org-no-properties
+                      (replace-regexp-in-string
+                       org-bracket-link-regexp
+                       "\\3"
+                       (nth 4 (org-heading-components)))))))))
+      (unless (member (car new-val) old-val)
+       (puthash msg-id
+                (if old-val
+                    (append (list new-val) old-val)
+                  (list new-val))
+                gnorb-msg-id-to-heading-table)))))
 
 (defun gnorb-org-populate-id-hash ()
   "Scan all agenda files for headings with the
diff --git a/lisp/gnorb-utils.el b/lisp/gnorb-utils.el
index 40f8acd..7e26cf3 100644
--- a/lisp/gnorb-utils.el
+++ b/lisp/gnorb-utils.el
@@ -131,7 +131,7 @@ the prefix arg."
       (when sent-id
        (org-entry-add-to-multivalued-property
         root-marker gnorb-org-msg-id-key sent-id)
-       (gnorb-org-add-id-hash-entry sent-id))
+       (gnorb-org-add-id-hash-entry sent-id root-marker))
       (setq action (cond ((not
                           (or (and ret-dest-todo
                                    (null gnorb-org-mail-todos))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]