From d6842eccad863894f6cfaad28fe77204bfcaed32 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Tue, 8 May 2018 20:19:38 +0300 Subject: [PATCH] Replace some custom TODO & friends highlighting with the hl-todo package --- core/prelude-core.el | 13 ------------- core/prelude-packages.el | 2 +- modules/prelude-programming.el | 15 +++++---------- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index 802cc2d..bfb98a8 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -63,19 +63,6 @@ PROMPT sets the `read-string prompt." (prelude-install-search-engine "github" "https://github.com/search?q=" "Search GitHub: ") (prelude-install-search-engine "duckduckgo" "https://duckduckgo.com/?t=lm&q=" "Search DuckDuckGo: ") -(defun prelude-todo-ov-evaporate (_ov _after _beg _end &optional _length) - (let ((inhibit-modification-hooks t)) - (if _after (ov-reset _ov)))) - -(defun prelude-annotate-todo () - "Put fringe marker on TODO: lines in the current buffer." - (interactive) - (ov-set (format "[[:space:]]*%s+[[:space:]]*TODO:" comment-start) - 'before-string - (propertize (format "A") - 'display '(left-fringe right-triangle)) - 'modification-hooks '(prelude-todo-ov-evaporate))) - (defun prelude-recompile-init () "Byte-compile all your dotfiles again." (interactive) diff --git a/core/prelude-packages.el b/core/prelude-packages.el index b1a9d97..e9ce53a 100644 --- a/core/prelude-packages.el +++ b/core/prelude-packages.el @@ -75,8 +75,8 @@ god-mode grizzl guru-mode + hl-todo imenu-anywhere - ov projectile magit move-text diff --git a/modules/prelude-programming.el b/modules/prelude-programming.el index 3fc8d63..a3f3d1b 100644 --- a/modules/prelude-programming.el +++ b/modules/prelude-programming.el @@ -35,18 +35,14 @@ (defun prelude-local-comment-auto-fill () (set (make-local-variable 'comment-auto-fill-only-comments) t)) -(defun prelude-font-lock-comment-annotations () - "Highlight a bunch of well known comment annotations. - -This functions should be added to the hooks of major modes for programming." - (font-lock-add-keywords - nil '(("\\<\\(\\(FIX\\(ME\\)?\\|TODO\\|OPTIMIZE\\|HACK\\|REFACTOR\\):\\)" - 1 font-lock-warning-face t)))) - ;; show the name of the current function definition in the modeline (require 'which-func) (which-function-mode 1) +;; font-lock annotations like TODO in source code +(require 'hl-todo) +(global-hl-todo-mode 1) + ;; in Emacs 24 programming major modes generally derive from a common ;; mode named prog-mode; for others, we'll arrange for our mode ;; defaults function to run prelude-prog-mode-hook directly. To @@ -74,8 +70,7 @@ This functions should be added to the hooks of major modes for programming." (guru-mode +1)) (smartparens-mode +1) (prelude-enable-whitespace) - (prelude-local-comment-auto-fill) - (prelude-font-lock-comment-annotations)) + (prelude-local-comment-auto-fill)) (setq prelude-prog-mode-hook 'prelude-prog-mode-defaults)