[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/async d604187c3c: Allow let-binding the value of `async
From: |
ELPA Syncer |
Subject: |
[elpa] externals/async d604187c3c: Allow let-binding the value of `async-prompt-for-password' (#182) |
Date: |
Fri, 22 Dec 2023 15:57:19 -0500 (EST) |
branch: externals/async
commit d604187c3c8a3290e78c00b4532b83d8d908b5c3
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Allow let-binding the value of `async-prompt-for-password' (#182)
To do this, we use a local lexical var bound to
async-prompt-for-password and pass the value of this var through a
closure used as process filter.
---
async.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/async.el b/async.el
index a42085eb13..581c78de3f 100644
--- a/async.el
+++ b/async.el
@@ -215,7 +215,7 @@ It is intended to be used as follows:
(process-name proc) (process-exit-status proc))))
(set (make-local-variable 'async-callback-value-set) t))))))
-(defun async-read-from-client (proc string)
+(defun async-read-from-client (proc string &optional prompt-for-pwd)
"Process text from client process.
The string chunks usually arrive in maximum of 4096 bytes, so a
@@ -225,9 +225,13 @@ function.
We use a marker `async-read-marker' to track the position of the
lasts complete line. Every time we get new input, we try to look
for newline, and if found, process the entire line and bump the
-marker position to the end of this next line."
+marker position to the end of this next line.
+
+Argument PROMPT-FOR-PWD allow binding lexically the value of
+`async-prompt-for-password', if unspecified its global value
+is used."
(with-current-buffer (process-buffer proc)
- (when (and async-prompt-for-password
+ (when (and prompt-for-pwd
(boundp 'tramp-password-prompt-regexp)
tramp-password-prompt-regexp
(string-match tramp-password-prompt-regexp string))
@@ -416,6 +420,7 @@ finished. Set DEFAULT-DIRECTORY to change PROGRAM's current
working directory."
(let* ((buf (generate-new-buffer (concat "*" name "*")))
(buf-err (generate-new-buffer (concat "*" name ":err*")))
+ (prt-for-pwd async-prompt-for-password)
(proc (let ((process-connection-type nil))
(make-process
:name name
@@ -432,9 +437,12 @@ working directory."
(set (make-local-variable 'async-read-marker)
(set-marker (make-marker) (point-min) buf))
(set-marker-insertion-type async-read-marker nil)
-
(set-process-sentinel proc #'async-when-done)
- (set-process-filter proc #'async-read-from-client)
+ ;; Pass the value of `async-prompt-for-password' to the process
+ ;; filter fn trough the lexical local var prt-for-pwd (Issue#182).
+ (set-process-filter proc (lambda (proc string)
+ (async-read-from-client
+ proc string prt-for-pwd)))
(unless (string= name "emacs")
(set (make-local-variable 'async-callback-for-process) t))
proc)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/async d604187c3c: Allow let-binding the value of `async-prompt-for-password' (#182),
ELPA Syncer <=