Skip to content

Commit 9987fa0

Browse files
committed
Add to use timer.
1 parent 78a819d commit 9987fa0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

atl-markup.el

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
:type 'string
4444
:group 'atl-markup)
4545

46+
(defcustom atl-markup-delay 0.1
47+
"Time delay to active auto truncate lines for markup languages."
48+
:type 'float
49+
:group 'atl-markup)
50+
51+
(defvar atl-markup--timer nil
52+
"Timer to active auto truncate lines.")
53+
4654
;;; Util
4755

4856
(defun atl-markup--inside-comment-block-p ()
@@ -82,7 +90,10 @@
8290

8391
(defun atl-markup--post-command-hook ()
8492
"Post command hook to do auto truncate lines in current buffer."
85-
(atl-markup--web-truncate-lines-by-face))
93+
(when (timerp atl-markup--timer)
94+
(cancel-timer atl-markup--timer)
95+
(setq atl-markup--timer nil))
96+
(run-with-idle-timer atl-markup-delay nil 'atl-markup--web-truncate-lines-by-face))
8697

8798
(defun atl-markup--enable ()
8899
"Enable 'atl-markup-mode'."

0 commit comments

Comments
 (0)