Commit 4e439d4f authored by Kevin Chai's avatar Kevin Chai

omit files generated from org or markdown

parent 60305599
......@@ -697,6 +697,11 @@ or kebab-case
:type '(alist :key-type symbol :value-type sexp)
:group 'deft)
(defcustom deft-generation-rules '(("org" . "tex") ("md" . "tex"))
"rules for omitting files autogenerated, for example, tex files generated from orgmode and pandoc"
:type '(repeat (cons string string))
:group 'deft)
;; Faces
(defgroup deft-faces nil
......@@ -981,7 +986,29 @@ See `deft-find-all-files'."
(not (backup-file-name-p file))
(member (file-name-extension file) deft-extensions))
(setq result (cons file result)))))
result)))
(deft-apply-generation-rules result))))
(defun deft-apply-generation-rules (lst)
(let ((result nil))
(when deft-generation-rules
(dolist (file lst)
(when (not (deft-exported-from-previous? file deft-generation-rules result))
(setq result (cons file result))
)) result
)))
(defun deft-exported-from-previous? (file-name rules result)
(let ((val nil))
(dolist (rule rules)
(let* ((orig-file-ext (file-name-extension file-name)))
(when (equal (cdr rule) orig-file-ext)
(let* ((new-file-ext (car rule))
(new-file-name (concat (file-name-sans-extension file-name) "." new-file-ext)))
(when (not val)
(when (member new-file-name result)
(setq val t))))))) val))
(defun deft-strip-title (title)
"Remove all strings matching `deft-strip-title-regexp' from TITLE."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment