[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode d91bf2b 011/468: new buffer-local variable: lua-e
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode d91bf2b 011/468: new buffer-local variable: lua-electric-flag |
Date: |
Thu, 5 Aug 2021 04:57:58 -0400 (EDT) |
branch: elpa/lua-mode
commit d91bf2b1f3a36d2c1e8147d2e0760595b482ce4a
Author: juergen <juergen>
Commit: juergen <juergen>
new buffer-local variable: lua-electric-flag
new function: lua-toggle-electric-state
---
lua-mode.el | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 698783f..b7f5857 100755
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -28,7 +28,7 @@
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
;; MA 02110-1301, USA.
-(defconst lua-version "20060528"
+(defconst lua-version "20060620"
"Lua Mode version number.")
;; Keywords: languages, processes, tools
@@ -119,6 +119,11 @@ Should be a list of strings."
(defvar lua-mode-map nil
"Keymap used with lua-mode.")
+(defvar lua-electric-flag t
+"If t, electric actions (like automatic reindentation) will happen when an
electric
+ key like `{' is pressed")
+(make-variable-buffer-local 'lua-electric-flag)
+
(defcustom lua-prefix-key "\C-c"
"Prefix for all lua-mode commands."
:type 'string
@@ -329,7 +334,8 @@ to `lua-mode-map', otherwise they are prefixed with
`lua-prefix-key'."
"Insert character and adjust indentation."
(interactive "P")
(insert-char last-command-char (prefix-numeric-value arg))
- (lua-indent-line)
+ (if lua-electric-flag
+ (lua-indent-line))
(blink-matching-open))
;;}}}
@@ -1133,7 +1139,29 @@ t, otherwise return nil. BUF must exist."
(browse-url (concat lua-search-url-prefix (current-word t))))
;;}}}
+;;{{{ lua-calculate-state
+
+(defun lua-calculate-state (arg prevstate)
+ ;; Calculate the new state of PREVSTATE, t or nil, based on arg. If
+ ;; arg is nil or zero, toggle the state. If arg is negative, turn
+ ;; the state off, and if arg is positive, turn the state on
+ (if (or (not arg)
+ (zerop (setq arg (prefix-numeric-value arg))))
+ (not prevstate)
+ (> arg 0)))
+
+;;}}}
+;;{{{ lua-toggle-electric-state
+(defun lua-toggle-electric-state (&optional arg)
+ "Toggle the electric indentation feature.
+Optional numeric ARG, if supplied, turns on electric indentation when
+positive, turns it off when negative, and just toggles it when zero or
+left out."
+ (interactive "P")
+ (setq lua-electric-flag (lua-calculate-state arg lua-electric-flag)))
+
+;;}}}
;;{{{ menu bar
(define-key lua-mode-menu [restart-with-whole-file]
- [nongnu] branch elpa/lua-mode created (now 7ee3feb), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 001fff1 001/468: Initial revision, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 99230fc 002/468: code cleanup: removed duplicate code from lua-send-buffer, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode fb12d2b 003/468: lua-send-region: create temporary file to send lua code as one chunk, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 05a9513 004/468: fixed copyright notice, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode f9cbb91 007/468: make lua-process-buffer and lua-process global, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c13235f 008/468: fixed indention, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d91bf2b 011/468: new buffer-local variable: lua-electric-flag,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 6a7929a 013/468: lua-postprocess-output-buffer: match first error, not last, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 78f7b78 014/468: emacs-compatibility: replace-in-string not available on GNU emacs, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ea5c4a1 015/468: Documentation: Added installation notes, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9d20d58 019/468: fold mode cleanup, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 78fc3ba 005/468: lua-postprocess-output-buffer: jump to lua errors in source files, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8802c43 006/468: fixed lua-postprocess-output-buffer: start search from last prompt, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3d6f6ed 012/468: enforce interactive mode by default: (defcustom lua-default-command-switches (list "-i")..., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8ab6df6 026/468: Fix bug #619: Wrong identation with .. operator, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d313ff5 024/468: New Release: 20061208, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 31acb6b 029/468: Fix bug #621: Wrong comment block detection, Philip Kaludercic, 2021/08/05