[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode d9a0119 183/405: Optimized indentation code b
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode d9a0119 183/405: Optimized indentation code by removing unused variables |
Date: |
Sat, 13 Jul 2019 10:00:09 -0400 (EDT) |
branch: externals/phps-mode
commit d9a01199977d906eb398c429649d7b386d68eb9f
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Optimized indentation code by removing unused variables
---
phps-mode-functions.el | 37 +++----------------------------------
1 file changed, 3 insertions(+), 34 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 09466bb..538686a 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -38,23 +38,12 @@
;; TODO Add support for automatic parenthesis, bracket, square-bracket,
single-quote and double-quote encapsulations
-;; TODO Support indentation for multi-line assignments
-
(defun phps-mode-functions-get-lines-indent ()
- "Get the column and tuning indentation-numbers for each line in buffer that
contain tokens.
-
-Refactor to this structure:
-1. Iterate through each token
-2. Do token logic
-3. If token is last on it's line or the last token of all, process line logic
-
-"
+ "Get the column and tuning indentation-numbers for each line in buffer that
contain tokens."
(if (boundp 'phps-mode-lexer-tokens)
(save-excursion
(goto-char (point-min))
- (let ((in-scripting nil)
- (in-heredoc nil)
- (in-doc-comment nil)
+ (let ((in-heredoc nil)
(in-inline-control-structure nil)
(after-special-control-structure nil)
(after-special-control-structure-token nil)
@@ -77,7 +66,6 @@ Refactor to this structure:
(first-token-is-nesting-decrease nil)
(first-token-is-nesting-increase nil)
(token-number 1)
- (last-token-number (length phps-mode-lexer-tokens))
(allow-custom-column-increment nil)
(allow-custom-column-decrement nil)
(in-assignment nil)
@@ -86,8 +74,6 @@ Refactor to this structure:
(in-class-declaration nil)
(in-class-declaration-level 0)
(token nil)
- (token-start 0)
- (token-end 0)
(token-start-line-number 0)
(token-end-line-number)
(tokens (nreverse phps-mode-lexer-tokens)))
@@ -269,13 +255,6 @@ Refactor to this structure:
(setq after-extra-special-control-structure t)
(setq after-extra-special-control-structure-first-on-line
first-token-on-line))
- ;; Keep track of in scripting
- (when (or (equal token 'T_OPEN_TAG)
- (equal token 'T_OPEN_TAG_WITH_ECHO))
- (setq in-scripting t))
- (when (equal token 'T_CLOSE_TAG)
- (setq in-scripting nil))
-
;; Keep track of whether we are inside a HEREDOC or NOWDOC
(when (equal token 'T_START_HEREDOC)
(setq in-heredoc t))
@@ -395,8 +374,6 @@ Refactor to this structure:
;; Update current token
(setq token next-token)
- (setq token-start next-token-start)
- (setq token-end next-token-end)
(setq token-start-line-number next-token-start-line-number)
(setq token-end-line-number next-token-end-line-number)
(setq token-number (1+ token-number))))
@@ -458,11 +435,6 @@ Refactor to this structure:
;; (message "phps-mode-functions-after-change %s %s %s" start stop length)
))
-;; TODO This function needs to keep track of alternative syntax for the
control structures: if, while, for, foreach, and switch
-;; TODO This function needs to keep track of inline syntax for the control
structures: if, while, for, foreach, and switch
-;; TODO Support switch case as well
-;; TODO Keep track of assignments as well
-
(defun phps-mode-functions-init ()
"PHP specific init-cleanup routines."
@@ -483,10 +455,7 @@ Refactor to this structure:
(set (make-local-variable 'phps-mode-functions-buffer-changes-start) nil)
(set (make-local-variable 'phps-mode-functions-lines-indent) nil)
- (add-hook 'after-change-functions #'phps-mode-functions-after-change)
-
- ;; NOTE Implement indent-region?
- )
+ (add-hook 'after-change-functions #'phps-mode-functions-after-change))
(provide 'phps-mode-functions)
- [elpa] externals/phps-mode 67233ef 213/405: Fixed indent algorithm for multi-line strings, (continued)
- [elpa] externals/phps-mode 67233ef 213/405: Fixed indent algorithm for multi-line strings, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 36a4b64 222/405: Added lost test for token-less lines again, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 70f2d46 242/405: Fixed lexer issue with multiple expressions inside double-quoted string, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0286660 224/405: Indentation passes new tests for concatenated strings, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f05d40a 230/405: Tests for lexer passes again after close_tag modification, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 1bc5713 227/405: New tests for concatenation passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c71a97d 178/405: Started on refactored indentation calculation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8bb3918 249/405: Clean-up of unit test logging, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9201d1c 246/405: Imenu index now handles functions with optional arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2c3239a 187/405: Adding new failing tests for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d9a0119 183/405: Optimized indentation code by removing unused variables,
Stefan Monnier <=
- [elpa] externals/phps-mode a0cbcd1 186/405: More work on indentation of multi-line IF-expressions, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d7c5f67 190/405: More work on nesting-stack, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 253839f 170/405: Added indentation unit tests for concatenated strings outside assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e38794b0 197/405: More conceptual work on algorithm for inline control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9db28d9 185/405: Added verbose flag for unit tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2a1ed52 196/405: Optimized algorithm for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a30c3f6 177/405: More work on indentation tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e8a8d41 204/405: Merged remote changes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode faa4e00 201/405: Started on conceptually describing algorithm for multi-line assignment indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 874701d 195/405: Work on alternative and inline control structure syntax with new algorithm, Stefan Monnier, 2019/07/13