emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phps-mode 75743d0c25 022/135: Merge branch 'master' int


From: Christian Johansson
Subject: [elpa] externals/phps-mode 75743d0c25 022/135: Merge branch 'master' into feature/full-sdt
Date: Sun, 29 Jan 2023 03:11:00 -0500 (EST)

branch: externals/phps-mode
commit 75743d0c25fd31dc17c019a5604ec9390478480f
Merge: dd672cd243 69d4de374b
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Merge branch 'master' into feature/full-sdt
---
 phps-mode-lex-analyzer.el | 158 ++++++++++-------
 phps-mode-serial.el       | 431 ++++++++++++++++++++++++++--------------------
 phps-mode.el              |  26 ++-
 3 files changed, 360 insertions(+), 255 deletions(-)

diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 010d4b2098..73dce8050a 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -42,6 +42,15 @@
 (defvar-local phps-mode-lex-analyzer--processed-buffer-p nil
   "Flag whether current buffer is processed or not.")
 
+(defvar-local phps-mode-lex-analyzer--error-end nil
+  "Point of error end or nil.")
+
+(defvar-local phps-mode-lex-analyzer--error-message nil
+  "Message of error.")
+
+(defvar-local phps-mode-lex-analyzer--error-start nil
+  "Point of error start or nil.")
+
 
 ;; VARIABLES
 
@@ -217,6 +226,7 @@
       (setq async nil))
 
     (phps-mode-serial-commands
+
      buffer-name
 
      (lambda()
@@ -295,29 +305,31 @@
            (phps-mode-lex-analyzer--reset-changes)
 
            ;; Signal parser error (if any)
-           (when phps-mode-lex-analyzer--parse-error
-
-             ;; Paint error
-             (phps-mode-lex-analyzer--set-region-syntax-color
-              (nth 4 phps-mode-lex-analyzer--parse-error)
-              (point-max)
-              (list 'font-lock-face 'font-lock-warning-face))
-
-             ;; Display error
-             (display-warning
-              'phps-mode
-              (nth 1 phps-mode-lex-analyzer--parse-error)
-              :warning
-              "*PHPs Parser Errors*")
-
-             ;; Signal that causes updated mode-line status
-             (signal
-              'phps-parser-error
-              (list
-               (nth 1 phps-mode-lex-analyzer--parse-error)
-               (nth 4 phps-mode-lex-analyzer--parse-error))))
-
-           )))
+           (if phps-mode-lex-analyzer--parse-error
+               (progn
+
+                 ;; Paint error
+                 (phps-mode-lex-analyzer--set-region-syntax-color
+                  (nth 4 phps-mode-lex-analyzer--parse-error)
+                  (point-max)
+                  (list 'font-lock-face 'font-lock-warning-face))
+
+                 ;; Set error
+                 (setq phps-mode-lex-analyzer--error-end nil)
+                 (setq phps-mode-lex-analyzer--error-message (nth 1 
phps-mode-lex-analyzer--parse-error))
+                 (setq phps-mode-lex-analyzer--error-start (nth 4 
phps-mode-lex-analyzer--parse-error))
+
+                 ;; Signal that causes updated mode-line status
+                 (signal
+                  'phps-parser-error
+                  (list
+                   (nth 1 phps-mode-lex-analyzer--parse-error)
+                   (nth 4 phps-mode-lex-analyzer--parse-error))))
+
+             ;; Reset error
+             (setq phps-mode-lex-analyzer--error-end nil)
+             (setq phps-mode-lex-analyzer--error-message nil)
+             (setq phps-mode-lex-analyzer--error-start nil)))))
 
      (lambda(result)
        (when (get-buffer buffer-name)
@@ -341,24 +353,25 @@
                      (phps-mode-lex-analyzer--set-region-syntax-color
                       error-start
                       (point-max)
-                      (list 'font-lock-face 'font-lock-warning-face))))
-                 (display-warning
-                  'phps-mode
-                  error-message
-                  :warning
-                  "*PHPs Lexer Errors*"))
+                      (list 'font-lock-face 'font-lock-warning-face)))
 
-                (t
-                 (display-warning
-                  error-type
-                  error-message
-                  :warning))
+                   ;; Set error
+                   (setq phps-mode-lex-analyzer--error-end (if error-end 
error-end nil))
+                   (setq phps-mode-lex-analyzer--error-message error-message)
+                   (setq phps-mode-lex-analyzer--error-start error-start)))
 
-                )
+                (t
+                 (progn
 
-               )
+                   ;; Reset error
+                   (setq phps-mode-lex-analyzer--error-end nil)
+                   (setq phps-mode-lex-analyzer--error-message nil)
+                   (setq phps-mode-lex-analyzer--error-start nil)
 
-             ))))
+                   (display-warning
+                    error-type
+                    error-message
+                    :warning)))))))))
 
      nil
      async
@@ -460,27 +473,31 @@
            (phps-mode-lex-analyzer--reset-changes)
 
            ;; Signal parser error (if any)
-           (when phps-mode-lex-analyzer--parse-error
-
-             ;; Paint error
-             (phps-mode-lex-analyzer--set-region-syntax-color
-              (nth 4 phps-mode-lex-analyzer--parse-error)
-              (point-max)
-              (list 'font-lock-face 'font-lock-warning-face))
-
-             ;; Display error
-             (display-warning
-              'phps-mode
-              (nth 1 phps-mode-lex-analyzer--parse-error)
-              :warning
-              "*PHPs Parser Errors*")
-
-             ;; Signal that causes updated mode-line status
-             (signal
-              'phps-parser-error
-              (list
-               (nth 1 phps-mode-lex-analyzer--parse-error)
-               (nth 4 phps-mode-lex-analyzer--parse-error)))))))
+           (if phps-mode-lex-analyzer--parse-error
+               (progn
+
+                 ;; Paint error
+                 (phps-mode-lex-analyzer--set-region-syntax-color
+                  (nth 4 phps-mode-lex-analyzer--parse-error)
+                  (point-max)
+                  (list 'font-lock-face 'font-lock-warning-face))
+
+                 ;; Set error
+                 (setq phps-mode-lex-analyzer--error-end nil)
+                 (setq phps-mode-lex-analyzer--error-message (nth 1 
phps-mode-lex-analyzer--parse-error))
+                 (setq phps-mode-lex-analyzer--error-start (nth 4 
phps-mode-lex-analyzer--parse-error))
+
+                 ;; Signal that causes updated mode-line status
+                 (signal
+                  'phps-parser-error
+                  (list
+                   (nth 1 phps-mode-lex-analyzer--parse-error)
+                   (nth 4 phps-mode-lex-analyzer--parse-error))))
+
+             ;; Reset error
+             (setq phps-mode-lex-analyzer--error-end nil)
+             (setq phps-mode-lex-analyzer--error-message nil)
+             (setq phps-mode-lex-analyzer--error-start nil)))))
 
      (lambda(result)
        (when (get-buffer buffer-name)
@@ -506,17 +523,24 @@
                       error-start
                       (point-max)
                       (list 'font-lock-face 'font-lock-warning-face))))
-                 (display-warning
-                  'phps-mode
-                  error-message
-                  :warning
-                  "*PHPs Lexer Errors*"))
+
+                 ;; Set error
+                 (setq phps-mode-lex-analyzer--error-end (if error-end 
error-end nil))
+                 (setq phps-mode-lex-analyzer--error-message error-message)
+                 (setq phps-mode-lex-analyzer--error-start error-start))
 
                 (t
-                 (display-warning
-                  error-type
-                  error-message
-                  :warning))))))))
+                 (progn
+
+                 ;; Reset error
+                 (setq phps-mode-lex-analyzer--error-end nil)
+                 (setq phps-mode-lex-analyzer--error-message nil)
+                 (setq phps-mode-lex-analyzer--error-start nil)
+
+                   (display-warning
+                    error-type
+                    error-message
+                    :warning)))))))))
 
      nil
      async
diff --git a/phps-mode-serial.el b/phps-mode-serial.el
index 73e2a93701..e1ca7ed76c 100644
--- a/phps-mode-serial.el
+++ b/phps-mode-serial.el
@@ -44,7 +44,9 @@
     (:propertize (:eval (if (equal phps-mode-serial--status 'error) "Error" 
""))
                  face phps-mode-serial--mode-line-face-error)
     (:propertize (:eval (if (equal phps-mode-serial--status 'success) "OK" ""))
-                 face phps-mode-serial--mode-line-face-success)))
+                 face phps-mode-serial--mode-line-face-success)
+    (:propertize (:eval (if (equal phps-mode-serial--status 'aborted) 
"Aborted" ""))
+                 face phps-mode-serial--mode-line-face-error)))
 
 
 ;; FUNCTIONS
@@ -80,45 +82,45 @@
                        (file-name-directory
                         (symbol-file 'phps-mode))))
                   (puthash
+
                    key
+
                    (async-start
+
                     (lambda()
-                      (add-to-list 'load-path script-filename)
-                      (require 'phps-mode)
+                      (let ((quitted t)
+                            (start-return))
+                        (unwind-protect
+                            (progn
+                              (add-to-list 'load-path script-filename)
+                              (require 'phps-mode)
 
-                      ;; Execute start lambda
-                      (condition-case conditions
-                          (progn
-                            (let ((start-return (funcall start)))
-                              (list 'success start-return start-time)))
-                        (error (list 'error conditions start-time))))
+                              ;; Execute start lambda
+                              (condition-case conditions
+                                  (let ((return (funcall start)))
+                                    (setq
+                                     start-return
+                                     (list 'success return start-time)))
+                                (error
+                                 (setq
+                                  start-return
+                                  (list 'error conditions start-time))))
+                              (setq quitted nil))
+                          (when quitted
+                            (setq
+                             start-return
+                             (list 'error 'quitted))))
+                        start-return))
 
                     (lambda (start-return)
-                      (let ((status (car start-return))
-                            (value (car (cdr start-return)))
+                      (let ((start-status (car start-return))
+                            (start-value (car (cdr start-return)))
                             (start-time (car (cdr (cdr start-return))))
-                            (end-return))
-
-                        ;; Profile execution in debug mode
-                        (when phps-mode-serial--profiling
-                          (let* ((end-time (current-time))
-                                 (end-time-float
-                                  (+ (car end-time) (car (cdr end-time)) (* 
(car (cdr (cdr end-time))) 0.000001)))
-                                 (start-time-float
-                                  (+ (car start-time) (car (cdr start-time)) 
(* (car (cdr (cdr start-time))) 0.000001)))
-                                 (elapsed (- end-time-float start-time-float)))
-                            (message "Serial asynchronous process start 
finished, elapsed: %fs" elapsed)))
-
-                        (if (string= status "success")
+                            (end-return)
+                            (quitted t))
+                        (unwind-protect
                             (progn
 
-                              ;; Execute end lambda
-                              (condition-case conditions
-                                  (progn
-                                    (let ((return (funcall end value)))
-                                      (setq end-return (list 'success return 
start-time))))
-                                (error (setq end-return (list 'error 
conditions start-time))))
-
                               ;; Profile execution in debug mode
                               (when phps-mode-serial--profiling
                                 (let* ((end-time (current-time))
@@ -127,65 +129,108 @@
                                        (start-time-float
                                         (+ (car start-time) (car (cdr 
start-time)) (* (car (cdr (cdr start-time))) 0.000001)))
                                        (elapsed (- end-time-float 
start-time-float)))
-                                  (message "Serial synchronous thread 
finished, elapsed: %fs" elapsed)))
-
-                              (let ((status (car end-return))
-                                    (value (cdr end-return)))
+                                  (message "Serial asynchronous process start 
finished, elapsed: %fs" elapsed)))
 
-                                (when (string= status "success")
-                                  (with-current-buffer key
-                                    (setq phps-mode-serial--status 'success)))
+                              (if (string= start-status "success")
+                                  (progn
 
-                                (when (string= status "error")
+                                    ;; Execute end lambda
+                                    (condition-case conditions
+                                        (progn
+                                          (let ((return (funcall end 
start-value)))
+                                            (setq
+                                             end-return
+                                             (list 'success return 
start-time))))
+                                      (error
+                                       (setq
+                                        end-return
+                                        (list 'error conditions start-time))))
+
+                                    ;; Profile execution in debug mode
+                                    (when phps-mode-serial--profiling
+                                      (let* ((end-time (current-time))
+                                             (end-time-float
+                                              (+ (car end-time) (car (cdr 
end-time)) (* (car (cdr (cdr end-time))) 0.000001)))
+                                             (start-time-float
+                                              (+ (car start-time) (car (cdr 
start-time)) (* (car (cdr (cdr start-time))) 0.000001)))
+                                             (elapsed (- end-time-float 
start-time-float)))
+                                        (message "Serial synchronous thread 
finished, elapsed: %fs" elapsed)))
+
+                                    (let ((end-status (car end-return))
+                                          (end-value (cdr end-return)))
+
+                                      (when (string= end-status "success")
+                                        (with-current-buffer key
+                                          (setq phps-mode-serial--status 
'success)))
+
+                                      (when (string= end-status "error")
+                                        (with-current-buffer key
+                                          (setq phps-mode-serial--status 
'error))
+                                        (when end-error
+                                          (funcall end-error end-value)))))
+
+                                (when (string= start-status "error")
                                   (with-current-buffer key
                                     (setq phps-mode-serial--status 'error))
-                                  (when end-error
-                                    (funcall end-error value)))))
-                          (when (string= status "error")
+                                  (when start-error
+                                    (funcall start-error start-value))))
+
+                              (setq quitted nil))
+                          (when quitted
                             (with-current-buffer key
-                              (setq phps-mode-serial--status 'error))
-                            (when start-error
-                              (funcall start-error value))))
+                              (setq phps-mode-serial--status 'aborted))))
+
                         end-return)))
+
                    phps-mode-serial--async-processes))
               (signal 'error (list "Async-start function is missing")))
 
           ;; Run command(s) asynchronously
           (let ((async-thread
                  (make-thread
-                  (lambda()
-                    (let ((start-return))
 
-                      ;; First execute start lambda
-                      (condition-case conditions
-                          (let ((return (funcall start)))
-                            (setq
-                             start-return
-                             (list 'success return start-time)))
-                        (error
-                         (setq
-                          start-return
-                          (list 'error conditions start-time))))
-
-                      ;; Profile execution in debug mode
-                      (when phps-mode-serial--profiling
-                        (let* ((end-time (current-time))
-                               (end-time-float
-                                (+
-                                 (car end-time)
-                                 (car (cdr end-time))
-                                 (* (car (cdr (cdr end-time))) 0.000001)))
-                               (start-time-float
-                                (+
-                                 (car start-time)
-                                 (car (cdr start-time))
-                                 (* (car (cdr (cdr start-time))) 0.000001)))
-                               (elapsed (- end-time-float start-time-float)))
-                          (message
-                           "Serial asynchronous thread start finished, 
elapsed: %fs"
-                           elapsed)))
+                  (lambda()
+                    (let ((quitted t)
+                          (start-return))
+                      (unwind-protect
+                          (progn
 
+                            ;; First execute start lambda
+                            (condition-case conditions
+                                (let ((return (funcall start)))
+                                  (setq
+                                   start-return
+                                   (list 'success return start-time)))
+                              (error
+                               (setq
+                                start-return
+                                (list 'error conditions start-time))))
+
+                            ;; Profile execution in debug mode
+                            (when phps-mode-serial--profiling
+                              (let* ((end-time (current-time))
+                                     (end-time-float
+                                      (+
+                                       (car end-time)
+                                       (car (cdr end-time))
+                                       (* (car (cdr (cdr end-time))) 
0.000001)))
+                                     (start-time-float
+                                      (+
+                                       (car start-time)
+                                       (car (cdr start-time))
+                                       (* (car (cdr (cdr start-time))) 
0.000001)))
+                                     (elapsed (- end-time-float 
start-time-float)))
+                                (message
+                                 "Serial asynchronous thread start finished, 
elapsed: %fs"
+                                 elapsed)))
+
+                            (setq quitted nil))
+                        (progn
+                          (when quitted
+                            (with-current-buffer key
+                              (setq phps-mode-serial--status 'aborted)))))
                       start-return))
+
                   key)))
             (puthash
              key
@@ -193,125 +238,139 @@
              phps-mode-serial--async-threads)
 
             (make-thread
+
              (lambda()
-                (let ((start-return (thread-join async-thread))
-                      (end-return))
-                  (let ((status (car start-return))
-                        (value (car (cdr start-return)))
-                        (start-time (car (cdr (cdr start-return)))))
+               (let ((quitted t))
+                 (unwind-protect
+                     (let ((start-return (thread-join async-thread))
+                           (end-return))
+                       (let ((start-status (car start-return))
+                             (start-value (car (cdr start-return)))
+                             (start-time (car (cdr (cdr start-return)))))
+
+                         (if (string= start-status "success")
+                             (progn
+
+                               ;; Then execute end lambda
+                               (condition-case conditions
+                                   (let ((return (funcall end start-value)))
+                                     (setq
+                                      end-return
+                                      (list 'success return start-time)))
+                                 (error
+                                  (setq
+                                   end-return
+                                   (list 'error conditions start-time))))
+
+                               ;; Profile execution
+                               (when phps-mode-serial--profiling
+                                 (let* ((end-time (current-time))
+                                        (end-time-float
+                                         (+
+                                          (car end-time)
+                                          (car (cdr end-time))
+                                          (* (car (cdr (cdr end-time))) 
0.000001)))
+                                        (start-time-float
+                                         (+
+                                          (car start-time)
+                                          (car (cdr start-time))
+                                          (* (car (cdr (cdr start-time))) 
0.000001)))
+                                        (elapsed (- end-time-float 
start-time-float)))
+                                   (message
+                                    "Serial asynchronous thread end finished, 
elapsed: %fs"
+                                    elapsed)))
+
+                               (let ((end-status (car end-return))
+                                     (end-value (car (cdr end-return))))
+
+                                 (when (string= end-status "success")
+                                   (with-current-buffer key
+                                     (setq phps-mode-serial--status 'success)))
+
+                                 (when (string= end-status "error")
+                                   (with-current-buffer key
+                                     (setq phps-mode-serial--status 'error))
+                                   (when end-error
+                                     (funcall end-error end-value)))))
+
+                           (when (string= start-status "error")
+                             (with-current-buffer key
+                               (setq phps-mode-serial--status 'error))
+                             (when start-error
+                               (funcall start-error start-value)))))
+                       (setq quitted nil))
+                   (when quitted
+                     (with-current-buffer key
+                       (setq phps-mode-serial--status 'aborted)))))))))
 
-                    (if (string= status "success")
-                        (progn
+      (let ((start-return)
+            (end-return)
+            (quitted t))
+        (unwind-protect
+            (progn
 
-                          ;; Then execute end lambda
-                          (condition-case conditions
-                              (let ((return (funcall end value)))
-                                (setq
-                                 end-return
-                                 (list 'success return start-time)))
-                            (error
-                             (setq
-                              end-return
-                              (list 'error conditions start-time))))
-
-                          ;; Profile execution
-                          (when phps-mode-serial--profiling
-                            (let* ((end-time (current-time))
-                                   (end-time-float
-                                    (+
-                                     (car end-time)
-                                     (car (cdr end-time))
-                                     (* (car (cdr (cdr end-time))) 0.000001)))
-                                   (start-time-float
-                                    (+
-                                     (car start-time)
-                                     (car (cdr start-time))
-                                     (* (car (cdr (cdr start-time))) 
0.000001)))
-                                   (elapsed (- end-time-float 
start-time-float)))
-                              (message
-                               "Serial asynchronous thread end finished, 
elapsed: %fs"
-                               elapsed)))
-
-                          (let ((status (car end-return))
-                                (value (car (cdr end-return))))
-
-                            (when (string= status "success")
-                              (with-current-buffer key
-                                (setq phps-mode-serial--status 'success)))
-
-                            (when (string= status "error")
-                              (with-current-buffer key
-                                (setq phps-mode-serial--status 'error))
-                              (when end-error
-                                (funcall end-error value)))))
-
-                      (when (string= status "error")
-                        (with-current-buffer key
-                          (setq phps-mode-serial--status 'error))
-                        (when start-error
-                          (funcall start-error value))))))))))
+              ;; Run start and catch potential errors
+              (condition-case conditions
+                  (progn
+                    (let ((return (funcall start)))
+                      (setq start-return (list 'success return start-time))))
+                (error (setq start-return (list 'error conditions 
start-time))))
+
+              ;; Profile execution in debug mode
+              (when phps-mode-serial--profiling
+                (let* ((end-time (current-time))
+                       (end-time-float
+                        (+ (car end-time) (car (cdr end-time)) (* (car (cdr 
(cdr end-time))) 0.000001)))
+                       (start-time-float
+                        (+ (car start-time) (car (cdr start-time)) (* (car 
(cdr (cdr start-time))) 0.000001)))
+                       (elapsed (- end-time-float start-time-float)))
+                  (message "Serial synchronous thread start finished, elapsed: 
%fs" elapsed)))
+
+              (let ((start-status (car start-return))
+                    (start-value (car (cdr start-return)))
+                    (start-time (car (cdr (cdr start-return)))))
+
+                (if (string= start-status "success")
+                    (progn
+
+                      ;; Then execute end lambda
+                      (condition-case conditions
+                          (let ((return (funcall end start-value)))
+                            (setq end-return (list 'success return 
start-time)))
+                        (error (setq end-return (list 'error conditions 
start-time))))
 
-      (let ((start-return)
-            (end-return))
+                      ;; Profile execution in debug mode
+                      (when phps-mode-serial--profiling
+                        (let* ((end-time (current-time))
+                               (end-time-float
+                                (+ (car end-time) (car (cdr end-time)) (* (car 
(cdr (cdr end-time))) 0.000001)))
+                               (start-time-float
+                                (+ (car start-time) (car (cdr start-time)) (* 
(car (cdr (cdr start-time))) 0.000001)))
+                               (elapsed (- end-time-float start-time-float)))
+                          (message "Serial synchronous thread end finished, 
elapsed: %fs" elapsed)))
 
-        ;; Run start and catch potential errors
-        (condition-case conditions
-            (progn
-              (let ((return (funcall start)))
-                (setq start-return (list 'success return start-time))))
-          (error (setq start-return (list 'error conditions start-time))))
-
-        ;; Profile execution in debug mode
-        (when phps-mode-serial--profiling
-          (let* ((end-time (current-time))
-                 (end-time-float
-                  (+ (car end-time) (car (cdr end-time)) (* (car (cdr (cdr 
end-time))) 0.000001)))
-                 (start-time-float
-                  (+ (car start-time) (car (cdr start-time)) (* (car (cdr (cdr 
start-time))) 0.000001)))
-                 (elapsed (- end-time-float start-time-float)))
-            (message "Serial synchronous thread start finished, elapsed: %fs" 
elapsed)))
-
-        (let ((status (car start-return))
-              (value (car (cdr start-return)))
-              (start-time (car (cdr (cdr start-return)))))
-
-          (if (string= status "success")
-              (progn
-
-                ;; Then execute end lambda
-                (condition-case conditions
-                    (let ((return (funcall end value)))
-                      (setq end-return (list 'success return start-time)))
-                  (error (setq end-return (list 'error conditions 
start-time))))
-
-                ;; Profile execution in debug mode
-                (when phps-mode-serial--profiling
-                  (let* ((end-time (current-time))
-                         (end-time-float
-                          (+ (car end-time) (car (cdr end-time)) (* (car (cdr 
(cdr end-time))) 0.000001)))
-                         (start-time-float
-                          (+ (car start-time) (car (cdr start-time)) (* (car 
(cdr (cdr start-time))) 0.000001)))
-                         (elapsed (- end-time-float start-time-float)))
-                    (message "Serial synchronous thread end finished, elapsed: 
%fs" elapsed)))
-
-                (let ((status (car end-return))
-                      (value (car (cdr end-return))))
-
-                  (when (string= status "success")
-                    (with-current-buffer key
-                      (setq phps-mode-serial--status 'success)))
+                      (let ((end-status (car end-return))
+                            (end-value (car (cdr end-return))))
+
+                        (when (string= end-status "success")
+                          (with-current-buffer key
+                            (setq phps-mode-serial--status 'success)))
+
+                        (when (string= end-status "error")
+                          (with-current-buffer key
+                            (setq phps-mode-serial--status 'error))
+                          (when end-error
+                            (funcall end-error end-value)))))
 
-                  (when (string= status "error")
+                  (when (string= start-status "error")
                     (with-current-buffer key
                       (setq phps-mode-serial--status 'error))
-                    (when end-error
-                      (funcall end-error value)))))
-
-            (when (string= status "error")
-              (with-current-buffer key
-                (setq phps-mode-serial--status 'error))
-              (when start-error
-                (funcall start-error value)))))
+                    (when start-error
+                      (funcall start-error start-value)))))
+              (setq quitted nil))
+          (when quitted
+            (with-current-buffer key
+              (setq phps-mode-serial--status 'aborted))))
         end-return))))
 
 (provide 'phps-mode-serial)
diff --git a/phps-mode.el b/phps-mode.el
index 3e75faf5ce..e4599d226e 100644
--- a/phps-mode.el
+++ b/phps-mode.el
@@ -5,8 +5,8 @@
 ;; Author: Christian Johansson <christian@cvj.se>
 ;; Maintainer: Christian Johansson <christian@cvj.se>
 ;; Created: 3 Mar 2018
-;; Modified: 18 Mar 2022
-;; Version: 0.4.19
+;; Modified: 23 May 2022
+;; Version: 0.4.22
 ;; Keywords: tools, convenience
 ;; URL: https://github.com/cjohansson/emacs-phps-mode
 
@@ -73,6 +73,22 @@
     map)
   "Keymap for `phps-mode'.")
 
+(defun phps-mode-error-notice ()
+  "Display error notices in echo are if any."
+  (when (and
+         phps-mode-lex-analyzer--error-start
+         phps-mode-lex-analyzer--error-message
+         (>= (point) phps-mode-lex-analyzer--error-start))
+    (let ((display-error))
+      (if phps-mode-lex-analyzer--error-end
+          (when (<= (point) phps-mode-lex-analyzer--error-end)
+            (setq display-error t))
+        (setq display-error t))
+      (when display-error
+        (message
+         "PHPs Error: %s"
+         phps-mode-lex-analyzer--error-message)))))
+
 ;;;###autoload
 (defun phps-mode-rescan-buffer ()
   "Re-scan buffer."
@@ -241,6 +257,12 @@
    0
    t)
 
+  ;; Support for error notices
+  (run-with-idle-timer
+   phps-mode-idle-interval
+   t
+   #'phps-mode-error-notice)
+
   ;; Initial run of lexer
   (phps-mode-lex-analyzer--re2c-run
    nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]