Skip to content

Commit

Permalink
Add to use timer.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Aug 2, 2020
1 parent 78a819d commit 9987fa0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion atl-markup.el
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
:type 'string
:group 'atl-markup)

(defcustom atl-markup-delay 0.1
"Time delay to active auto truncate lines for markup languages."
:type 'float
:group 'atl-markup)

(defvar atl-markup--timer nil
"Timer to active auto truncate lines.")

;;; Util

(defun atl-markup--inside-comment-block-p ()
Expand Down Expand Up @@ -82,7 +90,10 @@

(defun atl-markup--post-command-hook ()
"Post command hook to do auto truncate lines in current buffer."
(atl-markup--web-truncate-lines-by-face))
(when (timerp atl-markup--timer)
(cancel-timer atl-markup--timer)
(setq atl-markup--timer nil))
(run-with-idle-timer atl-markup-delay nil 'atl-markup--web-truncate-lines-by-face))

(defun atl-markup--enable ()
"Enable 'atl-markup-mode'."
Expand Down

0 comments on commit 9987fa0

Please sign in to comment.