Skip to content

Commit c9b22f5

Browse files
authored
Merge pull request #152 from Rogach/pr/fix-indentation-when-lexical-scoping
fix eval invocation in typescript--re-search-backward to work with lexical scoping
2 parents 6918f3f + 47b7fd2 commit c9b22f5

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
;; -*- lexical-binding: t -*-
2+
;;; typescript-mode-lexical-binding-tests --- This file contains test for typescript-mode.el under enabled lexical-binding
3+
4+
;;; Commentary:
5+
;; To know how to run the tests, see typescript-mode-tests.el
6+
7+
(require 'ert)
8+
9+
;; reload typescript-mode with lexical-binding enabled
10+
(with-temp-buffer
11+
(insert-file-contents "typescript-mode.el")
12+
(ignore-errors
13+
(while (setq sexp (read (current-buffer)))
14+
(eval sexp t))))
15+
16+
(require 'typescript-mode-test-utilities)
17+
18+
(ert-deftest lexical-binding--indentation-does-not-throw-error ()
19+
(with-temp-buffer
20+
(insert-file-contents "test-files/indentation-reference-document.ts")
21+
(typescript-mode)
22+
(goto-line 2)
23+
(typescript-indent-line)))
24+
25+
(provide 'typescript-mode-lexical-binding-tests)

typescript-mode-tests.el

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
(require 'typescript-mode-test-utilities)
1212
(require 'typescript-mode-general-tests)
1313
(require 'typescript-mode-jsdoc-tests)
14+
(require 'typescript-mode-lexical-binding-tests)
1415

1516
(provide 'typescript-mode-tests)
1617

typescript-mode.el

+3-3
Original file line numberDiff line numberDiff line change
@@ -992,11 +992,11 @@ one at the end of the line with \"let a\"."
992992
(let ((saved-point (point))
993993
(search-expr
994994
(cond ((null count)
995-
'(typescript--re-search-backward-inner regexp bound 1))
995+
`(typescript--re-search-backward-inner ,regexp ,bound 1))
996996
((< count 0)
997-
'(typescript--re-search-forward-inner regexp bound (- count)))
997+
`(typescript--re-search-forward-inner ,regexp ,bound (- ,count)))
998998
((> count 0)
999-
'(typescript--re-search-backward-inner regexp bound count)))))
999+
`(typescript--re-search-backward-inner ,regexp ,bound ,count)))))
10001000
(condition-case err
10011001
(eval search-expr)
10021002
(search-failed

0 commit comments

Comments
 (0)