[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/jade-mode efb86f6a36 101/128: Merge pull request #51 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/jade-mode efb86f6a36 101/128: Merge pull request #51 from tjefferson08/fix_compile_warnings |
Date: |
Sat, 29 Jan 2022 08:24:51 -0500 (EST) |
branch: elpa/jade-mode
commit efb86f6a36c0338e934cf543a8742b0154ccc0e0
Merge: c4014d8a9c 279df56bf9
Author: Travis Jefferson <tjefferson@signpost.com>
Commit: Travis Jefferson <tjefferson@signpost.com>
Merge pull request #51 from tjefferson08/fix_compile_warnings
Fix compile warnings and strengthen indentation
---
Makefile | 2 +-
jade-mode.el | 18 ++++++++++++++++--
tests/indentation.el | 26 ++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index fef3a67f98..6ba9019f9d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
test:
- emacs -batch -L . -l ./tests/highlight.el -f
ert-run-tests-batch-and-exit
+ emacs -batch -L . -l ./tests/highlight.el -l ./tests/indentation.el -f
ert-run-tests-batch-and-exit
# Local Variables:
# indent-tabs-mode: t
diff --git a/jade-mode.el b/jade-mode.el
index 43bc12730d..16d6fbccc7 100644
--- a/jade-mode.el
+++ b/jade-mode.el
@@ -6,6 +6,8 @@
(require 'font-lock)
(require 'js)
+(defvar jade-tab-width)
+
(defun jade-debug (string &rest args)
"Prints a debug message"
(apply 'message (append (list string) args)))
@@ -187,8 +189,8 @@ declaration"
(beginning-of-line)
(let ((ci (current-indentation)))
(push-mark nil nil t)
- (while (> (jade-next-line-indent) ci)
- (next-line)
+ (while (> (jade-next-line-indentation) ci)
+ (forward-line)
(end-of-line))))
(defun jade-indent ()
@@ -307,6 +309,18 @@ Follows indentation behavior of `indent-rigidly'."
(let ((prev-line-indent (current-indentation)))
prev-line-indent)))
+(defun jade-next-line-indentation ()
+ "Get the indentation of the next (non-blank) line (from point)."
+ (interactive)
+ (save-excursion
+
+ ;; move down to the next non-blank line (or buffer end)
+ (while (progn ;; progn used to get do...while control flow
+ (forward-line 1)
+ (and (jade-blank-line-p) (not (= (point-at-eol) (point-max))))))
+ (let ((next-line-indent (current-indentation)))
+ next-line-indent)))
+
(defun jade-newline-and-indent ()
"Insert newline and indent to parent's indentation level."
(interactive)
diff --git a/tests/indentation.el b/tests/indentation.el
new file mode 100644
index 0000000000..43ff0ee075
--- /dev/null
+++ b/tests/indentation.el
@@ -0,0 +1,26 @@
+(require 'ert)
+(require 'jade-mode)
+
+(ert-deftest jade-mode-get-line-indentations ()
+ (with-temp-buffer
+ (insert "doctype html\nhtml\n body\n div\n p content inside
body\n")
+ (jade-mode)
+
+ ;; go to <div> line (at d of div)
+ (goto-char 30)
+ (should (looking-at "d"))
+ (should (= (current-indentation) 4))
+ (should (= (jade-next-line-indentation) 6))
+ (should (= (jade-previous-line-indentation) 2))
+
+ (beginning-of-line)
+ (should (looking-at "^"))
+ (should (= (current-indentation) 4))
+ (should (= (jade-next-line-indentation) 6))
+ (should (= (jade-previous-line-indentation) 2))
+
+ (end-of-line)
+ (should (looking-at "$"))
+ (should (= (current-indentation) 4))
+ (should (= (jade-next-line-indentation) 6))
+ (should (= (jade-previous-line-indentation) 2))))
- [nongnu] elpa/jade-mode d8324d4820 078/128: Improve comment line/region function, (continued)
- [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, 2022/01/29
- [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 <=
- [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
- [nongnu] elpa/jade-mode 6707074e67 073/128: Merge pull request #32 from tjefferson08/20_single_quote_highlighting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 8f2959ef79 093/128: Merge pull request #43 from tjefferson08/fix_comment_again, ELPA Syncer, 2022/01/29