Files
emacsd/elpa/async-20191030.2138/async.elc

194 lines
11 KiB
Plaintext
Raw Normal View History

2019-10-09 20:36:55 +02:00
;ELC
;;; Compiled
2019-10-27 19:05:34 +01:00
;;; in Emacs version 26.3
2019-10-09 20:36:55 +02:00
;;; with all optimizations.
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(byte-code "\300\301\302\303\304\305%\210\306\307\310\311\312DD\313\304\301\314\311&\207" [custom-declare-group async nil "Simple asynchronous processing in Emacs" :group emacs custom-declare-variable async-variables-noprops-function funcall function #[0 "\300\207" [async--purecopy] 1] "Default function to remove text properties in variables." :type] 8)
(defvar async-debug nil)
(defvar async-send-over-pipe t)
(defvar async-in-child-emacs nil)
(defvar async-callback nil)
(defvar async-callback-for-process nil)
(defvar async-callback-value nil)
(defvar async-callback-value-set nil)
(defvar async-current-process nil)
(defvar async--procvar nil)
#@136 Remove text properties in OBJECT.
Argument OBJECT may be a list or a string, if anything else it
is returned unmodified.
(fn OBJECT)
(defalias 'async--purecopy #[257 "\211;\203 \300!\207\211:\203\200\211\301\211:\203}@\262;\203)\300!B\262\202v:\203?\302!A\204?\303!B\262\202v:\203q\302!A\203q@A;\203Z\300!\202[;\203f\300!\202gB\266\202B\262\202vB\262A\262\202\211\237\207\207" [substring-no-properties nil last async--purecopy] 9 (#$ . 1060)])
#@888 Return a `setq' form that replicates part of the calling environment.
It sets the value for every variable matching INCLUDE-REGEXP and
also PREDICATE. It will not perform injection for any variable
matching EXCLUDE-REGEXP (if present) or representing a syntax-table
i.e. ending by "-syntax-table".
When NOPROPS is non nil it tries to strip out text properties of each
variable's value with `async-variables-noprops-function'.
It is intended to be used as follows:
(async-start
`(lambda ()
(require 'smtpmail)
(with-temp-buffer
(insert ,(buffer-substring-no-properties (point-min) (point-max)))
;; Pass in the variable environment for smtpmail
,(async-inject-variables "\`\(smtpmail\|\(user-\)?mail\)-")
(smtpmail-send-it)))
'ignore)
(fn INCLUDE-REGEXP &optional PREDICATE EXCLUDE-REGEXP NOPROPS)
(defalias 'async-inject-variables #[1025 "\300\301C\302\303\304\305\306\307    \n%\310\"\311\312%!\210\211\242\262B\207" [setq nil mapatoms make-byte-code 257 "\306!\205 \307!\211\205J\205m\300\203\310\300\"\205m\302\203*\310\302\"?\205m\310\311\"?\205m\211;\204M\211\312>\204M\211\247\204M\313!\204M\314D\262\303\203V !\262\301\203`\301!\205m\304\304\242B\240\210\304\304\242B\240\207" vconcat vector [async-variables-noprops-function boundp symbol-name string-match "-syntax-table\\'" (nil t) vectorp quote] 6 "\n\n(fn SYM)"] 17 (#$ . 1560)])
(defalias 'async-inject-environment 'async-inject-variables)
#@24
(fn FUNC RESULT BUF)
(defalias 'async-handle-result #[771 "\204\302\300!\210\302\301!\210\303\211\207\304\305\306\307\310!\311\"\312$\216<\2037@\313=\2037\314A@@A@A\"\202:!)\207" [async-callback-value async-callback-value-set make-local-variable t make-byte-code 0 " ?\205\302\300!\207" vconcat vector [async-debug kill-buffer] 2 async-signal signal] 9 (#$ . 3097)])
#@97 Process sentinel used to retrieve the value from the child process.
(fn PROC &optional CHANGE)
(defalias 'async-when-done #[513 "\306!\307=\205gr\310!q\210\311!\312U\203N \203>\n\203.\n! \204f\313p!\210\202f\314\304!\210\314\305!\210\315\211\202fdb\210\316 \210\317\n\320p!p#\202f\314\304!\210\321\322\323\324!\311!#D\314\305!\210\315\211*\207" [async-current-process async-callback-for-process async-callback async-debug async-callback-value async-callback-value-set process-status exit process-buffer process-exit-status 0 kill-buffer make-local-variable t backward-sexp async-handle-result read error format "Async process '%s' failed with exit code %d" process-name] 8 (#$ . 3490)])
#@25
(fn &optional STREAM)
(defalias 'async--receive-sexp #[256 "\302\303\304!!\305\"\305 \203\306\307\310!\"\210\304!\262 \203%\306\311\310!\"\210\312!)\207" [coding-system-for-write async-debug decode-coding-string base64-decode-string read utf-8-auto message "Received sexp {{{%s}}}" pp-to-string "Read sexp {{{%s}}}" eval] 6 (#$ . 4206)])
#@13
(fn SEXP)
(defalias 'async--insert-sexp #[257 "\304\211\305\211\306p\"\210\307ed\310#\210\311ed\305#\210eb\210\312c\210db\210\312\313\261,\207" [print-circle print-escape-nonascii print-length print-level nil t prin1 encode-coding-region utf-8-auto base64-encode-region 34 10] 5 (#$ . 4562)])
#@21
(fn PROCESS SEXP)
(defalias 'async--transmit-sexp #[514 "\301\302!r\211q\210\303\304\305\306\307!\310\"\311$\216\203\312\313\314!\"\210\315!\210\316ed#*\207" [async-debug generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 message "Transmitting sexp {{{%s}}}" pp-to-string async--insert-sexp process-send-region] 9 (#$ . 4869)])
#@52 Called from the child Emacs process' command-line.
(defalias 'async-batch-invoke #[0 "\306\307\n\211\203\310\311\f?\205 ! !\2022\3121+\310\311\f?\205$ ! !0\2022\310\313D!\262)\207" [coding-system-for-write async-in-child-emacs async-debug debug-on-error async-send-over-pipe command-line-args-left utf-8-auto t prin1 async--receive-sexp (error) async-signal] 5 (#$ . 5282)])
#@130 Query a FUTURE to see if it is ready.
I.e., if no blocking
would result from a call to `async-get' on that FUTURE.
(fn FUTURE)
(defalias 'async-ready #[257 "\301!\302>\205\303!\304!\203r\211q\210)\202\305\262\207" [async-callback-value-set process-status (exit signal) process-buffer buffer-live-p t] 4 (#$ . 5677)])
#@47 Wait for FUTURE to become ready.
(fn FUTURE)
(defalias 'async-wait #[257 "\300!?\205\301\302!\210\202\207" [async-ready sleep-for 0.05] 3 (#$ . 6013)])
#@156 Get the value from process FUTURE when it is ready.
FUTURE is returned by `async-start' or `async-start-process' when
its FINISH-FUNC is nil.
(fn FUTURE)
(defalias 'async-get #[257 "\211\203\301!\210\302!\303!\205r\211q\210\304\305p#)\207" [async-callback-value async-wait process-buffer buffer-live-p async-handle-result identity] 6 (#$ . 6178)])
#@65 Return true of VALUE is an async.el message packet.
(fn VALUE)
(defalias 'async-message-p #[257 "\211<\205 \300\301\"\207" [plist-get :async-message] 4 (#$ . 6541)])
#@76 Send the given messages to the asychronous Emacs PROCESS.
(fn &rest ARGS)
(defalias 'async-send #[128 "\302\303\"\203 \205 !\202\304@\305AD\"\207" [async-in-child-emacs async-callback append (:async-message t) async--transmit-sexp quote] 6 (#$ . 6716)])
#@59 Send the given messages to the asychronous Emacs PROCESS.
(defalias 'async-receive #[0 "\300 \207" [async--receive-sexp] 1 (#$ . 6988)])
#@376 Start the executable PROGRAM asynchronously. See `async-start'.
PROGRAM is passed PROGRAM-ARGS, calling FINISH-FUNC with the
process object when done. If FINISH-FUNC is nil, the future
object will return the process object when the program is
finished. Set DEFAULT-DIRECTORY to change PROGRAM's current
working directory.
(fn NAME PROGRAM FINISH-FUNC &rest PROGRAM-ARGS)
(defalias 'async-start-process #[899 "\303\304\304Q!\305\306\307%)rq\210\310\301!\210\311\312\"\210\313\230\204.\310\302!\210\314)\207" [process-connection-type async-callback async-callback-for-process generate-new-buffer "*" nil apply start-process make-local-variable set-process-sentinel async-when-done "emacs" t] 11 (#$ . 7132)])
#@198 The Emacs parameter to use to call emacs without config.
Can be one of "-Q" or "-q".
Default is "-Q" but it is sometimes useful to use "-q" to have a
enhanced config or some more variables loaded.
(defvar async-quiet-switch "-Q" (#$ . 7866))
#@1650 Execute START-FUNC (often a lambda) in a subordinate Emacs process.
When done, the return value is passed to FINISH-FUNC. Example:
(async-start
;; What to do in the child process
(lambda ()
(message "This is a test")
(sleep-for 3)
222)
;; What to do when it finishes
(lambda (result)
(message "Async process done, result should be 222: %s"
result)))
If FINISH-FUNC is nil or missing, a future is returned that can
be inspected using `async-get', blocking until the value is
ready. Example:
(let ((proc (async-start
;; What to do in the child process
(lambda ()
(message "This is a test")
(sleep-for 3)
222))))
(message "I'm going to do some work here") ;; ....
(message "Waiting on async process, result should be 222: %s"
(async-get proc)))
If you don't want to use a callback, and you don't care about any
return value from the child process, pass the `ignore' symbol as
the second argument (if you don't, and never call `async-get', it
will leave *emacs* process buffers hanging around):
(async-start
(lambda ()
(delete-file "a remote file on a slow link" nil))
'ignore)
Note: Even when FINISH-FUNC is present, a future is still
returned except that it yields no value (since the value is
passed to FINISH-FUNC). Call `async-get' on such a future always
returns nil. It can still be useful, however, as an argument to
`async-ready' or `async-wait'.
(fn START-FUNC &optional FINISH-FUNC)
(defalias 'async-start #[513 "\306\307\310\311\312 \n\"! \313\314\315!\316\317\320\f\203\321\202;\322\323!r\211q\210\324\325\326\327\330!\331\"\332$\216\333\334 D!\210\335 *\262&\n\f\203I\336 \334D\"\210 )\207" [coding-system-for-read invocation-name invocation-directory async-quiet-switch async-send-over-pipe async--procvar utf-8-auto async-start-process "emacs" file-truename expand-file-name "-l" locate-library "async" "-batch" "-f" "async-batch-invoke" "<none>" generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 async--insert-sexp quote buffer-string async--transmit-sexp] 20 (#$ . 8116)])
#@70 Evaluate FUNC in a separate Emacs process, synchronously.
(fn FUNC)
(defalias 'async-sandbox '(macro . #[257 "\300\301DD\207" [async-get async-start] 4 (#$ . 10451)]))
#@26
(fn FN FORMS BINDINGS)
(defalias 'async--fold-left #[771 "\211\203\211@<\203\202C\"\262A\266\202\202\210\211\207" [] 9 (#$ . 10627)])
#@318 Implements `let', but each binding is established asynchronously.
For example:
(async-let ((x (foo))
(y (bar)))
(message "%s %s" x y))
expands to ==>
(async-start (foo)
(lambda (x)
(async-start (bar)
(lambda (y)
(message "%s %s" x y)))))
(fn BINDINGS &rest FORMS)
(defalias 'async-let '(macro . #[385 "\300\301\302B\303!#\207" [async--fold-left #[514 "\211A@\300!\203\211\211\262\202\211\301\302E\262\262\303\301@CEE\207" [functionp lambda nil async-start] 8 "\n\n(fn ACC BINDING)"] progn reverse] 7 (#$ . 10787)]))
(byte-code "\300\301\302\303#\304\305!\207" [function-put async-let lisp-indent-function 1 provide async] 4)