[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/jade-mode 36fbf629a8 049/128: Improved sws-mode indentatio
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/jade-mode 36fbf629a8 049/128: Improved sws-mode indentation |
Date: |
Sat, 29 Jan 2022 08:24:46 -0500 (EST) |
branch: elpa/jade-mode
commit 36fbf629a846dfeae47cd80cd15c9ab8b9f87320
Author: Jaakko Pallari <jkpl@lepovirta.org>
Commit: Jaakko Pallari <jkpl@lepovirta.org>
Improved sws-mode indentation
If the the last command wasn't an indentation command and the current
line indentation is 0, the 'sws-indent-line indents to whatever was the
previous line indent. This way it works better with 'newline-and-indent
but the function still works as it previously did.
Also, the 'sws-previous-indentation now searches for a previous line
that has atleast one non-whitespace character.
---
sws-mode.el | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/sws-mode.el b/sws-mode.el
index 51dbcd137e..84f9a74a85 100644
--- a/sws-mode.el
+++ b/sws-mode.el
@@ -14,8 +14,11 @@
(defun sws-previous-indentation ()
"Gets indentation of previous line"
(save-excursion
- (previous-line)
- (current-indentation)))
+ (forward-line -1)
+ (if (bobp) 0
+ (progn
+ (while (and (looking-at "^[ \t]*$") (not (bobp))) (forward-line -1))
+ (current-indentation)))))
(defun sws-max-indent ()
"Calculates max indentation"
@@ -44,12 +47,14 @@
(defun sws-indent-line ()
"Indents current line"
(interactive)
- (if mark-active
- (sws-indent-region)
- (if (sws-at-bot-p)
- (sws-do-indent-line)
- ;; instead of adjusting indent, move point to text
- (sws-point-to-bot))))
+ (if (and (eq (current-indentation) 0)
+ (not (eq last-command 'sws-indent-line)))
+ (indent-to (sws-previous-indentation))
+ (if mark-active
+ (sws-indent-region (region-beginning) (region-end))
+ (if (sws-at-bot-p)
+ (sws-do-indent-line)
+ (sws-point-to-bot)))))
(defun sws-at-bol-p ()
"If point is at beginning of line"
- [nongnu] elpa/jade-mode fd8a4f3a09 028/128: Merge pull request #7 from purcell/master, (continued)
- [nongnu] elpa/jade-mode fd8a4f3a09 028/128: Merge pull request #7 from purcell/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode c0b9cfc755 034/128: Modify mather for doctype., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode d8324d4820 078/128: Improve comment line/region function, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 7f63cc296c 054/128: Merge pull request #14 from jkpl/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 2d8a3013c4 063/128: Create LICENSE.txt, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 544be1a87d 079/128: match full tag decl. and un-hl subsequent content, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode ae579601b8 070/128: Merge pull request #30 from tjefferson08/fix_indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode c8532a66f6 037/128: Support comment-dwim for single line comment syntax., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode a8d77823a7 087/128: Merge pull request #40 from tjefferson08/39_highlight_js, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 1b86926046 061/128: Refined and extended syntax highlighting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 36fbf629a8 049/128: Improved sws-mode indentation,
ELPA Syncer <=
- [nongnu] elpa/jade-mode 216d1f5148 109/128: use mc's mixin regex to highlight mixin syntax, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode efb86f6a36 101/128: Merge pull request #51 from tjefferson08/fix_compile_warnings, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode c017b86026 117/128: Fix Grammar error in Flycheck sentence., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 334faaa998 127/128: fix small typo, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode e9cc84aff7 020/128: use mark-active instead of region-active-p, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode d259953442 030/128: Change doctype facename to font-lock-comment-face., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode c2a826f61b 031/128: Change id facename to font-lock-variable-name-face., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode ed4275a1f8 047/128: Merge pull request #10 from telaviv/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 33bad1d74e 065/128: Merge pull request #28 from Sterlingg/DedentFix, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 573f954c7e 025/128: set indent-tabs-mode as nil, ELPA Syncer, 2022/01/29