Simplify prelude-annotate-todo
, make it evaporate when modified.
This commit is contained in:
parent
3bed971d1a
commit
d82fc1f45f
2 changed files with 11 additions and 9 deletions
|
@ -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.
|
||||||
|
@ -176,18 +177,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))
|
'before-string
|
||||||
(while (re-search-forward
|
(propertize (format "A")
|
||||||
(format "[[:space:]]*%s+[[:space:]]*TODO:" comment-start) nil t)
|
'display '(left-fringe right-triangle))
|
||||||
(let ((overlay (make-overlay (- (point) 5) (point))))
|
'modification-hooks '(prelude-todo-ov-evaporate)))
|
||||||
(overlay-put overlay
|
|
||||||
'before-string
|
|
||||||
(propertize (format "A")
|
|
||||||
'display '(left-fringe right-triangle)))))))
|
|
||||||
|
|
||||||
(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."
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
gitignore-mode
|
gitignore-mode
|
||||||
grizzl
|
grizzl
|
||||||
guru-mode
|
guru-mode
|
||||||
|
ov
|
||||||
projectile
|
projectile
|
||||||
magit
|
magit
|
||||||
move-text
|
move-text
|
||||||
|
|
Loading…
Reference in a new issue