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

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

[nongnu] elpa/arduino-mode 9b1bdb8 060/107: support show process info in


From: ELPA Syncer
Subject: [nongnu] elpa/arduino-mode 9b1bdb8 060/107: support show process info in mode-line
Date: Sun, 29 Aug 2021 10:58:16 -0400 (EDT)

branch: elpa/arduino-mode
commit 9b1bdb8d4bce86964ffe82fb53cd16640c943412
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>

    support show process info in mode-line
---
 arduino-mode.el | 69 +++++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 45 insertions(+), 24 deletions(-)

diff --git a/arduino-mode.el b/arduino-mode.el
index be5b392..2fe2c09 100644
--- a/arduino-mode.el
+++ b/arduino-mode.el
@@ -183,41 +183,62 @@ Each list item should be a regexp matching a single 
identifier."
 (easy-menu-add-item arduino-menu
                                nil ["Serial monitor" arduino-serial-monitor t])
 
+(defvar arduino-upload-process-buf nil)
+
 (defun arduino-upload ()
   "Build and upload the sketch to an Arduino board."
   (interactive)
-  (make-process
-   :command (list "arduino" "--upload" (buffer-file-name))
-   :name "arduino-upload"
-   :buffer "*arduino-upload*"
-   :sentinel (lambda (proc event)
-               (when (string= event "finished\n")
-                 (message "Arduino upload succeed.")))
-   ))
+  (setq arduino-upload-process-buf (buffer-name))
+  (let* ((proc-name "arduino-upload")
+         (proc-buffer "*arduino-upload*")
+         (proc (make-process
+                :command (list "arduino" "--upload" (buffer-file-name))
+                :name proc-name
+                :buffer proc-buffer
+                :sentinel (lambda (proc event)
+                            (when (string= event "finished\n")
+                              (with-current-buffer arduino-upload-process-buf
+                                (setq mode-line-process nil))
+                              (message "Arduino upload succeed."))))))
+    (setq mode-line-process proc-name)))
+
+(defvar arduino-verify-process-buf nil)
 
 (defun arduino-verify ()
   "Verify the sketch by building it."
   (interactive)
-  (make-process
-   :command (list "arduino" "--verify" (buffer-file-name))
-   :name "arduino-verify"
-   :buffer "*arduino-verify*"
-   :sentinel (lambda (proc event)
-               (when (string= event "finished\n")
-                 (message "Arduino verify build succeed.")))
-   ))
+  (setq arduino-verify-process-buf (buffer-name))
+  (let* ((proc-name "arduino-verify")
+         (proc-buffer "*arduino-verify*")
+         (proc (make-process
+                :command (list "arduino" "--verify" (buffer-file-name))
+                :name proc-name
+                :buffer proc-buffer
+                :sentinel (lambda (proc event)
+                            (when (string= event "finished\n")
+                              (with-current-buffer arduino-verify-process-buf
+                                (setq mode-line-process nil))
+                              (message "Arduino verify build succeed."))))))
+    (setq mode-line-process proc-name)))
+
+(defvar arduino-open-process-buf nil)
 
 (defun arduino-open-with-arduino ()
   "Open the sketch with the Arduino IDE."
   (interactive)
-  (make-process
-   :command (list "arduino" (buffer-file-name))
-   :name "arduino-open"
-   :buffer "*arduino-open*"
-   :sentinel (lambda (proc event)
-               (when (string= event "finished\n")
-                 (message "Opened with Arduino succeed.")))
-   ))
+  (setq arduino-open-process-buf (buffer-name))
+  (let* ((proc-name "arduino-open")
+         (proc-buffer "*arduino-open*")
+         (proc (make-process
+                :command (list "arduino" (buffer-file-name))
+                :name proc-name
+                :buffer proc-buffer
+                :sentinel (lambda (proc event)
+                            (when (string= event "finished\n")
+                              (with-current-buffer arduino-open-process-buf
+                                (setq mode-line-process nil))
+                              (message "Opened with Arduino succeed."))))))
+    (setq mode-line-process proc-name)))
 
 (defun arduino-install-boards (board)
   "Install `BOARD' support for Arduino."



reply via email to

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