Adjust fontification

This commit is contained in:
Jean-Philippe Gagné Guay 2022-07-08 19:33:52 -04:00
parent f1e08702e5
commit 3f2e0788a9
2 changed files with 14 additions and 8 deletions

View file

@ -86,11 +86,11 @@ and seconds."
(concat "\\(?1:[0-9]\\{8\\}\\)\\(?2:T[0-9]\\{6\\}\\)"
"\\(?:\\(?3:--\\)\\(?4:[0-9A-Za-z-]*\\)\\)?"
"\\(?:\\(?5:__\\)\\(?6:[0-9A-Za-z_-]*\\)\\)?"
"\\(?7:\\..*\\)?")
"\\(?7:\\..*\\)?$")
"Regexp of file names for fontification.")
(defconst denote-faces-file-name-keywords
`((,denote-faces--file-name-regexp
`((,(concat " " denote-faces--file-name-regexp)
(1 'denote-faces-date)
(2 'denote-faces-time)
(3 'denote-faces-delimiter nil t)
@ -100,11 +100,17 @@ and seconds."
(7 'denote-faces-extension nil t )))
"Keywords for fontification of file names.")
(defconst denote-faces-file-name-with-subdir-keywords
(append denote-faces-file-name-keywords
'(("\\(^.*/\\)?"
(0 'denote-faces-subdirectory))))
"Keywords for fontification of file names with a directory.")
(defconst denote-faces-file-name-keywords-for-backlinks
`((,(concat "^\\(?8:.*/\\)?" denote-faces--file-name-regexp)
(8 'denote-faces-subdirectory nil t)
(1 'denote-faces-date)
(2 'denote-faces-time)
(3 'denote-faces-delimiter nil t)
(4 'denote-faces-title nil t)
(5 'denote-faces-delimiter nil t)
(6 'denote-faces-keywords nil t)
(7 'denote-faces-extension nil t )))
"Keywords for fontification of file names in the backlinks buffer.")
(provide 'denote-faces)
;;; denote-faces.el ends here

View file

@ -405,7 +405,7 @@ Use optional TITLE for a prettier heading."
files)
(goto-char (point-min))
(when denote-link-fontify-backlinks
(font-lock-add-keywords nil denote-faces-file-name-with-subdir-keywords t)))
(font-lock-add-keywords nil denote-faces-file-name-keywords-for-backlinks t)))
(denote-link--display-buffer buf)))
;;;###autoload