]> git.eshelyaron.com Git - emacs.git/commitdiff
Tweak indentation of #foo in js-mode
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 12 May 2021 13:41:26 +0000 (15:41 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 12 May 2021 14:17:55 +0000 (16:17 +0200)
* lisp/progmodes/js.el (js--proper-indentation): Indent #define
(etc) to column 0, but otherwise indent #foo normally (bug#47488).

lisp/progmodes/js.el

index fac0d39b69f6e9e794eaa15b8bde59c6fcc5fbcb..1ab0459d704e9f093582dc6475846af1e2980ace 100644 (file)
@@ -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))