[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nasm-mode 64e450d 54/67: Allow inserting tabs immediately
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nasm-mode 64e450d 54/67: Allow inserting tabs immediately after a mnemonic |
Date: |
Sun, 29 Aug 2021 11:23:51 -0400 (EDT) |
branch: elpa/nasm-mode
commit 64e450d3c6c29f50368d53309d7cc96bd2f47423
Author: Charlie Green <geek0795@gmail.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Allow inserting tabs immediately after a mnemonic
This required a change to `nasm-indent-line'.
---
nasm-mode.el | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/nasm-mode.el b/nasm-mode.el
index 6f8e68a..9753218 100644
--- a/nasm-mode.el
+++ b/nasm-mode.el
@@ -594,19 +594,31 @@
(nasm-indent-line))
(defun nasm-indent-line ()
- "Indent current line as NASM assembly code."
+ "Indent current line (or insert a tab) as NASM assembly code.
+This will be called by `indent-for-tab-command' when TAB is
+pressed. We indent the entire line as appropriate whenever POINT
+is not immediately after a mnemonic; otherwise, we insert a tab."
(interactive)
- (let ((orig (- (point-max) (point))))
- (back-to-indentation)
- (if (or (looking-at (nasm--opt nasm-directives))
- (looking-at (nasm--opt nasm-pp-directives))
- (looking-at "\\[")
- (looking-at ";;+")
- (looking-at nasm-label-regexp))
- (indent-line-to 0)
- (indent-line-to nasm-basic-offset))
- (when (> (- (point-max) orig) (point))
- (goto-char (- (point-max) orig)))))
+ (let ((before ; text before point and after indentation
+ (save-excursion
+ (let ((point (point))
+ (bti (progn (back-to-indentation) (point))))
+ (buffer-substring-no-properties bti point)))))
+ (if (member before nasm-instructions)
+ ;; We are immediately after an instruction, just insert a tab
+ (insert "\t")
+ ;; We're literally anywhere else, indent the whole line
+ (let ((orig (- (point-max) (point))))
+ (back-to-indentation)
+ (if (or (looking-at (nasm--opt nasm-directives))
+ (looking-at (nasm--opt nasm-pp-directives))
+ (looking-at "\\[")
+ (looking-at ";;+")
+ (looking-at nasm-label-regexp))
+ (indent-line-to 0)
+ (indent-line-to nasm-basic-offset))
+ (when (> (- (point-max) orig) (point))
+ (setf (point) (- (point-max) orig)))))))
(defun nasm--current-line ()
"Return the current line as a string."
- [nongnu] elpa/nasm-mode 9f05280 23/67: Adjust package description., (continued)
- [nongnu] elpa/nasm-mode 9f05280 23/67: Adjust package description., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode e641c8a 24/67: Flesh out a little more commentary., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode f62c103 25/67: Add preprocessor directives:, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 2940e4f 27/67: Run all regexp-opt at compile time (faster loads)., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 6e208d5 29/67: Indent single-commented lines differently., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode e015f41 30/67: Split out types, like word, dword, qword, etc., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 42ee760 32/67: Allow to change faces used by nasm-mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 2259c7d 34/67: Properly distinguish word and symbol constituents., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode e978f6e 35/67: Don't use 3-argument <= (requires 24.4)., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode d95a12d 45/67: Add section name highlighting back., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 64e450d 54/67: Allow inserting tabs immediately after a mnemonic,
ELPA Syncer <=
- [nongnu] elpa/nasm-mode 8ce1831 55/67: Use nasm-basic-offset instead of a literal 8, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode e9acee3 09/67: Expand the syntax table for labels., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode e53433c 10/67: Better label font lock matching., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 23cb9de 20/67: Add imenu support for macro definitions., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 2c87509 36/67: Correct boundaries in syntax highlighting., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 78818f1 39/67: Remove a few more garbage "instructions.", ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 1127620 44/67: Fix breakage caused by recent regexp changes., ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode e7fa960 49/67: make indent-line-function local, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode 7131afb 63/67: Change nasm-use-tabs to nasm-after-mnemonic-whitespace, ELPA Syncer, 2021/08/29
- [nongnu] elpa/nasm-mode c0a002b 13/67: Add minimal imenu support., ELPA Syncer, 2021/08/29