Merge pull request #525 from bixuanzju/2-commits-squashed

Simplify `prelude-annotate-todo`, make it evaporate when modified.
This commit is contained in:
Bozhidar Batsov 2014-05-26 09:44:37 +03:00
commit db2dcb82e4
2 changed files with 11 additions and 9 deletions

View file

@ -34,6 +34,7 @@
(require 'thingatpt) (require 'thingatpt)
(require 'dash) (require 'dash)
(require 'ov)
(defun prelude-open-with (arg) (defun prelude-open-with (arg)
"Open visited file in default external program. "Open visited file in default external program.
@ -181,18 +182,18 @@ point reaches the beginning or end of the buffer, stop there."
(mark-defun) (mark-defun)
(indent-region (region-beginning) (region-end)))) (indent-region (region-beginning) (region-end))))
(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 () (defun prelude-annotate-todo ()
"Put fringe marker on TODO: lines in the curent buffer." "Put fringe marker on TODO: lines in the curent buffer."
(interactive) (interactive)
(save-excursion (ov-set (format "[[:space:]]*%s+[[:space:]]*TODO:" comment-start)
(goto-char (point-min))
(while (re-search-forward
(format "[[:space:]]*%s+[[:space:]]*TODO:" comment-start) nil t)
(let ((overlay (make-overlay (- (point) 5) (point))))
(overlay-put overlay
'before-string 'before-string
(propertize (format "A") (propertize (format "A")
'display '(left-fringe right-triangle))))))) 'display '(left-fringe right-triangle))
'modification-hooks '(prelude-todo-ov-evaporate)))
(defun prelude-copy-file-name-to-clipboard () (defun prelude-copy-file-name-to-clipboard ()
"Copy the current buffer file name to the clipboard." "Copy the current buffer file name to the clipboard."

View file

@ -61,6 +61,7 @@
gitignore-mode gitignore-mode
grizzl grizzl
guru-mode guru-mode
ov
projectile projectile
magit magit
move-text move-text