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

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

[elpa] externals/gnorb 4f302fa 205/449: New gnorb-collect-ids utility fu


From: Stefan Monnier
Subject: [elpa] externals/gnorb 4f302fa 205/449: New gnorb-collect-ids utility function
Date: Fri, 27 Nov 2020 23:15:40 -0500 (EST)

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

    New gnorb-collect-ids utility function
    
    * lisp/gnorb-utils.el (gnorb-collect-ids): New function
    * lisp/nngnorb.el (nnir-run-gnorb): Use new function
---
 lisp/gnorb-utils.el | 16 ++++++++++++++++
 lisp/nngnorb.el     |  6 ++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/lisp/gnorb-utils.el b/lisp/gnorb-utils.el
index 49015c3..6ac1c99 100644
--- a/lisp/gnorb-utils.el
+++ b/lisp/gnorb-utils.el
@@ -300,6 +300,22 @@ methods?"
       (when (featurep 'notmuch)
        nil))))
 
+(defun gnorb-collect-ids (&optional id)
+  "Collect all Org IDs for a subtree.
+
+Starting with the heading under point (or the heading indicated
+by the ID argument), collect its ID property, and the IDs of all
+child headings."
+  (save-excursion
+    (save-restriction
+      (when id
+       (org-id-goto id))
+      (org-narrow-to-subtree)
+      (org-element-map (org-element-parse-buffer)
+         'headline
+       (lambda (hl)
+         (org-element-property :ID hl))))))
+
 ;; Loading the registry
 
 (defvar gnorb-tracking-enabled nil
diff --git a/lisp/nngnorb.el b/lisp/nngnorb.el
index 8b99ac9..2beb224 100644
--- a/lisp/nngnorb.el
+++ b/lisp/nngnorb.el
@@ -92,10 +92,8 @@ be scanned for gnus messages, and those messages displayed."
                 (org-narrow-to-subtree)
                 (setq org-ids
                       (append
-                       (org-element-map (org-element-parse-buffer)
-                           'headline
-                         (lambda (hl) (org-element-property :ID hl)))
-                              org-ids)))))
+                       (gnorb-collect-ids)
+                       org-ids)))))
            ((listp q)
             ;; be a little careful: this could be a list of links, or
             ;; it could be the full plist



reply via email to

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