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

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

[elpa] externals/phps-mode bf633d2 061/405: Added test for indent of fin


From: Stefan Monnier
Subject: [elpa] externals/phps-mode bf633d2 061/405: Added test for indent of final line of doc comment block
Date: Sat, 13 Jul 2019 09:59:43 -0400 (EDT)

branch: externals/phps-mode
commit bf633d2d60859e196a1094a0097aae8c8f973699
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Added test for indent of final line of doc comment block
---
 phps-functions.el      |  8 +++++---
 phps-test-functions.el | 10 +++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/phps-functions.el b/phps-functions.el
index 8b20457..8115cf1 100644
--- a/phps-functions.el
+++ b/phps-functions.el
@@ -113,7 +113,10 @@
   (when (string= major-mode "phps-mode")
     (when (and (not phps-mode/buffer-changes--start)
                (boundp 'phps-mode/idle-interval))
-      (run-with-idle-timer phps-mode/idle-interval nil 
#'phps-mode/run-incremental-lex))
+      (run-with-idle-timer phps-mode/idle-interval nil #'phps-mode/lex--RUN)
+      ;; TODO Maybe use incremental lexer once it's working
+      ;; (run-with-idle-timer phps-mode/idle-interval nil 
#'phps-mode/run-incremental-lex) 
+      )
     (when (or (not phps-mode/buffer-changes--start)
               (< start phps-mode/buffer-changes--start))
       ;; (message "Setting %s to %s" phps-mode/buffer-changes--start start)
@@ -172,8 +175,7 @@
                   (")" (setq start-parenthesis-level (- 
start-parenthesis-level 1)))
                   (_)))
 
-              (when (and (> token-end line-end)
-                         (< token-start line-beginning)
+              (when (and (< token-start line-beginning)
                          (eq token 'T_DOC_COMMENT))
                 (setq line-in-doc-comment t))
 
diff --git a/phps-test-functions.el b/phps-test-functions.el
index 17cced3..1ead7e7 100644
--- a/phps-test-functions.el
+++ b/phps-test-functions.el
@@ -108,6 +108,14 @@
      (should (equal buffer-contents  "<?php\n/**\n* My first line\n* My second 
line\n**/\n"))))
 
   (phps-mode/with-test-buffer
+   "<?php\n/**\n* My first line\n* My second line\n**/\n"
+   (goto-char 46)
+   (phps-mode/indent-line)
+   ;; (message "Tokens %s point %s" phps-mode/lexer-tokens (point))
+   (let ((buffer-contents (buffer-substring-no-properties (point-min) 
(point-max))))
+     (should (equal buffer-contents  "<?php\n/**\n* My first line\n* My second 
line\n **/\n"))))
+
+  (phps-mode/with-test-buffer
    "<?php\n$variable = array(\n'random4');\n$variable = true;\n"
    (goto-char 29)
    (phps-mode/indent-line)
@@ -184,7 +192,7 @@
   (phps-mode/with-test-buffer
    "<?php /**\n * My first line\n * My second line\n **/"
    (goto-char 50)
-   (should (equal (list (list t 0 0 0 nil nil) (list t 0 0 0 nil nil)) 
(phps-mode/get-point-data))))
+   (should (equal (list (list t 0 0 0 nil t) (list t 0 0 0 nil t)) 
(phps-mode/get-point-data))))
 
   (phps-mode/with-test-buffer
    "<?php\n$variable = array(\n'random4');\n$variable = true;\n"



reply via email to

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