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 'dash)
(require 'ov)
(defun prelude-open-with (arg)
"Open visited file in default external program.
@ -181,18 +182,18 @@ point reaches the beginning or end of the buffer, stop there."
(mark-defun)
(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 ()
"Put fringe marker on TODO: lines in the curent buffer."
(interactive)
(save-excursion
(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
(propertize (format "A")
'display '(left-fringe right-triangle)))))))
(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-copy-file-name-to-clipboard ()
"Copy the current buffer file name to the clipboard."

View file

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