summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfpi2021-02-23 10:10:14 +0100
committerfpi2022-03-17 14:37:57 +0100
commita25a41213fb9948d5e99f122a3e7e51589a741db (patch)
treef2b2dab18e9f486cf65d555c04868dd1323af177
parentAdd support for rust development (diff)
Strip some meta information from deft results
-rw-r--r--emacs-init.org26
1 files changed, 25 insertions, 1 deletions
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)
+ <<deft-custom>>))
+#+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
+ <<deft-strip-summary-regexps>>
+ ))))
+#+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