[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 5542927 122/468: lua-automark-multiline: add func
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 5542927 122/468: lua-automark-multiline: add function to enable automatical multiline construct marking when emacs is idle |
Date: |
Thu, 5 Aug 2021 04:58:20 -0400 (EDT) |
branch: elpa/lua-mode
commit 55429279e019cea712d946e953e83aaf5037e1a1
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
lua-automark-multiline: add function to enable automatical multiline
construct marking when emacs is idle
---
lua-mode.el | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 1947a97..19da2b9 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -369,7 +369,7 @@ The following keys are bound:
nil lua-forward-sexp)))
(set (make-local-variable 'parse-sexp-lookup-properties) t)
- (lua-mark-all-multiline-literals)
+ (lua-automark-multiline 2)
(run-hooks 'lua-mode-hook)))
;;;###autoload
@@ -1270,7 +1270,26 @@ If END is nil, stop at `end-of-buffer'."
(setq ml-end (match-end 0)))
(lua-mark-multiline-region ml-begin ml-end))))))
-(provide 'lua-mode)
+(defvar lua-automark-multiline-timer nil
+ "Contains idle-timer object used for automatical multiline literal markup
which must be cleaneded up on exit")
+
+(defun lua-automark-multiline (secs)
+ "Initiate (or disable) automatical multiline construct marking
+
+If SECS is nil, disable automatical markup.
+Otherwise mark multiline constructs each time Emacs is SECS seconds idle."
+ (unless (null lua-automark-multiline-timer) ;; reset timer unconditionally
+ (cancel-timer lua-automark-multiline-timer))
+ (when secs ;; set to proper timeout if
needed
+ (add-hook 'change-major-mode-hook 'lua-mode-cleanup nil 'local)
+ (setq lua-automark-multiline-timer
+ (run-with-idle-timer secs 'repeat
'lua-mark-all-multiline-literals))
+ (lua-mark-all-multiline-literals)))
+(defun lua-mode-cleanup ()
+ "This hook is to be run within change-major-mode-hook"
+ (lua-automark-multiline nil))
+
+(provide 'lua-mode)
;;; lua-mode.el ends here
- [nongnu] elpa/lua-mode 191eb10 330/468: Makefile: add "nocask" targets, (continued)
- [nongnu] elpa/lua-mode 191eb10 330/468: Makefile: add "nocask" targets, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 25c2535 343/468: test-inferior-process: temporarily disable failing test, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e97861c 226/468: ert-tests/test-electric-mode.el: add tests for electric indentation, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ec35884 228/468: Suppress fontification messages in emacs23 test output, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c995c7a 103/468: Use beginning-of-defun-function and end-of-defun-function variables, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 91b5974 104/468: minor style fixes, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8be4f4e 108/468: .gitignore: ignore byte-compiled files, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c69e150 112/468: Makefile: add compile target, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 993e042 113/468: Merge branch 'multiline_literals', Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d742cae 116/468: lua-mark-all-multiline-literals: comment out debug message, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5542927 122/468: lua-automark-multiline: add function to enable automatical multiline construct marking when emacs is idle,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 6beb586 123/468: Add customizable lua-automark-multiline-interval variable, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode eab8fc0 136/468: Move docstrings to the end of constants., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a5cc71f 149/468: Bump version & URL, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode caa3d0c 162/468: lua-jump-to-traceback: fix compilation warning about goto-line func, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode fb53190 164/468: First part of the fix for #34, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 086736c 168/468: #36 Don't continue lines on some keywords, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b9541ce 173/468: lua-send-proc is now an alias to lua-send-defun, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8d28342 187/468: Revisit block-close unindentation logic (issue #26), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b1ac542 191/468: Major refactoring of font-lock-keywords:, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 57c696c 192/468: Add var name highlighting in "for x, y in ..." construct, Philip Kaludercic, 2021/08/05