[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 6beb586 123/468: Add customizable lua-automark-mu
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 6beb586 123/468: Add customizable lua-automark-multiline-interval variable |
Date: |
Thu, 5 Aug 2021 04:58:20 -0400 (EDT) |
branch: elpa/lua-mode
commit 6beb586e55612634c2f2ca0a95f26c2e9791e89e
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
Add customizable lua-automark-multiline-interval variable
---
lua-mode.el | 44 +++++++++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 15 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 19da2b9..aa2939b 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -87,6 +87,9 @@
;;; Code:
+(eval-when-compile
+ (require 'cl))
+
(require 'comint)
;; Local variables
@@ -369,7 +372,8 @@ The following keys are bound:
nil lua-forward-sexp)))
(set (make-local-variable 'parse-sexp-lookup-properties) t)
- (lua-automark-multiline 2)
+ (lua-mark-all-multiline-literals)
+ (lua--automark-multiline-update-timer)
(run-hooks 'lua-mode-hook)))
;;;###autoload
@@ -1273,22 +1277,32 @@ If END is nil, stop at `end-of-buffer'."
(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)
+(defun lua--automark-multiline-update-timer ()
+ (lua--automark-multiline-cleanup) ;; reset previous timer if it existed
+ (when lua-automark-multiline-interval
+ (add-hook 'change-major-mode-hook 'lua--automark-multiline-cleanup nil
'local)
(setq lua-automark-multiline-timer
- (run-with-idle-timer secs 'repeat
'lua-mark-all-multiline-literals))
- (lua-mark-all-multiline-literals)))
+ (run-with-idle-timer lua-automark-multiline-interval 'repeat
+ 'lua-mark-all-multiline-literals))))
+
+(defun lua--automark-multiline-cleanup ()
+ "Disable automatical multiline construct marking"
+ (unless (null lua-automark-multiline-timer)
+ (cancel-timer lua-automark-multiline-timer)
+ (setq lua-automark-multiline-timer nil)))
+
+(defun lua--customize-set-automark-multiline-interval (symbol value)
+ (set symbol value)
+ (dolist (buf (buffer-list))
+ (with-current-buffer buf
+ (when (eq major-mode 'lua-mode)
+ (lua--automark-multiline-update-timer)))))
-(defun lua-mode-cleanup ()
- "This hook is to be run within change-major-mode-hook"
- (lua-automark-multiline nil))
+(defcustom lua-automark-multiline-interval 1
+ "If not 0, specifies idle time in seconds after which lua-mode will mark
multiline literals."
+ :group 'lua
+ :type 'integer
+ :set 'lua--customize-set-automark-multiline-interval)
(provide 'lua-mode)
- [nongnu] elpa/lua-mode 25c2535 343/468: test-inferior-process: temporarily disable failing test, (continued)
- [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, 2021/08/05
- [nongnu] elpa/lua-mode 6beb586 123/468: Add customizable lua-automark-multiline-interval variable,
Philip Kaludercic <=
- [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
- [nongnu] elpa/lua-mode 97ce427 198/468: Restore compatibility with Emacs23 broken by commit 8d28342, Philip Kaludercic, 2021/08/05