[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 897f249 124/405: Work on alternative and inli
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 897f249 124/405: Work on alternative and inline indentation |
Date: |
Sat, 13 Jul 2019 09:59:57 -0400 (EDT) |
branch: externals/phps-mode
commit 897f249641ceaad14d8c5e2c89514055b8f21021
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Work on alternative and inline indentation
---
phps-mode-functions.el | 8 ++++++--
phps-mode-test-functions.el | 6 +++---
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index f77eb71..ab4e8f9 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -33,9 +33,10 @@
;; NOTE Also format white-space inside the line, i.e. after function
declarations?
+;; TODO Add support for automatic parenthesis, bracket, square-bracket,
single-quote and double-quote encapsulations
+
;; TODO Support inline function indentations
;; TODO Support indentation for multi-line scalar assignments
-;; TODO Add support for automatic parenthesis, bracket, square-bracket,
single-quote and double-quote encapsulations
(defun phps-mode-functions-indent-line ()
"Indent line."
@@ -77,6 +78,7 @@
(first-token-is-closing-curly-bracket nil)
(tokens phps-mode-lexer-tokens)
(is-first-line-token t))
+
;; (message "token start %s, token end %s" start-token-number
end-token-number)
;; (message "First token %s, last token %s" (car (nth
start-token-number tokens)) (car (nth end-token-number tokens)))
@@ -102,7 +104,9 @@
(setq is-first-line-token nil)
;; Is it a closing brace?
- (when (string= token "}")
+ (when (or (string= token "}")
+ (eq token 'T_ELSE)
+ (eq token 'T_ELSEIF))
(setq first-token-is-closing-curly-bracket t)))
(when (and valid-tokens
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index af79b70..dfa39ed 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -164,12 +164,12 @@
(should (equal buffer-contents "<?php\n$var = [\n 'random' => [\n
'hello',\n ],\n];\n"))))
(phps-mode-test-with-buffer
- "<?php\nif (myRandomCondition()):\necho 'Something here';\n else:\n
echo 'Something else here';\nendif;\n"
- (goto-char 60)
+ "<?php\nif (myRandomCondition()):\necho 'Something here';\n else:\n
echo 'Something else here 8';\nendif;\n"
+ (goto-char 62)
(phps-mode-functions-indent-line)
;; (message "Tokens %s" phps-mode-lexer-tokens)
(let ((buffer-contents (buffer-substring-no-properties (point-min)
(point-max))))
- (should (equal buffer-contents "<?php\nif (myRandomCondition()):\necho
'Something here';\nelse:\n echo 'Something else here';\nendif;\n"))))
+ (should (equal buffer-contents "<?php\nif (myRandomCondition()):\necho
'Something here';\nelse:\n echo 'Something else here 8';\nendif;\n"))))
;; switch case
- [elpa] externals/phps-mode 12c22ee 119/405: More work on alternative and inline meta information, (continued)
- [elpa] externals/phps-mode 12c22ee 119/405: More work on alternative and inline meta information, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7e2e902 126/405: Fixed a unit test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 80da137 114/405: Preparations for adding alternative and inline syntax, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode baab77a 121/405: Unit tests for inline control structures working, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f0dc652 143/405: More work on new indentation function, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7dca537 105/405: Started work on renaming files, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e11a1fc 123/405: Fine-tuning of logic collecting data about inline and alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e206605 115/405: Adding failing unit tests for inline and alternative syntax, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c6aa633 118/405: More work on keeping track of alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 60c7431 122/405: Unit tests for gather data about inline and alternative control structure syntax passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 897f249 124/405: Work on alternative and inline indentation,
Stefan Monnier <=
- [elpa] externals/phps-mode be35ed6 127/405: Added sample files for inline and alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7279913 113/405: Improved TODOs, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a8eadfa 130/405: Improved sample files inline and alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9996ae0 146/405: More work on indentation calculation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3776841 138/405: Added new support for tracking doc-comment, HEREDOC and NOWDOC indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 780d065 125/405: Code styling updates, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 314dba1 135/405: Improved articulation of what information get-current-line-data should return, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f0523b7 137/405: More work on new function to calculate indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 16d8056 144/405: Foundation for new indentation tests completed, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d380cd4 129/405: Updated readme, Stefan Monnier, 2019/07/13