[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gtags-mode e8d19c4333 52/61: Add code to run extra sent
From: |
ELPA Syncer |
Subject: |
[elpa] externals/gtags-mode e8d19c4333 52/61: Add code to run extra sentinel |
Date: |
Thu, 28 Apr 2022 10:57:42 -0400 (EDT) |
branch: externals/gtags-mode
commit e8d19c43338eac69cc1f2b7e878cceb12d4c4dae
Author: Jimmy Aguilar Mena <kratsbinovish@gmail.com>
Commit: Jimmy Aguilar Mena <kratsbinovish@gmail.com>
Add code to run extra sentinel
Run the extra sentinel when set in the parent buffer for async
processes.
Rename :buffer to :parent-buffer.
---
gtags-mode.el | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/gtags-mode.el b/gtags-mode.el
index e0502da9fe..3416e15088 100644
--- a/gtags-mode.el
+++ b/gtags-mode.el
@@ -97,21 +97,24 @@ The address is relative on remote hosts and includes the
remote prefix.")
(defun gtags-mode--exec-async-sentinel (process event)
"Sentinel to run when PROCESS emits EVENT.
This is the sentinel set in `gtags-mode--exec-async'."
- (let ((temp-buffer (process-buffer process))
- (parent-buffer (process-get process :buffer)))
- (if (and (eq (process-status process) 'exit) ;; if success
- (eq (process-exit-status process) 0))
- (and (buffer-name temp-buffer) ;; kill temp buffer
- (kill-buffer temp-buffer))
- (with-current-buffer temp-buffer ;; else print error
- (while (accept-process-output process))
- (message "Global async error output:\n%s" (buffer-string))))
- (when (buffer-live-p parent-buffer) ;; Always clear the cache
- (with-current-buffer parent-buffer
- (when gtags-mode--plist
- (plist-put gtags-mode--plist :cache nil))))
- ;; TODO: use `remote-command' in the future, it will be on emacs 29.1
- (message "Async %s: %s" (process-get process :command) event))) ;; Notify
+ (if (and (eq (process-status process) 'exit) ;; On success e
+ (eql (process-exit-status process) 0))
+ (let ((temp-buffer (process-buffer process))
+ (parent-buffer (process-get process :parent-buffer))
+ (extra-sentinel (process-get process :extra-sentinel)))
+ (when (buffer-name temp-buffer) ;; kill temp buffer
+ (while (accept-process-output process))
+ (kill-buffer temp-buffer))
+ (when (buffer-live-p parent-buffer) ;; work on parent buffer
+ (with-current-buffer parent-buffer
+ (when (functionp extra-sentinel) ;; run extra sentinel
+ (funcall extra-sentinel))
+ (when gtags-mode--plist ;; clear cache
+ (plist-put gtags-mode--plist :cache nil)))))
+ (with-current-buffer (process-buffer process) ;; In failure print
error
+ (while (accept-process-output process))
+ (message "Global async error output:\n%s" (buffer-string))))
+ (message "Async %s: %s" (process-get process :command) event)) ;; Notify
always
(defsubst gtags-mode--quote (args symbol)
"Pre-process ARGS and quote SYMBOL."
@@ -133,7 +136,7 @@ Returns the process object."
:file-handler t)))
(progn
;; In future not needed with `remote-commands'.
- (set-process-plist pr `(:buffer ,(current-buffer) :command ,command))
+ (set-process-plist pr `(:parent-buffer ,(current-buffer) :command
,command))
pr)
(message "Can't start async %s subprocess" cmd)
nil))
- [elpa] externals/gtags-mode 053184f8b5 14/61: Don't call with-connection-local-variables, (continued)
- [elpa] externals/gtags-mode 053184f8b5 14/61: Don't call with-connection-local-variables, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 192258fa32 17/61: Use list instead of quotes., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 9fc5c618a1 36/61: Simplify a bit more the cache handling code., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode c823dcffc9 49/61: Assert not call plist-put for nil, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode d4890f5bb3 45/61: Small simplification., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 95b730930b 27/61: Remove global-xref--sync-sentinel, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 1f2f3d272b 57/61: Fix performance issue., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 9dcb18fbe7 58/61: Use cscope output; it is easier to parse., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 0954a065d3 37/61: Miscellaneous fixes, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode a14940cd98 35/61: Reorder some code and simplify cache code, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode e8d19c4333 52/61: Add code to run extra sentinel,
ELPA Syncer <=
- [elpa] externals/gtags-mode 9c4323a5e6 13/61: Improve connection local code., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode a9f6acbaba 22/61: List GTAGS buffers., ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 04c2d9fbaf 24/61: Use file-truename, ELPA Syncer, 2022/04/28
- [elpa] externals/gtags-mode 599dfb8002 18/61: Improve debug of async processes., ELPA Syncer, 2022/04/28