[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 1b0dc15 2/3: Tweak indentation of #foo in js-mode
From: |
Lars Ingebrigtsen |
Subject: |
master 1b0dc15 2/3: Tweak indentation of #foo in js-mode |
Date: |
Wed, 12 May 2021 10:18:02 -0400 (EDT) |
branch: master
commit 1b0dc15a0ac0715166fbce4b23cd0a3644a90714
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Tweak indentation of #foo in js-mode
* lisp/progmodes/js.el (js--proper-indentation): Indent #define
(etc) to column 0, but otherwise indent #foo normally (bug#47488).
---
lisp/progmodes/js.el | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index fac0d39..1ab0459 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -2861,6 +2861,11 @@ return nil."
((nth 3 parse-status) 0) ; inside string
((when (and js-jsx-syntax (not js-jsx--indent-col))
(save-excursion (js-jsx--indentation parse-status))))
+ ((and (eq (char-after) ?#)
+ (save-excursion
+ (forward-char 1)
+ (looking-at-p cpp-font-lock-keywords-source-directives)))
+ 0)
((save-excursion (js--beginning-of-macro)) 4)
;; Indent array comprehension continuation lines specially.
((let ((bracket (nth 1 parse-status))