Skip to content

Commit

Permalink
Fix: Do not pass nil to string-match
Browse files Browse the repository at this point in the history
`string-match` cannot handle nil. Adding this guard allows calfw to work
correctly again. A similar fix is needed in `emacs-calfw` as well and
has been contributed at kiwanami/emacs-calfw#155.
  • Loading branch information
vedang committed Jan 21, 2023
1 parent faf3aa6 commit 6ca5d83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions calfw-blocks.el
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ If TEXT does not have a range, return nil."
(and (stringp dotime) (string-match org-ts-regexp dotime)
(let ((date-string (match-string 1 dotime))
(extra (cfw:org-tp text 'extra)))
(if (string-match "(\\([0-9]+\\)/\\([0-9]+\\)): " extra)
(if (and extra (string-match "(\\([0-9]+\\)/\\([0-9]+\\)): " extra))
(let* ((cur-day (string-to-number
(match-string 1 extra)))
(total-days (string-to-number
Expand Down Expand Up @@ -1112,7 +1112,7 @@ If TEXT does not have a range, return nil."
(props (cfw:extract-text-props item 'face 'keymap))
(extra (cfw:org-tp item 'extra)))
(setq text (substring-no-properties text))
(when (string-match (concat "^" org-deadline-string ".*") extra)
(when (and extra (string-match (concat "^" org-deadline-string ".*") extra))
(add-text-properties 0 (length text) (list 'face (org-agenda-deadline-face 1.0)) text))
(if org-todo-keywords-for-agenda
(when (string-match (concat "^[\t ]*\\<\\(" (mapconcat 'identity org-todo-keywords-for-agenda "\\|") "\\)\\>") text)
Expand Down

0 comments on commit 6ca5d83

Please sign in to comment.