[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb afafa8a 424/449: * gnorb/gnorb-registry.el: Fix c
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb afafa8a 424/449: * gnorb/gnorb-registry.el: Fix compilation warnings |
Date: |
Fri, 27 Nov 2020 23:16:25 -0500 (EST) |
branch: externals/gnorb
commit afafa8ae7a6248423f35e55a56d3b60f808dc9ad
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* gnorb/gnorb-registry.el: Fix compilation warnings
Require subr-x for hash-table-keys.
(gnorb-registry-capture): Declare org-capture vars and funs.
(gnorb-flush-dead-associations): Fix incf => cl-incf.
(gnorb-refresh-usage-status): Simplification via CSE.
(gnorb-registry-transition-from-props): Make sure gnorb-org is loaded.
---
gnorb-registry.el | 58 +++++++++++++++++++++++++++++++------------------------
1 file changed, 33 insertions(+), 25 deletions(-)
diff --git a/gnorb-registry.el b/gnorb-registry.el
index e626009..e69818c 100644
--- a/gnorb-registry.el
+++ b/gnorb-registry.el
@@ -51,6 +51,7 @@
(require 'gnus-registry)
(require 'gnorb-utils)
(require 'cl-lib)
+(eval-when-compile (require 'subr-x))
(defgroup gnorb-registry nil
"Gnorb's use of the Gnus registry."
@@ -81,6 +82,9 @@ sent. Save the relevant Org ids in the 'gnorb-ids key."
(defun gnorb-registry-capture ()
"When capturing from a Gnus message, add our new Org heading id
to the message's registry entry, under the `gnorb-ids' key."
+ ;; We're called by org-capture.
+ (declare-function org-capture-get "org-capture" (prop &optional local))
+ (defvar org-capture-plist)
(let ((orig-buff (org-capture-get :original-buffer)))
(when (and (buffer-live-p orig-buff)
(with-current-buffer
@@ -174,7 +178,7 @@ archived headings as well."
(and clean-archived
(string-match-p "org_archive$" file)))
(gnorb-delete-all-associations k)
- (incf deleted-count))))
+ (cl-incf deleted-count))))
gnorb-id-tracker)
(message "Deleted %d invalid associations"
deleted-count)))
@@ -239,9 +243,10 @@ tagged messages, and how much of the registry is occupied."
(tags (gnorb-registry-tracked-tags))
(total-occupied (length (delete-dups (append messages tagged))))
(reg-size (registry-size gnus-registry-db))
- (reg-max-size (if (slot-exists-p gnus-registry-db 'max-size)
- (oref gnus-registry-db max-size)
- (oref gnus-registry-db max-hard))))
+ (reg-max-size
+ (slot-value gnus-registry-db
+ (if (slot-exists-p gnus-registry-db 'max-size)
+ 'max-size 'max-hard))))
(with-current-buffer "*Gnorb Usage*"
(let ((inhibit-read-only t))
(erase-buffer)
@@ -284,33 +289,35 @@ and then once you're sure everything's working okay, run
it again
with a prefix arg, to clean the Gnorb-specific properties from
your Org files."
(interactive "P")
+ (require 'gnorb-org)
+ (defvar gnorb-org-find-candidates-match)
+ (defvar gnorb-org-msg-id-key)
(let ((count 0))
(message "Collecting all relevant Org headings, this could take a
while...")
(org-map-entries
(lambda ()
(let ((id (org-id-get))
(props (org-entry-get-multivalued-property
- (point) gnorb-org-msg-id-key))
- links)
- (when props
- ;; If the property is set, we should probably assume that any
- ;; Gnus links in the subtree are relevant, and should also be
- ;; collected and associated.
- (setq links (gnorb-scan-links
- (org-element-property :end (org-element-at-point))
- 'gnus))
- (dolist (l (alist-get 'gnus links))
- (gnorb-registry-make-entry
- (cl-second (split-string l "#")) nil nil
- id (cl-first (split-string l "#"))))
- (dolist (p props)
- (gnorb-registry-make-entry p nil nil id nil)
- ;; This function will try to find the group for the message
- ;; and set that value on the registry entry if it can find
- ;; it.
- (unless (gnus-registry-get-id-key p 'group)
- (gnorb-msg-id-request-head p))
- (cl-incf count)))))
+ (point) gnorb-org-msg-id-key)))
+ (when props
+ ;; If the property is set, we should probably assume that any
+ ;; Gnus links in the subtree are relevant, and should also be
+ ;; collected and associated.
+ (let ((links (gnorb-scan-links
+ (org-element-property :end (org-element-at-point))
+ 'gnus)))
+ (dolist (l (alist-get 'gnus links))
+ (gnorb-registry-make-entry
+ (cl-second (split-string l "#")) nil nil
+ id (cl-first (split-string l "#")))))
+ (dolist (p props)
+ (gnorb-registry-make-entry p nil nil id nil)
+ ;; This function will try to find the group for the message
+ ;; and set that value on the registry entry if it can find
+ ;; it.
+ (unless (gnus-registry-get-id-key p 'group)
+ (gnorb-msg-id-request-head p))
+ (cl-incf count)))))
gnorb-org-find-candidates-match
'agenda 'archive 'comment)
(message "Collecting all relevant Org headings, this could take a while...
done")
@@ -325,3 +332,4 @@ your Org files."
(message "%d entries created." count))))
(provide 'gnorb-registry)
+;;; gnorb-registry.el ends here
- [elpa] externals/gnorb e17a402 353/449: Mess with TODOs in README.org, (continued)
- [elpa] externals/gnorb e17a402 353/449: Mess with TODOs in README.org, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b53c93f 354/449: Enormous quantities of compiler-inspired fixes, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4a8fa84 369/449: Fix nnir search routine, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb dfb2acd 375/449: Bug fix in mail tracking extraction, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de4b0e8 145/449: Associate outgoing messages with arbitrary headings, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 0f18c45 311/449: Allow persistent nnir search groups, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4f62ec8 374/449: Fix inevitable screwup in previous commit, bump version, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 3b81d8c 377/449: Don't mark the 'artno key as precious, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5a88948 382/449: Fix gnorb-version command, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 2aab7c3 433/449: [gnorb] Use substitute-command-keys, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb afafa8a 424/449: * gnorb/gnorb-registry.el: Fix compilation warnings,
Stefan Monnier <=
- [elpa] externals/gnorb 16f1ab6 183/449: Make gnorb-registry-make-entry more careful, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e07c4cf 194/449: Refactor splitting of message reference headers, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a0b039c 199/449: Probably shouldn't use assoc as a symbol, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4cfd40c 207/449: Rework gnorb-org-handle-mail to use tracking, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 357c9c6 220/449: Always append function to message-exit-actions, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb cffdd60 221/449: Warn people of impending changes in README, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 294e1eb 224/449: Fix calls to gnorb-trigger-todo-action, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 73b7f47 227/449: Use org-element-map's arguments properly, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 82d1e46 230/449: New gnorb.org file, and elpaignore, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e7b8a8b 233/449: First full draft of manual, Stefan Monnier, 2020/11/27