branch: externals/denote
commit 3654f902e6a73a1b2cadb5bcfd9a80398db0596b
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Accept optional group in denote-retrieve--search
---
denote-retrieve.el | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/denote-retrieve.el b/denote-retrieve.el
index dd0544af99..587b551d31 100644
--- a/denote-retrieve.el
+++ b/denote-retrieve.el
@@ -56,14 +56,15 @@ group 1.")
(match-string 0 file))
(error "Cannot find `%s' as a file" file)))
-(defun denote-retrieve--search (regexp)
- "Search for REGEXP in the current buffer."
+(defun denote-retrieve--search (regexp &optional group)
+ "Search for REGEXP in the current buffer.
+With optional GROUP match it, else match group 1."
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(re-search-forward regexp nil t 1)
- (match-string-no-properties 1))))
+ (match-string-no-properties (or group 1)))))
(defun denote-retrieve--value (file regexp)
"Return REGEXP value from FILE.