From 2383f98d15b782ebd01a257ea9f10afce7050f8f Mon Sep 17 00:00:00 2001 From: Quentin Aristote Date: Wed, 8 Dec 2021 12:23:29 +0100 Subject: add filters by match and scope to number-of-entries --- local/bibli-paris/bibli-paris.el | 15 +++++++++++---- 1 file 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)) -- cgit v1.2.3