branch: elpa/nasm-mode commit 5b0d30f3281ba46d379ad7bcf390f03b91b74e67 Author: Charlie Green <geek0...@gmail.com> Commit: Christopher Wellons <well...@nullprogram.com>
Allow prefix in point following mnemonic check This allows inserting tabs after more complex instructions, too. --- nasm-mode.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nasm-mode.el b/nasm-mode.el index 17776d9..933f728 100644 --- a/nasm-mode.el +++ b/nasm-mode.el @@ -553,6 +553,14 @@ "\\s-+\\([a-zA-Z0-9_$#@~.?]+\\)") 2)) "Expressions for `imenu-generic-expression'.") +(defconst nasm-full-instruction-regexp + (eval-when-compile + (let ((pfx (nasm--opt nasm-prefix)) + (ins (nasm--opt nasm-instructions))) + (concat "^\\(" pfx "\\s-+\\)?" ins "$"))) + "Regexp for `nasm-mode' matching a valid full NASM instruction field. +This includes prefixes or modifiers (eg \"mov\", \"rep mov\", etc match)") + (defconst nasm-font-lock-keywords `((,nasm-section-name-regexp (1 'nasm-section-name)) (,(nasm--opt nasm-registers) . 'nasm-registers) @@ -607,7 +615,7 @@ is not immediately after a mnemonic; otherwise, we insert a tab." (let ((point (point)) (bti (progn (back-to-indentation) (point)))) (buffer-substring-no-properties bti point))))) - (if (member before nasm-instructions) + (if (string-match nasm-full-instruction-regexp before) ;; We are immediately after an instruction, just insert a tab (insert "\t") ;; We're literally anywhere else, indent the whole line