emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/jinja2-mode 40c5ef2efa 23/57: Fuck tab


From: ELPA Syncer
Subject: [nongnu] elpa/jinja2-mode 40c5ef2efa 23/57: Fuck tab
Date: Mon, 17 Jan 2022 05:58:24 -0500 (EST)

branch: elpa/jinja2-mode
commit 40c5ef2efa86e2c061558e167db3e80c03254782
Author: Florian Mounier <florian.mounier@kozea.fr>
Commit: Florian Mounier <florian.mounier@kozea.fr>

    Fuck tab
---
 jinja2-mode.el | 188 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 94 insertions(+), 94 deletions(-)

diff --git a/jinja2-mode.el b/jinja2-mode.el
index 84ef448e30..1df1a1d3bc 100644
--- a/jinja2-mode.el
+++ b/jinja2-mode.el
@@ -27,9 +27,9 @@
 (require 'sgml-mode)
 
 (if (not (boundp 'jinja2-user-keywords))
-        (setq jinja2-user-keywords nil))
+     (setq jinja2-user-keywords nil))
 (if (not (boundp 'jinja2-user-functions))
-        (setq jinja2-user-functions nil))
+     (setq jinja2-user-functions nil))
 
 (defun jinja2-closing-keywords ()
   (append
@@ -77,24 +77,24 @@
 (defun jinja2-find-open-tag ()
   (if (search-backward-regexp
        (rx-to-string
-       `(and "{%"
-             (* whitespace)
-             (? (group
-                 "end"))
-             (group
-              ,(append '(or)
-                       (jinja2-closing-keywords)
-                       ))
-             (group
-              (*? anything))
-             (* whitespace)
-             "%}")) nil t)
+    `(and "{%"
+          (* whitespace)
+          (? (group
+          "end"))
+          (group
+           ,(append '(or)
+            (jinja2-closing-keywords)
+            ))
+          (group
+           (*? anything))
+          (* whitespace)
+          "%}")) nil t)
       (if (match-string 1) ;; End tag, going on
-         (let ((matches (jinja2-find-open-tag)))
-           (if (string= (car matches) (match-string 2))
-               (jinja2-find-open-tag)
-             (list (match-string 2) (match-string 3))))
-       (list (match-string 2) (match-string 3)))
+      (let ((matches (jinja2-find-open-tag)))
+        (if (string= (car matches) (match-string 2))
+        (jinja2-find-open-tag)
+          (list (match-string 2) (match-string 3))))
+    (list (match-string 2) (match-string 3)))
     nil))
 
 (defun jinja2-close-tag ()
@@ -102,12 +102,12 @@
   (interactive)
   (let ((open-tag (save-excursion (jinja2-find-open-tag))))
     (if open-tag
-       (insert
-        (if (string= (car open-tag) "block")
-            (format "{%% end%s%s %%}"
-                    (car open-tag)(nth 1 open-tag))
-          (format "{%% end%s %%}"
-                  (match-string 2))))
+    (insert
+     (if (string= (car open-tag) "block")
+         (format "{%% end%s%s %%}"
+             (car open-tag)(nth 1 open-tag))
+       (format "{%% end%s %%}"
+           (match-string 2))))
       (error "Nothing to close")))
   (save-excursion (jinja2-indent-line)))
 
@@ -138,12 +138,12 @@
 (defconst  jinja2-font-lock-comments
   `(
     (,(rx "{#"
-         (* whitespace)
-         (group
-          (*? anything)
-          )
-         (* whitespace)
-         "#}")
+      (* whitespace)
+      (group
+       (*? anything)
+       )
+      (* whitespace)
+      "#}")
      . (1 font-lock-comment-face t))))
 
 (defconst jinja2-font-lock-keywords-1
@@ -162,48 +162,48 @@
    jinja2-font-lock-keywords-2
    `(
      (,(rx "{{"
-         (* whitespace)
-         (group
-          (*? anything)
-          )
-         (*
-          "|" (* whitespace) (*? anything))
-         (* whitespace)
-         "}}") (1 font-lock-variable-name-face t))
+      (* whitespace)
+      (group
+       (*? anything)
+       )
+      (*
+       "|" (* whitespace) (*? anything))
+      (* whitespace)
+      "}}") (1 font-lock-variable-name-face t))
      (,(rx  (group "|" (* whitespace))
-           (group (+ word))
-           )
+        (group (+ word))
+        )
       (1 font-lock-keyword-face t)
       (2 font-lock-warning-face t))
      (,(rx-to-string `(and (group "|" (* whitespace))
-                      (group
-                       ,(append '(or)
-                                (jinja2-functions-keywords)
-                                ))))
+               (group
+            ,(append '(or)
+                 (jinja2-functions-keywords)
+                 ))))
       (1 font-lock-keyword-face t)
       (2 font-lock-function-name-face t)
       )
      (,(rx-to-string `(and word-start
-          (? "end")
-          ,(append '(or)
-                   (jinja2-indenting-keywords)
-           )
-          word-end)) (0 font-lock-keyword-face))
+       (? "end")
+       ,(append '(or)
+            (jinja2-indenting-keywords)
+        )
+       word-end)) (0 font-lock-keyword-face))
      (,(rx-to-string `(and word-start
-          ,(append '(or)
-                   (jinja2-builtin-keywords)
-           )
-          word-end)) (0 font-lock-builtin-face))
+       ,(append '(or)
+            (jinja2-builtin-keywords)
+        )
+       word-end)) (0 font-lock-builtin-face))
 
      (,(rx (or "{%" "%}")) (0 font-lock-function-name-face t))
      (,(rx (or "{{" "}}")) (0 font-lock-type-face t))
      (,(rx "{#"
-          (* whitespace)
-          (group
-           (*? anything)
-           )
-          (* whitespace)
-          "#}")
+       (* whitespace)
+       (group
+        (*? anything)
+        )
+       (* whitespace)
+       "#}")
       (1 font-lock-comment-face t))
      (,(rx (or "{#" "#}")) (0 font-lock-comment-delimiter-face t))
     )))
@@ -214,32 +214,32 @@
 (defun sgml-indent-line-num ()
   "Indent the current line as SGML."
   (let* ((savep (point))
-        (indent-col
-         (save-excursion
-           (back-to-indentation)
-           (if (>= (point) savep) (setq savep nil))
-           (sgml-calculate-indent))))
+     (indent-col
+      (save-excursion
+        (back-to-indentation)
+        (if (>= (point) savep) (setq savep nil))
+        (sgml-calculate-indent))))
     (if (null indent-col)
-       0
+    0
       (if savep
-         (save-excursion indent-col)
-       indent-col))))
+      (save-excursion indent-col)
+    indent-col))))
 
 (defun jinja2-calculate-indent-backward (default)
   "Return indent column based on previous lines"
   (let ((indent-width sgml-basic-offset) (default (sgml-indent-line-num)))
     (forward-line -1)
     (if (looking-at "^[ \t]*{% *end") ; Don't indent after end
-       (current-indentation)
+    (current-indentation)
       (if (looking-at (concat "^[ \t]*{% *.*?{% *end" (regexp-opt 
(jinja2-indenting-keywords))))
-         (current-indentation)
-       (if (looking-at (concat "^[ \t]*{% *" (regexp-opt 
(jinja2-indenting-keywords)))) ; Check start tag
-           (+ (current-indentation) indent-width)
-         (if (looking-at "^[ \t]*<") ; Assume sgml block trust sgml
-             default
-           (if (bobp)
-               0
-             (jinja2-calculate-indent-backward default))))))))
+      (current-indentation)
+    (if (looking-at (concat "^[ \t]*{% *" (regexp-opt 
(jinja2-indenting-keywords)))) ; Check start tag
+        (+ (current-indentation) indent-width)
+      (if (looking-at "^[ \t]*<") ; Assume sgml block trust sgml
+          default
+        (if (bobp)
+        0
+          (jinja2-calculate-indent-backward default))))))))
   
 
 (defun jinja2-calculate-indent ()
@@ -248,18 +248,18 @@
       0
     (let ((indent-width sgml-basic-offset) (default (sgml-indent-line-num)))
       (if (looking-at "^[ \t]*{% *e\\(nd\\|lse\\|lif\\)") ; Check close tag
-         (save-excursion
-           (forward-line -1)
-           (if
-               (and
-                (looking-at (concat "^[ \t]*{% *" (regexp-opt 
(jinja2-indenting-keywords))))
-                (not (looking-at (concat "^[ \t]*{% *.*?{% *end" (regexp-opt 
(jinja2-indenting-keywords))))))
-               (current-indentation)
-             (- (current-indentation) indent-width)))
-       (if (looking-at "^[ \t]*</") ; Assume sgml end block trust sgml
-           default
-         (save-excursion
-           (jinja2-calculate-indent-backward default)))))))
+      (save-excursion
+        (forward-line -1)
+        (if
+        (and
+         (looking-at (concat "^[ \t]*{% *" (regexp-opt 
(jinja2-indenting-keywords))))
+         (not (looking-at (concat "^[ \t]*{% *.*?{% *end" (regexp-opt 
(jinja2-indenting-keywords))))))
+        (current-indentation)
+          (- (current-indentation) indent-width)))
+    (if (looking-at "^[ \t]*</") ; Assume sgml end block trust sgml
+        default
+      (save-excursion
+        (jinja2-calculate-indent-backward default)))))))
 
 (defun jinja2-indent-line ()
   "Indent current line as Jinja code"
@@ -267,7 +267,7 @@
   (beginning-of-line)
   (let ((indent (jinja2-calculate-indent)))
     (if (< indent 0)
-       (setq indent 0))
+    (setq indent 0))
     (indent-line-to indent)))
 
 ;;;###autoload
@@ -277,10 +277,10 @@
   ;; it mainly from sgml-mode font lock setting
   (set (make-local-variable 'font-lock-defaults)
        '((
-         jinja2-font-lock-keywords
-         jinja2-font-lock-keywords-1
-         jinja2-font-lock-keywords-2
-         jinja2-font-lock-keywords-3)
+      jinja2-font-lock-keywords
+      jinja2-font-lock-keywords-1
+      jinja2-font-lock-keywords-2
+      jinja2-font-lock-keywords-3)
          nil t nil nil
          (font-lock-syntactic-keywords
           . sgml-font-lock-syntactic-keywords)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]