summaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorQuentin Aristote <quentin@aristote.fr>2021-12-08 12:23:29 +0100
committerQuentin Aristote <quentin@aristote.fr>2021-12-08 12:23:29 +0100
commit2383f98d15b782ebd01a257ea9f10afce7050f8f (patch)
tree6f632aea5a3bd3d4edf01ea0172e62a83bd1b40d /local
parentd1355587c369361e5ff9012ef81992f5fdd90b25 (diff)
add filters by match and scope to number-of-entries
Diffstat (limited to 'local')
-rw-r--r--local/bibli-paris/bibli-paris.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/local/bibli-paris/bibli-paris.el b/local/bibli-paris/bibli-paris.el
index c7d399e..eb8f172 100644
--- a/local/bibli-paris/bibli-paris.el
+++ b/local/bibli-paris/bibli-paris.el
@@ -81,10 +81,17 @@
(car csv-entry))
;;;###autoload
-(defun bibli-paris/number-of-entries ()
- "Return the number library entries in the current buffer."
- (interactive)
- (let ((result (length (org-map-entries (lambda () t)))))
+(defun bibli-paris/number-of-entries (&optional match scope)
+ "Return the number of library entries selected by MATCH in SCOPE. See also the
+[[https://orgmode.org/manual/Using-the-Mapping-API.html][Org mapping API]] for
+more on MATCH and SCOPE."
+ (interactive "sMatch : \nSScope : ")
+ (let ((result (length
+ (org-map-entries (lambda () t)
+ (unless (string-equal "" match)
+ match)
+ (unless (string-equal "" (symbol-name scope))
+ scope)))))
(message "%d" result)
result))