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

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

[nongnu] elpa/lua-mode cd5c071 201/468: Clean up lua-mode start-up funct


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode cd5c071 201/468: Clean up lua-mode start-up function a bit
Date: Thu, 5 Aug 2021 04:58:36 -0400 (EDT)

branch: elpa/lua-mode
commit cd5c07131d0805ceedd93ac58bf981a82ba8d98b
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>

    Clean up lua-mode start-up function a bit
---
 lua-mode.el | 91 ++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 44 insertions(+), 47 deletions(-)

diff --git a/lua-mode.el b/lua-mode.el
index 8e1a774..050d7e2 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -648,53 +648,50 @@ Groups 6-9 can be used in any of argument regexps."
   :abbrev-table lua-mode-abbrev-table
   :syntax-table lua-mode-syntax-table
   :group 'lua
-  (let ((switches nil)
-        s)
-    (setq comint-prompt-regexp lua-prompt-regexp)
-    (make-local-variable 'lua-default-command-switches)
-    (set (make-local-variable 'beginning-of-defun-function)
-         'lua-beginning-of-proc)
-    (set (make-local-variable 'end-of-defun-function) 'lua-end-of-proc)
-    (set (make-local-variable 'indent-line-function) 'lua-indent-line)
-    (set (make-local-variable 'comment-start) lua-comment-start)
-    (set (make-local-variable 'comment-start-skip) lua-comment-start-skip)
-    (set (make-local-variable 'font-lock-defaults)
-         '(lua-font-lock-keywords ;; keywords
-           nil                    ;; keywords-only
-           nil                    ;; case-fold
-           ;; Not sure, why '_' is a word constituent only when font-locking.
-           ;; --immerrr
-           ((?_ . "w")) ;; syntax-alist
-           nil          ;; syntax-begin
-           (font-lock-syntactic-keywords . lua-font-lock-syntactic-keywords)
-           (font-lock-extra-managed-props . (syntax-table))))
-    
-    (set (make-local-variable 'imenu-generic-expression)
-         lua-imenu-generic-expression)
-    (make-local-variable 'lua-default-eval)
-    ;; setup menu bar entry (XEmacs style)
-    (if (and (featurep 'menubar)
-             (boundp 'current-menubar)
-             (fboundp 'set-buffer-menubar)
-             (fboundp 'add-menu)
-             (not (assoc "Lua" current-menubar)))
-        (progn
-          (set-buffer-menubar (copy-sequence current-menubar))
-          (add-menu nil "Lua" lua-emacs-menu)))
-    ;; Append Lua menu to popup menu for Emacs.
-    (if (boundp 'mode-popup-menu)
-        (setq mode-popup-menu
-              (cons (concat mode-name " Mode Commands") lua-emacs-menu)))
-
-    ;; hideshow setup
-    (unless (assq 'lua-mode hs-special-modes-alist)
-      (add-to-list 'hs-special-modes-alist
-                   `(lua-mode
-                     ,(regexp-opt (mapcar 'car lua-sexp-alist) 'words) ;start
-                     ,(regexp-opt (mapcar 'cdr lua-sexp-alist) 'words) ;end
-                     nil lua-forward-sexp)))
-
-    (set (make-local-variable 'parse-sexp-lookup-properties) t)))
+
+  (setq comint-prompt-regexp lua-prompt-regexp)
+  (make-local-variable 'lua-default-command-switches)
+  (set (make-local-variable 'font-lock-defaults)
+       '(lua-font-lock-keywords ;; keywords
+         nil                    ;; keywords-only
+         nil                    ;; case-fold
+         ;; Not sure, why '_' is a word constituent only when font-locking.
+         ;; --immerrr
+         ((?_ . "w")) ;; syntax-alist
+         nil          ;; syntax-begin
+         ;; initialize font-lock buffer-local variables
+         (font-lock-syntactic-keywords  . lua-font-lock-syntactic-keywords)
+         (font-lock-extra-managed-props . (syntax-table))
+         (parse-sexp-lookup-properties  . t)
+         ;; initialize the rest of buffer-local variables
+         (beginning-of-defun-function   . lua-beginning-of-proc)
+         (end-of-defun-function         . lua-end-of-proc)
+         (indent-line-function          . lua-indent-line)
+         (comment-start                 . lua-comment-start)
+         (comment-start-skip            . lua-comment-start-skip)
+         (imenu-generic-expression      . lua-imenu-generic-expression)))
+
+  ;; setup menu bar entry (XEmacs style)
+  (if (and (featurep 'menubar)
+           (boundp 'current-menubar)
+           (fboundp 'set-buffer-menubar)
+           (fboundp 'add-menu)
+           (not (assoc "Lua" current-menubar)))
+      (progn
+        (set-buffer-menubar (copy-sequence current-menubar))
+        (add-menu nil "Lua" lua-emacs-menu)))
+  ;; Append Lua menu to popup menu for Emacs.
+  (if (boundp 'mode-popup-menu)
+      (setq mode-popup-menu
+            (cons (concat mode-name " Mode Commands") lua-emacs-menu)))
+
+  ;; hideshow setup
+  (unless (assq 'lua-mode hs-special-modes-alist)
+    (add-to-list 'hs-special-modes-alist
+                 `(lua-mode
+                   ,(regexp-opt (mapcar 'car lua-sexp-alist) 'words) ;start
+                   ,(regexp-opt (mapcar 'cdr lua-sexp-alist) 'words) ;end
+                   nil lua-forward-sexp))))
 
 
 ;;;###autoload



reply via email to

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