[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode e30ac0c 083/405: Started implementation of mo
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode e30ac0c 083/405: Started implementation of moving lexer and state position when |
Date: |
Sat, 13 Jul 2019 09:59:48 -0400 (EDT) |
branch: externals/phps-mode
commit e30ac0ca253b6d96970eb44fe0d4571f8414c1d0
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Started implementation of moving lexer and state position when
indenting to save time
---
phps-functions.el | 27 +++++++++++++++++----------
phps-lexer.el | 2 +-
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/phps-functions.el b/phps-functions.el
index 9e5c2d5..3312a9b 100644
--- a/phps-functions.el
+++ b/phps-functions.el
@@ -40,7 +40,7 @@
"Start of buffer changes, nil if none.")
;; TODO Also format white-space inside the line, i.e. after function
declarations?
-;; TODO Support inline function indentation
+;; TODO Support inline function indentations
(defun phps-mode/indent-line ()
"Indent line."
(let ((data (phps-mode/get-point-data)))
@@ -121,9 +121,12 @@
(let ((indent-sum (+ (* indent-level tab-width) indent-adjust))
current-indentation (current-indentation))
+ (when (null current-indentation)
+ (setq current-indentation 0))
+
;; Only continue if current indentation is wrong
(when (not (equal indent-sum current-indentation))
- (let ((indent-diff (- current-indentation indent-sum)))
+ (let ((indent-diff (- indent-sum current-indentation)))
;; (message "Indenting to %s current column %s" indent-sum
(current-indentation))
;; (message "inside scripting, start: %s, end: %s, indenting
to column %s " start end indent-level)
@@ -131,16 +134,20 @@
;; TODO When indent is changed the trailing tokens just need
to adjust their token positions, this will improve speed of indent-region a lot
;; TODO Lexer states need to be moved as well
-
(let ((line-start (line-beginning-position)))
-
- ;; Set point of change if it's not set or if it's larger
than current point
- (when (or (not phps-mode/buffer-changes--start)
- (< line-start phps-mode/buffer-changes--start))
- ;; (message "Setting changes start from %s to %s"
phps-mode/buffer-changes--start start)
- (setq phps-mode/buffer-changes--start line-start))
+ (phps-mode/move-lexer-tokens line-start indent-diff)
+ (phps-mode/move-lexer-states line-start indent-diff)
+ (message "Moving tokens and states %s, %s to %s"
indent-diff current-indentation indent-sum)
- (phps-mode/run-incremental-lex)))))))))))
+ ;; ;; Set point of change if it's not set or if it's
larger than current point
+ ;; (when (or (not phps-mode/buffer-changes--start)
+ ;; (< line-start
phps-mode/buffer-changes--start))
+ ;; ;; (message "Setting changes start from %s to %s"
phps-mode/buffer-changes--start start)
+ ;; (setq phps-mode/buffer-changes--start line-start))
+
+ ;; (phps-mode/run-incremental-lex)
+
+ ))))))))))
;; TODO Implement this?
(defun phps-mode/indent-region ()
diff --git a/phps-lexer.el b/phps-lexer.el
index 0478323..33bb126 100644
--- a/phps-lexer.el
+++ b/phps-lexer.el
@@ -1302,7 +1302,7 @@ ANY_CHAR'
new-states))
-(defun phps-mode/lexer-move-lexer-tokens (start diff)
+(defun phps-mode/move-lexer-tokens (start diff)
"Update tokens with moved lexer tokens after or equal to START with
modification DIFF."
(setq phps-mode/lexer-tokens (phps-mode/get-moved-lexer-tokens
phps-mode/lexer-tokens start diff)))
- [elpa] externals/phps-mode 5e30a65 076/405: Added TODO items, (continued)
- [elpa] externals/phps-mode 5e30a65 076/405: Added TODO items, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 94d4814 078/405: Added test for moving lexer tokens, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a59ef7b 079/405: More unit tests for moving lexer token positions, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 287d934 077/405: Updated comments are made un-tested function for moving token positions, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b3821a1 080/405: Updated TODOs, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f4cd90e 072/405: Updated readme and makefile for running all tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f79cf4f 081/405: Started on function for moving lexer states, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e340279 082/405: Added unit tests for moving lexer-state positions, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 89b12ab 084/405: Added autoloads and fixed bug with assigning variable, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a10cc79 085/405: Debugging a indentation case, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e30ac0c 083/405: Started implementation of moving lexer and state position when,
Stefan Monnier <=
- [elpa] externals/phps-mode 8c919ac 087/405: Added failing indentation test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 69ced0d 090/405: Added another unit test for failed indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f2f41a3 088/405: Handles indentation case with } else if (...) {, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 59ba835 086/405: Fixed issue with wrong indentation at trailing opening brace, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 434c3dc 089/405: Added more failing tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 61abf7e 091/405: Added todo item, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f7f931a 092/405: Added another failing indentation test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a8561ab 096/405: Updated unit test for get-point-data with support for square brackets, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode dbc02bb 099/405: Improved syntax table, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 989cc7e 098/405: Fixed flycheck warning about semantic, Stefan Monnier, 2019/07/13