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

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

[nongnu] elpa/nasm-mode 63d4433 62/67: allow for customization of tabs/s


From: ELPA Syncer
Subject: [nongnu] elpa/nasm-mode 63d4433 62/67: allow for customization of tabs/spaces behaviour
Date: Sun, 29 Aug 2021 11:23:53 -0400 (EDT)

branch: elpa/nasm-mode
commit 63d4433a84ee3e75de585dd3dcfd68c865ce0134
Author: Siew Yi Liang <admin@sonictk.com>
Commit: Siew Yi Liang <admin@sonictk.com>

    allow for customization of tabs/spaces behaviour
---
 nasm-mode.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/nasm-mode.el b/nasm-mode.el
index fbc1dfd..91515e1 100644
--- a/nasm-mode.el
+++ b/nasm-mode.el
@@ -51,6 +51,11 @@
   "Indentation level for `nasm-mode'."
   :group 'nasm-mode)
 
+; NOTE (sonictk) Allow for customizing behaviour of inserting tabs/spaces
+(defcustom nasm-use-tabs (default-value 't)
+  "Indentation for `nasm-mode' to use tabs/spaces. Set to ``nil`` to use 
spaces and ``t`` to use tabs."
+  :group 'nasm-mode)
+
 (defface nasm-registers
   '((t :inherit (font-lock-variable-name-face)))
   "Face for registers."
@@ -621,8 +626,12 @@ is not immediately after a mnemonic; otherwise, we insert 
a tab."
                  (bti (progn (back-to-indentation) (point))))
              (buffer-substring-no-properties bti point)))))
     (if (string-match nasm-full-instruction-regexp before)
-        ;; We are immediately after an instruction, just insert a tab
-        (insert "\t")
+        (if (equal nasm-use-tabs t)
+            ;; We are immediately after an instruction, just insert a tab
+            (insert "\t")
+            ; If tabs are not set in prefs, use the default instead
+            (insert-char ?\s nasm-basic-offset)
+        )
       ;; We're literally anywhere else, indent the whole line
       (let ((orig (- (point-max) (point))))
         (back-to-indentation)



reply via email to

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