Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ Note that if TRAMP can't find the scanner configured in option ~magit-todos-scan
:TOC: :ignore descendants
:END:

** 1.8.1-pre

*Compatibility*
+ Font locking with newer versions of ~magit-section~. ([[https://github.com/alphapapa/magit-todos/issues/201][#201]], [[https://github.com/alphapapa/magit-todos/pull/203][#203]]. Thanks to [[https://github.com/mohkale][Mohsin Kaleem]].)

** 1.8

*Additions*
Expand Down
32 changes: 20 additions & 12 deletions magit-todos.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

;; Author: Adam Porter <[email protected]>
;; URL: https://github.com/alphapapa/magit-todos
;; Version: 1.8
;; Version: 1.8.1-pre
;; Package-Requires: ((emacs "26.1") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0") (transient "0.2.0"))
;; Keywords: magit, vc

Expand Down Expand Up @@ -832,11 +832,15 @@ If BRANCH-P is non-nil, do not update `magit-todos-item-cache',
;; Manual updates: Insert section to remind user
(let ((magit-insert-section--parent magit-root-section))
(magit-insert-section (todos)
(magit-insert-heading (concat (propertize magit-todos-section-heading 'face 'magit-section-heading)
(magit-insert-heading (concat (propertize magit-todos-section-heading
'face 'magit-section-heading
'font-lock-face 'magit-section-heading)
" (0)" reminder "\n")))))
(let ((section (magit-todos--insert-groups :type 'todos
:heading (format "%s (%s)%s"
(propertize magit-todos-section-heading 'face 'magit-section-heading)
(propertize magit-todos-section-heading
'face 'magit-section-heading
'font-lock-face 'magit-section-heading)
num-items reminder)
:group-fns group-fns
:items items
Expand All @@ -863,7 +867,7 @@ sections."
;; NOTE: `magit-insert-section' seems to bind `magit-section-visibility-cache' to nil, so setting
;; visibility within calls to it probably won't work as intended.
(declare (indent defun))
(let* ((indent (propertize (s-repeat (* 2 depth) " ") 'face nil))
(let* ((indent (propertize (s-repeat (* 2 depth) " ") 'face nil 'font-lock-face nil))
(heading (concat indent heading))
(magit-insert-section--parent (if (= 0 depth)
magit-root-section
Expand Down Expand Up @@ -896,7 +900,8 @@ sections."
:heading (concat
(if (and magit-todos-fontify-keyword-headers
(member group-name magit-todos-keywords-list))
(propertize group-name 'face (magit-todos--keyword-face group-name))
(let ((face (magit-todos--keyword-face group-name)))
(propertize group-name 'face face 'font-lock-face face))
group-name)
;; Item count
(if (= 1 (length group-fns))
Expand Down Expand Up @@ -929,15 +934,17 @@ sections."
;; NOTE: `magit-insert-section' seems to bind `magit-section-visibility-cache' to nil, so setting
;; visibility within calls to it probably won't work as intended.
(declare (indent defun))
(let* ((indent (propertize (s-repeat (* 2 depth) " ") 'face nil))
(let* ((indent (propertize (s-repeat (* 2 depth) " ") 'face nil 'font-lock-face nil))
(magit-insert-section--parent (if (= 0 depth)
magit-root-section
magit-insert-section--parent))
(width (- (window-text-width) depth))
(section (magit-insert-section ((eval type))
(magit-insert-heading heading)
(dolist (item items)
(let* ((filename (propertize (magit-todos-item-filename item) 'face 'magit-filename))
(let* ((filename (propertize (magit-todos-item-filename item)
'face 'magit-filename
'font-lock-face 'magit-filename))
(string (--> (concat indent
(when magit-todos-show-filenames
(when magit-todos-filename-filter
Expand Down Expand Up @@ -1114,11 +1121,12 @@ if the process's buffer has already been deleted."

(defun magit-todos--format-plain (item)
"Return ITEM formatted as from a non-Org file."
(format "%s%s %s"
(propertize (magit-todos-item-keyword item)
'face (magit-todos--keyword-face (magit-todos-item-keyword item)))
(or (magit-todos-item-suffix item) "")
(or (magit-todos-item-description item) "")))
(let ((face (magit-todos--keyword-face (magit-todos-item-keyword item))))
(format "%s%s %s"
(propertize (magit-todos-item-keyword item)
'face face 'font-lock-face face)
(or (magit-todos-item-suffix item) "")
(or (magit-todos-item-description item) ""))))

(defun magit-todos--format-org (item)
"Return ITEM formatted as from an Org file."
Expand Down