[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb ec44a6d 182/449: Continue shifting candidate find
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb ec44a6d 182/449: Continue shifting candidate finding to the registry |
Date: |
Fri, 27 Nov 2020 23:15:35 -0500 (EST) |
branch: externals/gnorb
commit ec44a6dd43744bd73eb0511d1d58cc9fbb387b53
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Continue shifting candidate finding to the registry
* lisp/gnorb-org.el (gnorb-org-add-id-hash-entry): Move function to
gnorb-registry.el
(gnorb-org-populate-id-hash): Move function to gnorb-registry.el
* lisp/gnorb-utils.el (gnorb-msg-id-to-heading-table): Move defvar to
gnorb-registry.el
* lisp/gnorb-registry.el: Accept all the above
---
lisp/gnorb-org.el | 47 --------------------------------------------
lisp/gnorb-registry.el | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++
lisp/gnorb-utils.el | 6 ------
3 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/lisp/gnorb-org.el b/lisp/gnorb-org.el
index fa08264..36822a5 100644
--- a/lisp/gnorb-org.el
+++ b/lisp/gnorb-org.el
@@ -559,53 +559,6 @@ current heading."
from cc bcc
attachments text org-id))))))
-(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
- (org-base-buffer (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
- `gnorb-org-msg-id-key' property, and construct a hash table of
- message-ids as keys, and org headings as values -- actually
- two-element lists representing the heading's id and outline
- path."
- ;; where are all the places where we might conceivably want to
- ;; refresh this?
- (interactive)
- (setq gnorb-msg-id-to-heading-table
- (make-hash-table
- :test 'equal :size 100))
- (let (props)
- (org-map-entries
- (lambda ()
- (setq props
- (org-entry-get-multivalued-property
- (point) gnorb-org-msg-id-key))
- (dolist (p props)
- (gnorb-org-add-id-hash-entry p)))
- gnorb-org-find-candidates-match
- 'agenda 'archive 'comment)))
-
;;; Email subtree
(defcustom gnorb-org-email-subtree-text-parameters nil
diff --git a/lisp/gnorb-registry.el b/lisp/gnorb-registry.el
index ff5e47e..7304a8f 100644
--- a/lisp/gnorb-registry.el
+++ b/lisp/gnorb-registry.el
@@ -55,6 +55,12 @@
:tag "Gnorb Registry"
:group 'gnorb)
+(defvar gnorb-msg-id-to-heading-table nil
+ "Hash table where keys are message-ids, and values are lists of
+ org headings which have that message-id in their GNORB_MSG_ID
+ property. Values are actually two-element lists: the heading's
+ id, and its outline path.")
+
(defun gnorb-registry-make-entry (msg-id sender subject org-id group)
"Create a Gnus registry entry for a message, either received or
sent. Save the relevant Org ids in the 'gnorb-ids key."
@@ -99,4 +105,51 @@ values in their `gnorb-org-org-msg-id-key' property."
(setq ret-val (append sub-val ret-val))))
ret-val))
+(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
+ (org-base-buffer (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
+ `gnorb-org-msg-id-key' property, and construct a hash table of
+ message-ids as keys, and org headings as values -- actually
+ two-element lists representing the heading's id and outline
+ path."
+ ;; where are all the places where we might conceivably want to
+ ;; refresh this?
+ (interactive)
+ (setq gnorb-msg-id-to-heading-table
+ (make-hash-table
+ :test 'equal :size 100))
+ (let (props)
+ (org-map-entries
+ (lambda ()
+ (setq props
+ (org-entry-get-multivalued-property
+ (point) gnorb-org-msg-id-key))
+ (dolist (p props)
+ (gnorb-org-add-id-hash-entry p)))
+ gnorb-org-find-candidates-match
+ 'agenda 'archive 'comment)))
+
(provide 'gnorb-registry)
diff --git a/lisp/gnorb-utils.el b/lisp/gnorb-utils.el
index 63d4953..7d598a8 100644
--- a/lisp/gnorb-utils.el
+++ b/lisp/gnorb-utils.el
@@ -66,12 +66,6 @@
(defvar gnorb-tmp-dir (make-temp-file "emacs-gnorb" t)
"Temporary directory where attachments etc are saved.")
-(defvar gnorb-msg-id-to-heading-table nil
- "Hash table where keys are message-ids, and values are lists of
- org headings which have that message-id in their GNORB_MSG_ID
- property. Values are actually two-element lists: the heading's
- id, and its outline path.")
-
(defvar gnorb-message-org-ids nil
"List of Org heading IDs from the outgoing Gnus message, used
to mark mail TODOs as done once the message is sent."
- [elpa] externals/gnorb de3182e 263/449: Shift location of org-reveal during trigger process, (continued)
- [elpa] externals/gnorb de3182e 263/449: Shift location of org-reveal during trigger process, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6246244 106/449: Hinting for potentially-relevant incoming messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a79cf72 126/449: Unwrap "if" from around function, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 0255247 133/449: Only notice records on message receipt, not sending, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b70d845 168/449: Handle nil group values in registry entries, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 880afd6 158/449: Register sent messages so we can view them later, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 25aa0f1 173/449: Use a marker in conjunction with window conf, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e1129e9 170/449: Fix problems when BBDB is not present and gnorb-bbdb is not loaded., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5f96b98 167/449: Stupid typo, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 9a2f747 175/449: Don't hint messages in nnir or virtual summaries, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ec44a6d 182/449: Continue shifting candidate finding to the registry,
Stefan Monnier <=
- [elpa] externals/gnorb 927e401 184/449: New function for restoring window layout, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a352586 189/449: Improve lookups for entries with unknown groups, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 81fed4b 193/449: Helper function for transitioning to the new system, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d7327b5 192/449: The big switch! Rely only on registry for tracking, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 7ba1786 196/449: Use gnorb-gnus-message-info for incoming and outgoing, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 0cb4d1a 201/449: Docstring for gnorb-scan-links, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5c9ef6e 203/449: Don't create Org IDs when scanning for mails, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 9ac84b7 218/449: Return links in the order which they were found, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a9535ae 223/449: Merge branch 'registry', Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb dd4e013 225/449: Restore action shouldn't quit summary buffer, Stefan Monnier, 2020/11/27