From a25a41213fb9948d5e99f122a3e7e51589a741db Mon Sep 17 00:00:00 2001 From: fpi Date: Tue, 23 Feb 2021 10:10:14 +0100 Subject: Strip some meta information from deft results --- emacs-init.org | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'emacs-init.org') diff --git a/emacs-init.org b/emacs-init.org index 372078b..8e4a986 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -5058,7 +5058,31 @@ creation. (deft-default-extension "org") (deft-use-filename-as-title nil) (deft-recursive t) - (deft-use-filter-string-for-filename t))) + (deft-use-filter-string-for-filename t) + <>)) +#+end_src +Most org files start with meta information on lines starting with ~#+~, but also sometimes ~:PROPERTIES:~ drawers. We can exclude these lines from the preview content =Deft= displays with regular expressions. I first noticed this setting in [[https://github.com/hsinhaoyu/.emacs.d/blob/master/config.org][this config by hsin-hao yu]]. Define ~deft-strip-summary-regexp~ to match a group of expressions. +#+begin_src emacs-lisp :tangle no :noweb-ref deft-custom +(deft-strip-summary-regexp + (rx (group (or + space + <> + )))) +#+end_src + +Match ~#+~ based meta lines. +#+begin_src emacs-lisp :tangle no :noweb-ref deft-strip-summary-regexps +(seq bol "#+" (+ (any alpha ?_)) ?: (* any) eol) +#+end_src +Match all drawer lines, including the content. +#+begin_src emacs-lisp :tangle no :noweb-ref deft-strip-summary-regexps +(seq bol ?: (*? (not ?:)) ?: (*? (or any "\n")) ":END:") +#+end_src +Match some formatted standard additional information at the start of files. +#+begin_src emacs-lisp :tangle no :noweb-ref deft-strip-summary-regexps +(seq bol "- tags ::" (* any) eol) +(seq bol "- links ::" (* any) eol) +(seq bol "- source ::" (* any) eol) #+end_src [[https://github.com/EFLS/zetteldeft][Zetteldeft]] provides further functions to search and link between -- cgit v1.2.3