[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/jade-mode cb82d16486 017/128: jade-mode depends on sws-mod
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/jade-mode cb82d16486 017/128: jade-mode depends on sws-mode |
Date: |
Sat, 29 Jan 2022 08:24:42 -0500 (EST) |
branch: elpa/jade-mode
commit cb82d16486dfd45847c4306273620c020d1518c2
Author: Brian Carlson <brian.m.carlson@gmail.com>
Commit: Brian Carlson <brian.m.carlson@gmail.com>
jade-mode depends on sws-mode
---
jade-mode.el | 82 ++++++++++--------------------------------------------------
1 file changed, 13 insertions(+), 69 deletions(-)
diff --git a/jade-mode.el b/jade-mode.el
index c5be348a50..4fdfd160f0 100644
--- a/jade-mode.el
+++ b/jade-mode.el
@@ -1,8 +1,6 @@
;; copied from http://xahlee.org/emacs/elisp_syntax_coloring.html
(require 'font-lock)
-(defvar jade-tab-width 2)
-
(defun jade-debug (string &rest args)
"Prints a debug message"
(apply 'message (append (list string) args)))
@@ -12,20 +10,6 @@
`(buffer-substring (point-at-bol) (point-at-eol)))
-(defun jade-indent-line ()
- "Indents current line")
-
-(defun jade-previous-indentation ()
- "Gets indentation for previous line"
- (save-excursion
- (previous-line)
- (current-indentation)))
-
-(defun jade-should-indent-p ()
- "Whether or not line should be indented."
- ;; should only indent if previous line is indented at most one less
- (> (jade-previous-indentation) (- (current-indentation) 1)))
-
(defun jade-empty-line-p ()
"If line is empty or not."
(= (point-at-eol) (point-at-bol)))
@@ -34,45 +18,6 @@
"If line contains only spaces."
(string-match-p "^[ ]*$" (jade-line-as-string)))
-(defun jade-indent-line ()
- "Indents the line."
- (interactive)
-
- ;; indent straight to end on empty line
- (if (jade-empty-line-p)
- (indent-to (jade-previous-indentation))
- ;; otherwise indent if nesting is correct
- (save-excursion
- (if (jade-should-indent-p)
- (let ((ci (current-indentation)))
- (beginning-of-line)
- (delete-horizontal-space)
- (indent-to (+ jade-tab-width ci)))
- ;; if cannot indent, reset indentation
- (progn
- (beginning-of-line)
- (delete-horizontal-space)))))
- ;; move point to end of line on empty lines to make tabbing
- ;; more obvious
- (if (jade-blank-line-p)
- (move-end-of-line 1)))
-
-(defun jade-max-indent ()
- "Max indents previous line."
- (indent-to (+ jade-tab-width (jade-previous-indentation))))
-
-(defun jade-unindent-line ()
- "Unindents the current line"
- (interactive)
- (let ((ci (current-indentation)))
- (if (= ci 0)
- ;; no indentation, set to max
- (jade-max-indent)
- (progn
- (beginning-of-line)
- (delete-horizontal-space)
- (indent-to (- ci jade-tab-width))))))
-
(setq jade-font-lock-keywords
`((,"!!!\\( \\(default\\|5\\|transitional\\)\\)?" 0
font-lock-constant-face) ;; doctype
(,"#\\(\\w\\|_\\|-\\)*" . font-lock-type-face) ;; id
@@ -80,12 +25,6 @@
(,"\\(?:^[ {2,}]+\\(?:[a-z0-9_:\\-]*\\)\\)?\\(\\.[A-Za-z0-9\-\_]*\\)"
1 font-lock-function-name-face) ;; class name
(,"^[ {2,}]+[a-z0-9_:\\-]*" 0 font-lock-comment-face)))
-(defun jade-next-line-indent ()
- "Gets indentation level for next line."
- (save-excursion
- (next-line)
- (current-indentation)))
-
(defun jade-region-for-sexp ()
"Selects the current sexp as the region"
(interactive)
@@ -97,10 +36,11 @@
(end-of-line))))
(defvar jade-mode-map (make-sparse-keymap))
-(define-key jade-mode-map [S-tab] 'jade-unindent-line)
+;;defer to sws-mode
+;;(define-key jade-mode-map [S-tab] 'jade-unindent-line)
;; mode declaration
-(define-derived-mode jade-mode fundamental-mode
+(define-derived-mode jade-mode sws-mode
"Jade"
"Major mode for editing jade node.js templates"
(kill-all-local-variables)
@@ -109,16 +49,20 @@
(setq mode-name "Jade")
(setq major-mode 'jade-mode)
+ ;; default tab width
+ (setq sws-tab-width 2)
+ (make-local-variable 'indent-line-function)
+ (setq indent-line-function 'sws-indent-line)
+ (make-local-variable 'indent-region-function)
+
+ (setq indent-region-function 'sws-indent-region)
+
+
;; keymap
(use-local-map jade-mode-map)
;; highlight syntax
- (setq font-lock-defaults '(jade-font-lock-keywords))
-
- (make-local-variable 'indent-line-function)
- (setq indent-line-function 'jade-indent-line)
- ;; no tabs
- (setq indent-tabs-mode nil))
+ (setq font-lock-defaults '(jade-font-lock-keywords)))
(provide 'jade-mode)
- [nongnu] elpa/jade-mode a61ad07db6 094/128: Merge pull request #42 from tjefferson08/doctype_fontification, (continued)
- [nongnu] elpa/jade-mode a61ad07db6 094/128: Merge pull request #42 from tjefferson08/doctype_fontification, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 5752db7c36 012/128: added significant whitespace mode as sub-mode for jade-mode and (soon to be) stylus-mode, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 2f0f55cae4 018/128: updated readme, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 823c573c29 042/128: Merge pull request #5 from ntotani/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 97e1db63be 088/128: fix error while fontifying pipe regions, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 936b4a974b 115/128: Remove flymake mentions from the README, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode fd367b9489 076/128: Remove unnecessary code from README, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode dfeadc97a5 069/128: Merge pull request #31 from tjefferson08/26_comment_highlight, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 6b9d9507e2 010/128: can detect simple region sexps, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode d28d1810fa 007/128: basic decrement tab working, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode cb82d16486 017/128: jade-mode depends on sws-mode,
ELPA Syncer <=
- [nongnu] elpa/jade-mode e4c668bde5 023/128: Have documentation such that jade-mode is used for .jade files., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 2b093c23d2 071/128: [#20] add single quote ex. (currently incorrect), ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 03486dce69 082/128: Merge pull request #33 from mgalgs/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode cb0f564166 066/128: remove jade-mode dependency on sws-mode, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode e128ce3b07 067/128: add custom indent functions for line/region, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 4e7a20db49 084/128: Merge pull request #38 from tjefferson08/37_highlight_strings_in_parens, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 40efeb499a 064/128: Indent using the number of lines in a region instead of the location of point within the original region., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 2c830e70e0 075/128: Use \\' instead of $, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 519b455d1f 113/128: Add melpa badge and flycheck support note, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode ce2400711d 107/128: get mixin parameters to highlight correctly, ELPA Syncer, 2022/01/29