[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode d6323a5548 2/8: Moved imenu and bookkeeping t
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode d6323a5548 2/8: Moved imenu and bookkeeping to main thread |
Date: |
Wed, 23 Mar 2022 12:27:10 -0400 (EDT) |
branch: externals/phps-mode
commit d6323a55482df8d814d6277145c2ef39d0a325d3
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Moved imenu and bookkeeping to main thread
---
phps-mode-lex-analyzer.el | 69 ++++++++++++++++++++++++++++++-----------------
phps-mode-lexer.el | 3 +++
2 files changed, 47 insertions(+), 25 deletions(-)
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 7fa1f25530..ffdbd7ec4b 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -250,8 +250,21 @@
(setq phps-mode-lex-analyzer--parse-trail (nth 7 lex-result))
(setq phps-mode-lex-analyzer--parse-error (nth 8 lex-result))
(setq phps-mode-lex-analyzer--ast (nth 9 lex-result))
- (setq phps-mode-lex-analyzer--imenu (nth 10 lex-result))
- (setq phps-mode-lex-analyzer--bookkeeping (nth 11 lex-result))
+
+ ;; Catch errors in bookkeeping or imenu generation
+ (condition-case conditions
+ (progn
+ (phps-mode-ast-bookkeeping--generate)
+ (phps-mode-ast-imenu--generate))
+ (error
+ (display-warning
+ 'phps-mode
+ (format "Failed to generate bookkeeping or imenu: %S" conditions)
+ :warning
+ "*PHPs Parser Errors*")))
+ (setq phps-mode-lex-analyzer--imenu phps-mode-ast-imenu--index)
+ (setq phps-mode-lex-analyzer--bookkeeping
phps-mode-ast-bookkeeping--index)
+
(setq phps-mode-lex-analyzer--processed-buffer-p t)
(phps-mode-lex-analyzer--reset-imenu)
@@ -259,7 +272,8 @@
(dolist (token phps-mode-lex-analyzer--tokens)
(let ((start (car (cdr token)))
(end (cdr (cdr token))))
- (let ((token-syntax-color
(phps-mode-lex-analyzer--get-token-syntax-color token)))
+ (let ((token-syntax-color
+ (phps-mode-lex-analyzer--get-token-syntax-color token)))
(if token-syntax-color
(phps-mode-lex-analyzer--set-region-syntax-color
start end (list 'font-lock-face token-syntax-color))
@@ -387,8 +401,20 @@
(setq phps-mode-lex-analyzer--parse-trail (nth 7 lex-result))
(setq phps-mode-lex-analyzer--parse-error (nth 8 lex-result))
(setq phps-mode-lex-analyzer--ast (nth 9 lex-result))
- (setq phps-mode-lex-analyzer--imenu (nth 10 lex-result))
- (setq phps-mode-lex-analyzer--bookkeeping (nth 11 lex-result))
+
+ ;; Catch errors in bookkeeping or imenu generation
+ (condition-case conditions
+ (progn
+ (phps-mode-ast-bookkeeping--generate)
+ (phps-mode-ast-imenu--generate))
+ (error
+ (display-warning
+ 'phps-mode
+ (format "Failed to generate bookkeeping or imenu: %S" conditions)
+ :warning
+ "*PHPs Parser Errors*")))
+ (setq phps-mode-lex-analyzer--imenu phps-mode-ast-imenu--index)
+ (setq phps-mode-lex-analyzer--bookkeeping
phps-mode-ast-bookkeeping--index)
(phps-mode-debug-message
(message "Incremental tokens: %s" phps-mode-lex-analyzer--tokens))
@@ -1193,9 +1219,7 @@
;; Error-free parse here
(condition-case conditions
(progn
- (phps-mode-ast--generate)
- (phps-mode-ast-bookkeeping--generate)
- (phps-mode-ast-imenu--generate))
+ (phps-mode-ast--generate))
(error
(setq
parse-error
@@ -1204,26 +1228,21 @@
;; Need to copy buffer-local values before killing buffer
(setq parse-trail phps-mode-ast--parse-trail)
(setq ast-tree phps-mode-ast--tree)
- (setq imenu-index phps-mode-ast-imenu--index)
- (setq bookkeeping-index phps-mode-ast-bookkeeping--index)
(kill-buffer)))
- (let
- ((data
- (list
- tokens
- states
- state
- state-stack
- heredoc-label
- heredoc-label-stack
- nest-location-stack
- parse-trail
- parse-error
- ast-tree
- imenu-index
- bookkeeping-index)))
+ (let ((data
+ (list
+ tokens
+ states
+ state
+ state-stack
+ heredoc-label
+ heredoc-label-stack
+ nest-location-stack
+ parse-trail
+ parse-error
+ ast-tree)))
;; Save cache if possible and permitted
(when (and
diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index c4e0558995..8daae5d1b8 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -1999,6 +1999,9 @@
(dolist (lambd lambdas)
(funcall lambd)))
+ (when (fboundp 'thread-yield)
+ (thread-yield))
+
;; Did we find a match?
(if phps-mode-lexer--match-length
(progn
- [elpa] externals/phps-mode updated (246bcc6967 -> 3a09d15aa1), Christian Johansson, 2022/03/23
- [elpa] externals/phps-mode 3a09d15aa1 8/8: Updated version and changelog, Christian Johansson, 2022/03/23
- [elpa] externals/phps-mode d45658d99c 1/8: Starting experimenting with using two threads for serial commands, Christian Johansson, 2022/03/23
- [elpa] externals/phps-mode 9498a7ae53 7/8: Updated TODOs, Christian Johansson, 2022/03/23
- [elpa] externals/phps-mode b13cf27bf0 5/8: Removed unused variables, Christian Johansson, 2022/03/23
- [elpa] externals/phps-mode fd61209f54 3/8: Got serial multi-threading working with 2 separate threads instead of 1, Christian Johansson, 2022/03/23
- [elpa] externals/phps-mode 2e249e5c24 4/8: Moved bookkeeping and imenu generation to separate thread, Christian Johansson, 2022/03/23
- [elpa] externals/phps-mode e0389c235f 6/8: Using separate error catching for imenu and bookkeeping generation, Christian Johansson, 2022/03/23
- [elpa] externals/phps-mode d6323a5548 2/8: Moved imenu and bookkeeping to main thread,
Christian Johansson <=