[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 6593242 257/405: Preparations for doing inden
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 6593242 257/405: Preparations for doing indentation and imenu in one pass |
Date: |
Sat, 13 Jul 2019 10:00:27 -0400 (EDT) |
branch: externals/phps-mode
commit 6593242f9f4b0bd5e68442fdaeecfb4049ea5016
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Preparations for doing indentation and imenu in one pass
---
phps-mode-functions.el | 21 +++++++++++++++------
phps-mode-lexer.el | 5 +++++
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 90eb41a..a9a4900 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -37,6 +37,9 @@
(defvar phps-mode-functions-imenu nil
"The Imenu alist for current buffer, nil if none.")
+(defvar phps-mode-functions-processed-buffer nil
+ "Flag whether current buffer is processed or not.")
+
(defvar phps-mode-functions-verbose nil
"Verbose messaging, default nil.")
@@ -45,6 +48,15 @@
;; TODO Add support for automatic parenthesis, bracket, square-bracket,
single-quote and double-quote encapsulations
+(defun phps-mode-functions-process-current-buffer ()
+ "Process current buffer, generate indentations and Imenu."
+ (unless phps-mode-functions-processed-buffer
+ (unless phps-mode-functions-lines-indent
+ (setq phps-mode-functions-lines-indent
(phps-mode-functions-get-lines-indent)))
+ (unless phps-mode-functions-imenu
+ (setq phps-mode-functions-imenu
(phps-mode-functions--imenu-create-index-function)))
+ (setq phps-mode-functions-processed-buffer t)))
+
;; Set indent for white-space lines as well
(defun phps-mode-functions-get-lines-indent ()
"Get the column and tuning indentation-numbers for each line in buffer that
contain tokens."
@@ -528,10 +540,7 @@
(defun phps-mode-functions-indent-line ()
"Indent line."
- ;; Set lines indent if not set
- (unless phps-mode-functions-lines-indent
- (setq phps-mode-functions-lines-indent
(phps-mode-functions-get-lines-indent)))
-
+ (phps-mode-functions-process-current-buffer)
(when phps-mode-functions-lines-indent
(let ((indent (gethash (line-number-at-pos (point))
phps-mode-functions-lines-indent)))
(when indent
@@ -689,8 +698,7 @@
(defun phps-mode-functions-get-imenu ()
"Get Imenu for current buffer."
- (unless phps-mode-functions-imenu
- (setq phps-mode-functions-imenu
(phps-mode-functions--imenu-create-index-function)))
+ (phps-mode-functions-process-current-buffer)
phps-mode-functions-imenu)
(defun phps-mode-functions-init ()
@@ -716,6 +724,7 @@
(set (make-local-variable 'phps-mode-functions-buffer-changes-start) nil)
(set (make-local-variable 'phps-mode-functions-lines-indent) nil)
(set (make-local-variable 'phps-mode-functions-imenu) nil)
+ (set (make-local-variable 'phps-mode-functions-processed-buffer) nil)
(add-hook 'after-change-functions #'phps-mode-functions-after-change))
diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index 1e6b00f..a4dcc44 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -1270,6 +1270,11 @@ ANY_CHAR'
"Just prepare other lexers for lexing region START to END."
;; (message "phps-mode-lexer-setup %s %s" start end)
+ ;; Flag that buffer has not been processed
+ (when (and (boundp 'phps-mode-functions-processed-buffer)
+ phps-mode-functions-processed-buffer)
+ (setq phps-mode-functions-processed-buffer nil))
+
;; Reset line indents
(when (and (boundp 'phps-mode-functions-lines-indent)
phps-mode-functions-lines-indent)
- [elpa] externals/phps-mode c2af31e 240/405: Imenu support now shows hierarchical information, (continued)
- [elpa] externals/phps-mode c2af31e 240/405: Imenu support now shows hierarchical information, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 55953de 232/405: Lexer now doesn't find keywords in function names, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b8e9449 247/405: Refactored Imenu to use a persistent variable per buffer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 67b8701 244/405: Decreased length of imenu items to prevent truncation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e78d8ed 248/405: Clean-up of indentation code, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c2db7d3 250/405: Preparations for integration test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 11309b8 256/405: Updated readme, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode fcc920f 258/405: More preparations for merging indent and Imenu into one function, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 41c12c1 251/405: Updated paths for byte-compilation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0e927e8 252/405: Fixed compilation command in makefile, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6593242 257/405: Preparations for doing indentation and imenu in one pass,
Stefan Monnier <=
- [elpa] externals/phps-mode 318001e 259/405: Merged Imenu and indentation generation into one iteration of tokens, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 5bb45ce 253/405: Added lexer test for properties inside heredoc, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode caafeba 260/405: Changed idle interval for incremental lexer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c7ad55c 255/405: Passed first integration-test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 310521b 254/405: Started with first integration-test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d39152b 279/405: Added unit test for NUM_STRING token inside double-quoted string, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 44a997e 270/405: Added syntax coloring for "." tokens, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode aa0c23d 263/405: Updated font-locks for token color syntax, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b86dd54 262/405: Indentation now supports new lexer token T_INLINE HTML, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2c8f28c 275/405: Added docstrings to variables, Stefan Monnier, 2019/07/13