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

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

[nongnu] elpa/graphql-mode 4d075a9cfd 1/4: Basic support for better inde


From: ELPA Syncer
Subject: [nongnu] elpa/graphql-mode 4d075a9cfd 1/4: Basic support for better indenting in polymode
Date: Sat, 16 Jul 2022 04:58:34 -0400 (EDT)

branch: elpa/graphql-mode
commit 4d075a9cfd0cce7607cc31c0432d3599b6e7047e
Author: christopher floess <chris.floess@mailbox.org>
Commit: christopher floess <chris.floess@mailbox.org>

    Basic support for better indenting in polymode
---
 graphql-mode.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/graphql-mode.el b/graphql-mode.el
index 5f3ed0e161..19b584ee91 100644
--- a/graphql-mode.el
+++ b/graphql-mode.el
@@ -281,7 +281,14 @@ Please install it and try again."))
 (defun graphql-indent-line ()
   "Indent GraphQL schema language."
   (let ((position (point))
+        (column)
         (indent-pos))
+    (save-excursion
+      (while (> (car (syntax-ppss (point-at-bol))) 0)
+        (forward-line -1))
+      (back-to-indentation)
+      (setq column (current-column)))
+
     (save-excursion
       (let ((level (car (syntax-ppss (point-at-bol)))))
 
@@ -289,7 +296,7 @@ Please install it and try again."))
         (when (looking-at "\\s-*\\s)")
           (setq level (1- level)))
 
-        (indent-line-to (* graphql-indent-level level))
+        (indent-line-to (+ column (* graphql-indent-level level)))
         (setq indent-pos (point))))
 
     (when (< position indent-pos)



reply via email to

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