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

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

[elpa] externals/phps-mode a61cb8b 062/405: Fixed issue with doc comment


From: Stefan Monnier
Subject: [elpa] externals/phps-mode a61cb8b 062/405: Fixed issue with doc comment indentation
Date: Sat, 13 Jul 2019 09:59:43 -0400 (EDT)

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

    Fixed issue with doc comment indentation
---
 phps-functions.el          | 13 ++++++++-----
 sample-php-files/class.php |  2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/phps-functions.el b/phps-functions.el
index 8115cf1..a0f4aa1 100644
--- a/phps-functions.el
+++ b/phps-functions.el
@@ -67,13 +67,14 @@
                    (boundp 'phps-mode/lexer-tokens)
                    (> indent-start indent-end))
               (let ((token-number start-token-number)
-                    (valid-tokens t))
+                    (valid-tokens t)
+                    (tokens phps-mode/lexer-tokens))
                 ;; (message "token start %s, token end %s" start-token-number 
end-token-number)
                 (while (and valid-tokens
                             (<= token-number end-token-number))
-                  (let ((token (car (nth token-number phps-mode/lexer-tokens)))
-                        (token-start (car (cdr (nth token-number 
phps-mode/lexer-tokens))))
-                        (token-end (cdr (cdr (nth token-number 
phps-mode/lexer-tokens)))))
+                  (let ((token (car (nth token-number tokens)))
+                        (token-start (car (cdr (nth token-number tokens))))
+                        (token-end (cdr (cdr (nth token-number tokens)))))
                     (when (and valid-tokens
                                (or (>= token-start (point))
                                    (>= token-end (point)))
@@ -86,7 +87,7 @@
                                      (string= token "]")
                                      (string= token ";")
                                      (eq token 'T_CLOSE_TAG))))
-                      ;; (message "Token %s - %s in %s was invalid" token 
token-number phps-mode/lexer-tokens)
+                      ;; (message "Token %s - %s in %s was invalid" token 
token-number tokens)
                       (setq valid-tokens nil)))
                   (setq token-number (+ token-number 1)))
                 (when valid-tokens
@@ -155,6 +156,7 @@
                 ;; (message "Stopping iteration at: %s %s" start position)
                 (throw 'stop-iteration nil))
 
+              ;; Did we find any token on this line?
               (when (and (not found-line-tokens)
                          (>= token-start line-beginning)
                          (<= token-end line-end))
@@ -176,6 +178,7 @@
                   (_)))
 
               (when (and (< token-start line-beginning)
+                         (>= token-end line-end)
                          (eq token 'T_DOC_COMMENT))
                 (setq line-in-doc-comment t))
 
diff --git a/sample-php-files/class.php b/sample-php-files/class.php
index e980006..730480e 100644
--- a/sample-php-files/class.php
+++ b/sample-php-files/class.php
@@ -2,7 +2,7 @@
 /**
  * Some comments here
  * @todo was here
- */
+ **/
 
 class MyClass
 {



reply via email to

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