emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master f2fbd4b: js-mode: Don't indent inside a multiline s


From: Dmitry Gutov
Subject: [Emacs-diffs] master f2fbd4b: js-mode: Don't indent inside a multiline string literal
Date: Fri, 03 Apr 2015 03:37:45 +0000

branch: master
commit f2fbd4b71236ca5559b93eb2baf1a7671442eef9
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    js-mode: Don't indent inside a multiline string literal
    
    * lisp/progmodes/js.el (js-indent-line): Do nothing when bol is inside
    a string (https://github.com/mooz/js2-mode/issues/227).
---
 lisp/ChangeLog       |    5 +++++
 lisp/progmodes/js.el |    3 ++-
 test/indent/js.js    |    5 +++++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 38e45d0..b004a2b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-03  Dmitry Gutov  <address@hidden>
+
+       * progmodes/js.el (js-indent-line): Do nothing when bol is inside
+       a string (https://github.com/mooz/js2-mode/issues/227).
+
 2015-04-02  Stefan Monnier  <address@hidden>
 
        * abbrev.el (define-abbrev-table): Treat a non-string "docstring" as
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index ff00298..f6cfa2e 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -2002,7 +2002,8 @@ indentation is aligned to that column."
   (let* ((parse-status
           (save-excursion (syntax-ppss (point-at-bol))))
          (offset (- (point) (save-excursion (back-to-indentation) (point)))))
-    (indent-line-to (js--proper-indentation parse-status))
+    (unless (nth 3 parse-status)
+      (indent-line-to (js--proper-indentation parse-status)))
     (when (> offset 0) (forward-char offset))))
 
 ;;; Filling
diff --git a/test/indent/js.js b/test/indent/js.js
index ad7cb56..2120233 100644
--- a/test/indent/js.js
+++ b/test/indent/js.js
@@ -64,6 +64,11 @@ b +=
 baz(`http://foo.bar/${tee}`)
   .qux();
 
+`multiline string
+       contents
+  are kept
+        unchanged!`
+
 // Local Variables:
 // indent-tabs-mode: nil
 // js-indent-level: 2



reply via email to

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