diff --git a/php-mode-test.el b/php-mode-test.el index a2ac77b4..64b03c9f 100644 --- a/php-mode-test.el +++ b/php-mode-test.el @@ -612,6 +612,13 @@ style from Drupal." (php-mode) (should-not (buffer-modified-p)))) +(ert-deftest php-mode-test-issue-314 () + "Activating php-mode should not move point." + (with-php-mode-test ("issue-314.php") + (let ((orig-point (point))) + (php-mode) + (should (eq (point) orig-point))))) + (ert-deftest php-mode-test-issue-310 () "Proper indentation after function with return type." (with-php-mode-test ("issue-310.php" :indent t :magic t))) diff --git a/php-mode.el b/php-mode.el index 1b91bf06..32fdb78c 100644 --- a/php-mode.el +++ b/php-mode.el @@ -1079,7 +1079,8 @@ PHP heredoc." (when (>= emacs-major-version 25) (with-silent-modifications - (php-syntax-propertize-function (point-min) (point-max))))) + (save-excursion + (php-syntax-propertize-function (point-min) (point-max)))))) ;; Define function name completion function diff --git a/tests/issue-314.php b/tests/issue-314.php new file mode 100644 index 00000000..ad844d33 --- /dev/null +++ b/tests/issue-314.php @@ -0,0 +1,3 @@ +