From 83c6ce3f2f0e6e2489378a276c71ea1e031bc419 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 21 Apr 2017 14:31:58 -0400 Subject: [PATCH] Update todotxt config - new storage location - new binding - fix autoloads - function to open sub lists --- .emacs.d/init.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 3d452fd..11d55f8 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -345,10 +345,15 @@ (smart-tabs-insinuate 'c 'c++ 'javascript)) (use-package todotxt-mode + :commands (todotxt-open-file todotxt-mode) + :bind ("C-c t" . todotxt-open-file) + :init + (setq todotxt-base-path (expand-file-name "~/Documents/todo") + todotxt-default-file (concat todotxt-base-path "/todo.txt") + todotxt-default-archive-file (concat todotxt-base-path "/done.txt")) + (add-to-list 'auto-mode-alist `(,(concat todotxt-base-path "/.*\\.txt$") . todotxt-mode)) :config - (setq todotxt-default-file (expand-file-name "~/Sync/todo/todo.txt") - todotxt-default-archive-file (expand-file-name "~/Sync/todo/done.txt") - todotxt-due-tag "due" + (setq todotxt-due-tag "due" todotxt-mode-keywords '(("^x .*$" 0 '(:foreground "gray80" :strike-through t)) ("^(A) " 0 '(:foreground "red")) @@ -364,7 +369,13 @@ ("#waiting" 0 '(:foreground "dark orange")) ; special tag ("#\\w+" . font-lock-comment-face) ("-\\([a-zA-Z_-]+\\)" . font-lock-variable-name-face) - ("^[0-9]+-[0-9]+-[0-9]+" 0 '(:foreground "gray90"))))) + ("^[0-9]+-[0-9]+-[0-9]+" 0 '(:foreground "gray90")))) + (defun todotxt-open-sub () + "Opens the todotxt sub on current line" + (interactive) + (let ((line (thing-at-point 'line t))) + (string-match "\\([^ ]+\\)/:\\([.A-Za-z0-9_]+\\)" line) + (find-file (concat (match-string 1 line) "/" (match-string 2 line)))))) (use-package latex :bind (:map LaTeX-mode-map