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

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

[elpa] externals/js2-mode fed41615b2: Fix (or add explicit) shebang supp


From: ELPA Syncer
Subject: [elpa] externals/js2-mode fed41615b2: Fix (or add explicit) shebang support
Date: Sat, 2 Apr 2022 18:57:42 -0400 (EDT)

branch: externals/js2-mode
commit fed41615b26404e0bfd7e4f64643981ca798a34b
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Fix (or add explicit) shebang support
    
    #585
---
 js2-mode.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 3f42dc3ea9..65241ad04e 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -5686,13 +5686,17 @@ A buffer can only have one scanner active at a time, 
which yields
 dramatically simpler code than using a defstruct.  If you need to
 have simultaneous scanners in a buffer, copy the regions to scan
 into temp buffers."
-  (with-current-buffer (or buf (current-buffer))
+  (save-excursion
+    (and buf (set-buffer buf))
+    (goto-char (point-min))
+    (when (looking-at "#!/")
+      (forward-line 1))
     (setq js2-ts-dirty-line nil
           js2-ts-hit-eof nil
           js2-ts-line-start 0
           js2-ts-lineno (or line 1)
           js2-ts-line-end-char -1
-          js2-ts-cursor (point-min)
+          js2-ts-cursor (point)
           js2-ti-tokens (make-vector js2-ti-ntokens nil)
           js2-ti-tokens-cursor 0
           js2-ti-lookahead 0



reply via email to

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