Refactor buffer update logic into separate function

This commit is contained in:
Patrick Winter 2018-10-02 18:10:03 +02:00
parent 5164517e09
commit 9f50620214

View file

@ -72,12 +72,15 @@
"Open the taskwarrior buffer. If one already exists, bring it to
the front and focus it. Otherwise, create one and load the data."
(interactive)
(taskwarrior-update-buffer))
(defun taskwarrior-update-buffer ()
(let* ((buf (get-buffer-create "taskwarrior")))
(progn
(switch-to-buffer buf)
(setq font-lock-defaults '(taskwarrior-highlight-regexps))
(toggle-read-only)
(goto-char (point-min))
(toggle-read-only)
(erase-buffer)
(taskwarrior-write-entries)
(taskwarrior-mode)