branch: externals/phps-mode commit da43f8d5ad887f741656b936cc0b52ae21873cc9 Author: christian <christ...@cvj.se> Commit: christian <christ...@cvj.se>
More work on beginning-of-defun --- phps-mode-lex-analyzer.el | 5 ++++- test/phps-mode-test-lex-analyzer.el | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el index 024ab78cf2..660ac3f38f 100644 --- a/phps-mode-lex-analyzer.el +++ b/phps-mode-lex-analyzer.el @@ -1530,11 +1530,14 @@ of performed operations. Optionally do it FORCE-SYNCHRONOUS." (setq index (1+ index)))) (when found-index (goto-char found-index)) - found-index)) + (if found-index + t + nil))) (defun phps-mode-lex-analyzer--end-of-defun (&optional arg interactive) "Custom implementation of `end-of-defun'." ;; TODO Implement this + ;; TODO should start from beginning-of-defun and scan until balance of brackets ) (provide 'phps-mode-lex-analyzer) diff --git a/test/phps-mode-test-lex-analyzer.el b/test/phps-mode-test-lex-analyzer.el index 5480b97282..07552ec662 100644 --- a/test/phps-mode-test-lex-analyzer.el +++ b/test/phps-mode-test-lex-analyzer.el @@ -158,9 +158,10 @@ (phps-mode-test--with-buffer "<?php\nfunction test($a) {\n return $a + 1;\n}\necho 'here';\n" (goto-char 27) - (narrow-to-defun) - (should (equal (point-min) 7)) - (should (equal (point-max) 47))) + (should (equal (phps-mode-lex-analyzer--beginning-of-defun) t)) + (should (equal (point) 7)) + (should (equal (phps-mode-lex-analyzer--end-of-defun) t)) + (should (equal (point) 47))) )