branch: elpa/jade-mode
commit 42bb8501b46e7d8101c2cb7dc70e71f335698e1d
Author: Travis Jefferson <[email protected]>
Commit: Travis Jefferson <[email protected]>
fix some compile warnings and sexp-region
* Some compile warnings were in need of attention; there's one left
re: syntactic keywords for font-lock that I think might be better
left as-is
* Added a next-line-indentation function to fix a stale ref in
jade-region-for-sexp. This seems to work now.
---
jade-mode.el | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/jade-mode.el b/jade-mode.el
index 43bc12730d..35bdd07a3e 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,19 @@ 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)
+ (message "cur line %d" (line-number-at-pos))
+ (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)