Merge pull request #178 from orther/handle-ivy-tasks-matching-errors

Gracefully handle +ivy-tasks match errors
This commit is contained in:
Henrik Lissner 2017-08-22 00:49:31 +02:00 committed by GitHub
commit 274afba607

View file

@ -110,11 +110,17 @@ If WORKSPACE-ONLY-P (universal arg), limit to buffers in the current workspace."
(save-match-data (save-match-data
(cl-loop with out = (shell-command-to-string cmd) (cl-loop with out = (shell-command-to-string cmd)
for x in (and out (split-string out "\n" t)) for x in (and out (split-string out "\n" t))
when (string-match when (condition-case-unless-debug ex
(concat "^\\([^:]+\\):\\([0-9]+\\):.+\\(" (string-match
(string-join task-tags "\\|") (concat "^\\([^:]+\\):\\([0-9]+\\):.+\\("
"\\):?\\s-*\\(.+\\)") (string-join task-tags "\\|")
x) "\\):?\\s-*\\(.+\\)")
x)
(error
(message! (red "Error matching task in file: (%s) %s"
(error-message-string ex)
(car (split-string x ":"))))
nil))
collect `((type . ,(match-string 3 x)) collect `((type . ,(match-string 3 x))
(desc . ,(match-string 4 x)) (desc . ,(match-string 4 x))
(file . ,(match-string 1 x)) (file . ,(match-string 1 x))