emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/lua-mode c61bda2 040/468: Commit from Reuben:


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode c61bda2 040/468: Commit from Reuben:
Date: Thu, 5 Aug 2021 04:58:04 -0400 (EDT)

branch: elpa/lua-mode
commit c61bda2cb2408e0ef0e1af02f7a12dbe5257dde7
Author: juergen <juergen>
Commit: juergen <juergen>

    Commit from Reuben:
    * change the contact details
    * reindent some bits that were not correctly indented (saves future
      random whitespace changes
---
 install.rst |   4 +-
 lua-mode.el | 208 ++++++++++++++++++++++++++++++------------------------------
 2 files changed, 106 insertions(+), 106 deletions(-)

diff --git a/install.rst b/install.rst
index 68d3166..a6c3e2d 100755
--- a/install.rst
+++ b/install.rst
@@ -2,8 +2,8 @@
  Lua-mode
 =============================
 
-:Author: Jürgen Hötzel
-:Contact: juergen@hoetzel.info
+:Maintainer: Reuben Thomas
+:Contact: rrt@sc3d.org
 
 .. contents::
 
diff --git a/lua-mode.el b/lua-mode.el
index 25ee419..a28cf4f 100755
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -123,7 +123,7 @@ Should be a list of strings."
   "Keymap used with lua-mode.")
 
 (defvar lua-electric-flag t
-"If t, electric actions (like automatic reindentation) will happen when an 
electric
+  "If t, electric actions (like automatic reindentation) will happen when an 
electric
  key like `{' is pressed") 
 (make-variable-buffer-local 'lua-electric-flag)
 
@@ -238,15 +238,15 @@ traceback location."
   "Abbreviation table used in lua-mode buffers.")
 
 (defvar lua-sexp-alist '(("then" . "end")
-                        ("function" . "end")
-                        ("do" . "end")))
+                         ("function" . "end")
+                         ("do" . "end")))
 
 (define-abbrev-table 'lua-mode-abbrev-table
   '(
-        ("end" "end" lua-indent-line 0)
-        ("else" "else" lua-indent-line 0)
-        ("elseif" "elseif" lua-indent-line 0)
-        ))
+    ("end" "end" lua-indent-line 0)
+    ("else" "else" lua-indent-line 0)
+    ("elseif" "elseif" lua-indent-line 0)
+    ))
 
 (defconst lua-indent-whitespace " \t"
   "Character set that constitutes whitespace for indentation in lua.")
@@ -270,7 +270,7 @@ The following keys are bound:
 "
   (interactive)
   (let ((switches nil)
-                  s)
+        s)
     (kill-all-local-variables)
     (setq major-mode 'lua-mode)
     (setq mode-name "Lua")
@@ -280,17 +280,17 @@ The following keys are bound:
     (set (make-local-variable 'comment-start) "--")
     (set (make-local-variable 'comment-start-skip) "--")
     (set (make-local-variable 'font-lock-defaults)
-                        '(lua-font-lock-keywords 
-                          nil nil ((?_ . "w")) nil
-                          (font-lock-syntactic-keywords      . 
lua-fls-keywords)
-                          (font-lock-syntactic-face-function . 
lua-fls-face-function)))
+         '(lua-font-lock-keywords 
+           nil nil ((?_ . "w")) nil
+           (font-lock-syntactic-keywords      . lua-fls-keywords)
+           (font-lock-syntactic-face-function . lua-fls-face-function)))
     (set (make-local-variable 'imenu-generic-expression)
-                        lua-imenu-generic-expression)
-         (setq local-abbrev-table lua-mode-abbrev-table)
-         (abbrev-mode 1)
+         lua-imenu-generic-expression)
+    (setq local-abbrev-table lua-mode-abbrev-table)
+    (abbrev-mode 1)
     (make-local-variable 'lua-default-eval)
     (or lua-mode-map
-                  (lua-setup-keymap))
+        (lua-setup-keymap))
     (use-local-map lua-mode-map)
     (set-syntax-table (copy-syntax-table))
     (modify-syntax-entry ?+ ".")
@@ -349,15 +349,15 @@ to `lua-mode-map', otherwise they are prefixed with 
`lua-prefix-key'."
   (define-key lua-mode-map (kbd "C-M-<home>") 'lua-beginning-of-proc)
   (define-key lua-mode-map (kbd "C-M-<end>") 'lua-end-of-proc)
   (let ((map (if lua-prefix-key
-                                          (make-sparse-keymap)
-                                        lua-mode-map)))
-
-         ;; communication
-        (define-key map "\C-l" 'lua-send-buffer)
-        (define-key map "\C-f" 'lua-search-documentation)
-         (if lua-prefix-key
-                  (define-key lua-mode-map lua-prefix-key map))
-         ))
+                 (make-sparse-keymap)
+               lua-mode-map)))
+
+    ;; communication
+    (define-key map "\C-l" 'lua-send-buffer)
+    (define-key map "\C-f" 'lua-search-documentation)
+    (if lua-prefix-key
+        (define-key lua-mode-map lua-prefix-key map))
+    ))
 
 (defun lua-electric-match (arg)
   "Insert character and adjust indentation."
@@ -380,7 +380,7 @@ to `lua-mode-map', otherwise they are prefixed with 
`lua-prefix-key'."
 
 (defun lua-comment-p ()
   "Returns true if the point is in a comment."
-    (elt (lua-syntax-status) 4))
+  (elt (lua-syntax-status) 4))
 
 (defun lua-comment-or-string-p ()
   "Returns true if the point is in a comment or string."
@@ -441,7 +441,7 @@ ignored, nil otherwise."
      "\\>\\)\\|"
      (regexp-opt '("{" "(" "[" "]" ")" "}") t))
 
-       ))
+    ))
 
 (defconst lua-block-token-alist
   ;; The absence of "else" is deliberate. This construct in a way both
@@ -466,23 +466,23 @@ ignored, nil otherwise."
 
 
 (defconst lua-indentation-modifier-regexp
-    ;; The absence of else is deliberate, since it does not modify the
-    ;; indentation level per se. It only may cause the line, in which the
-    ;; else is, to be shifted to the left.
-    ;; This is the code we used to generate the regexp:
-    (concat
-     "\\(\\<"
-     ; n.b. "local function" is a bit of a hack, allowing only a single space
-     (regexp-opt '("do" "local function" "function" "repeat" "then") t)
-     "\\>\\|"
-     (regexp-opt '("{" "(" "["))
-     "\\)\\|\\(\\<"
-     (regexp-opt '("elseif" "end" "until") t)
-     "\\>\\|"
-     (regexp-opt '("]" ")" "}"))
-     "\\)")
+  ;; The absence of else is deliberate, since it does not modify the
+  ;; indentation level per se. It only may cause the line, in which the
+  ;; else is, to be shifted to the left.
+  ;; This is the code we used to generate the regexp:
+  (concat
+   "\\(\\<"
+                                        ; n.b. "local function" is a bit of a 
hack, allowing only a single space
+   (regexp-opt '("do" "local function" "function" "repeat" "then") t)
+   "\\>\\|"
+   (regexp-opt '("{" "(" "["))
+   "\\)\\|\\(\\<"
+   (regexp-opt '("elseif" "end" "until") t)
+   "\\>\\|"
+   (regexp-opt '("]" ")" "}"))
+   "\\)")
 
-    )
+  )
 
 (defun lua-find-matching-token-word (token search-start)
   (let* ((token-info (assoc token lua-block-token-alist))
@@ -501,15 +501,15 @@ ignored, nil otherwise."
              (found-pos (match-beginning 0)))
          (if (string-match match found-token)
              (throw 'found found-pos))
-           ;; no - then there is a nested block. If we were looking for
-           ;; a block begin token, found-token must be a block end
-           ;; token; likewise, if we were looking for a block end token,
-           ;; found-token must be a block begin token, otherwise there
-           ;; is a grammatical error in the code.
-           (if (not (and
-                     (eq (car (cdr (cdr (assoc found-token 
lua-block-token-alist))))
-                         match-type)
-                     (lua-find-matching-token-word found-token nil)))
+          ;; no - then there is a nested block. If we were looking for
+          ;; a block begin token, found-token must be a block end
+          ;; token; likewise, if we were looking for a block end token,
+          ;; found-token must be a block begin token, otherwise there
+          ;; is a grammatical error in the code.
+          (if (not (and
+                    (eq (car (cdr (cdr (assoc found-token 
lua-block-token-alist))))
+                        match-type)
+                    (lua-find-matching-token-word found-token nil)))
              (throw 'found nil)))))))
 
 (defun lua-goto-matching-block-token (&optional search-start parse-start)
@@ -651,13 +651,13 @@ use standalone."
                                            (current-column))
                            lua-indent-level)))
        ((or (string-equal found-token "{")
-         (string-equal found-token "("))
+             (string-equal found-token "("))
         (save-excursion 
           ;; expression follows -> indent at start of next expression
           (if (and (not (search-forward-regexp "[[:space:]]--" 
(line-end-position) t))
                    (search-forward-regexp "[^[:space:]]" (line-end-position) 
t))
-                (cons 'absolute (1- (current-column)))
-                (cons 'relative lua-indent-level))))
+               (cons 'absolute (1- (current-column)))
+             (cons 'relative lua-indent-level))))
        ;; closing tokens follow
        ((string-equal found-token "end")
         (save-excursion
@@ -714,11 +714,11 @@ shift, or the absolute column to indent to."
        (type 'relative)
        (accu 0))
     (mapcar (lambda (x)
-           (setq accu (if (eq 'absolute (car x))
-                          (progn (setq type 'absolute)
-                                 (cdr x))
-                        (+ accu (cdr x)))))
-         info-list)
+              (setq accu (if (eq 'absolute (car x))
+                             (progn (setq type 'absolute)
+                                    (cdr x))
+                           (+ accu (cdr x)))))
+            info-list)
     (cons type accu)))
 
 (defun lua-calculate-indentation-block-modifier (&optional parse-start
@@ -810,7 +810,7 @@ to the left by the amount specified in lua-indent-level."
            (if (not (string-equal block-token last-token)) (throw 'stop nil))
            (setq indentation-modifier (+ indentation-modifier
                                          lua-indent-level))
-               (forward-char (length (match-string 0))))))
+            (forward-char (length (match-string 0))))))
       indentation-modifier)))
 
 (defun lua-calculate-indentation (&optional parse-start)
@@ -853,23 +853,23 @@ Returns t unless search stops due to beginning or end of 
buffer."
   (or arg
       (setq arg 1))
   (let ((found nil)
-                  (ret t))
+        (ret t))
     (if (and (< arg 0)
-                                 (looking-at "^function[ \t]"))
-                  (forward-char 1))
+             (looking-at "^function[ \t]"))
+        (forward-char 1))
     (while (< arg 0)
       (if (re-search-forward "^function[ \t]" nil t)
-                         (setq arg (1+ arg)
-                                         found t)
-                  (setq ret nil
-                                  arg 0)))
+          (setq arg (1+ arg)
+                found t)
+        (setq ret nil
+              arg 0)))
     (if found
-                  (beginning-of-line))
+        (beginning-of-line))
     (while (> arg 0)
       (if (re-search-backward "^function[ \t]" nil t)
-                         (setq arg (1- arg))
-                  (setq ret nil
-                                  arg 0)))
+          (setq arg (1- arg))
+        (setq ret nil
+              arg 0)))
     ret))
 
 (defun lua-end-of-proc (&optional arg)
@@ -971,11 +971,11 @@ If `lua-process' is nil or dead, start a new process 
first."
        (accept-process-output (get-buffer-process (current-buffer)))
        (goto-char (point-max))
        (setq prompt-found (and (lua-prompt-line) (< last-prompt (point-max)))))
-    ;; remove temp. lua file
-    (delete-file tempfile)
-    (lua-postprocess-output-buffer lua-process-buffer last-prompt 
lua-stdin-line-offset)    
-    (if lua-always-show
-       (display-buffer lua-process-buffer)))))
+      ;; remove temp. lua file
+      (delete-file tempfile)
+      (lua-postprocess-output-buffer lua-process-buffer last-prompt 
lua-stdin-line-offset)    
+      (if lua-always-show
+          (display-buffer lua-process-buffer)))))
 
 (defun lua-postprocess-output-buffer (buf start &optional 
lua-stdin-line-offset)
   "Highlight tracebacks found in buf. If an traceback occurred return
@@ -995,15 +995,15 @@ t, otherwise return nil.  BUF must exist."
       (lua-jump-to-traceback file line lua-stdin-line-offset)
       (setq err-p t))
     err-p))
-  
+
 (defun lua-jump-to-traceback (file line lua-stdin-line-offset)
   "Jump to the Lua code in FILE at LINE."
   ;; sanity check: temporary-file-directory
   (if (string= (substring file 0 3)  "...")
       (message "Lua traceback output truncated: customize 
'temporary-file-directory' or increase 'LUA_IDSIZE' in 'luaconf.h'.")
     (let ((buffer (cond ((or (string-equal file tempfile) (string-equal file 
"stdin"))
-                      (setq line (+ line lua-stdin-line-offset))
-                      lua-stdin-buffer)
+                         (setq line (+ line lua-stdin-line-offset))
+                         lua-stdin-buffer)
                        (t (find-file-noselect file)))))
       (pop-to-buffer buffer)
       ;; Force Lua mode
@@ -1029,8 +1029,8 @@ t, otherwise return nil.  BUF must exist."
            (comint-check-proc lua-process-buffer))
       (lua-start-process lua-default-application))
   (comint-simple-send lua-process
-                              (buffer-substring lua-region-start 
lua-region-end)
-)
+                      (buffer-substring lua-region-start lua-region-end)
+                      )
   (if lua-always-show
       (display-buffer lua-process-buffer)))
 
@@ -1047,11 +1047,11 @@ t, otherwise return nil.  BUF must exist."
              (comint-check-proc lua-process-buffer))
         (lua-start-process lua-default-application))
     (comint-simple-send lua-process
-                                (buffer-substring beg end))
+                        (buffer-substring beg end))
     (if lua-always-show
         (display-buffer lua-process-buffer))))
 
-; FIXME: This needs work... -Bret
+                                        ; FIXME: This needs work... -Bret
 (defun lua-send-buffer ()
   "Send whole buffer to lua subprocess."
   (interactive)
@@ -1097,26 +1097,26 @@ left out."
   (setq lua-electric-flag (lua-calculate-state arg lua-electric-flag)))
 
 (defun lua-forward-sexp (&optional count)
- "Forward to block end"
- (interactive "p")
- (save-match-data
- (let* ((count (or count 1))
-       (stackheight 0)
-       (block-start (mapcar 'car lua-sexp-alist))
-       (block-end (mapcar 'cdr lua-sexp-alist))
-       (block-regex (regexp-opt (append  block-start block-end) 'words))
-       current-exp
-       )
-   (while (> count 0)
-     ;; skip whitespace
-     (skip-chars-forward " \t\n")
-     (if (looking-at (regexp-opt block-start 'words)) 
-        (let ((keyword (match-string 1)))
-          (lua-find-matching-token-word keyword nil))
-       ;; If the current keyword is not a "begin" keyword, then just
-       ;; perform the normal forward-sexp.
-       (forward-sexp 1))
-     (setq count (1- count))))))
+  "Forward to block end"
+  (interactive "p")
+  (save-match-data
+    (let* ((count (or count 1))
+           (stackheight 0)
+           (block-start (mapcar 'car lua-sexp-alist))
+           (block-end (mapcar 'cdr lua-sexp-alist))
+           (block-regex (regexp-opt (append  block-start block-end) 'words))
+           current-exp
+           )
+      (while (> count 0)
+        ;; skip whitespace
+        (skip-chars-forward " \t\n")
+        (if (looking-at (regexp-opt block-start 'words)) 
+            (let ((keyword (match-string 1)))
+              (lua-find-matching-token-word keyword nil))
+          ;; If the current keyword is not a "begin" keyword, then just
+          ;; perform the normal forward-sexp.
+          (forward-sexp 1))
+        (setq count (1- count))))))
 
 
 ;; menu bar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]