;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\207" [require cl-lib inline] 2) #@32 Dummy buffer for stderr pipes. (defvar pfuture--dummy-buffer nil (#$ . 154)) #@56 Delete PROCESS with redisplay inhibited. (fn PROCESS) (defalias 'pfuture--delete-process #[257 "\301\302!)\207" [inhibit-redisplay t delete-process] 3 (#$ . 237)]) (byte-code "\300\301\302\303#\300\207" [function-put pfuture--delete-process compiler-macro pfuture--delete-process--inliner] 4) #@29 (fn INLINE--FORM PROCESS) (defalias 'pfuture--delete-process--inliner #[514 "\30021\211\301!\203\211\202\302\303!\304\305\306DC\307DE=\203'\211\266\203\2020\310DC\"\266\2030\207" [inline--just-use macroexp-copyable-p make-symbol "process" let inhibit-redisplay t delete-process macroexp-let*] 8 (#$ . 539)]) #@60 Delete the stderr pipe process of PROCESS. (fn PROCESS _) (defalias 'pfuture--sentinel #[514 "\300!?\205\301\302\"\303\302\304#\210\305\306\304\307$\262\207" [process-live-p process-get stderr-process process-put nil run-with-idle-timer 0 pfuture--delete-process] 8 (#$ . 869)]) #@525 Create a new future process for command CMD. Any arguments after the command are interpreted as arguments to the command. This will return a process object with additional 'stderr and 'stdout properties, which can be read via (process-get process 'stdout) and (process-get process 'stderr) or alternatively with (pfuture-result process) or (pfuture-stderr process). Note that CMD must be a *sequence* of strings, meaning this is wrong: (pfuture-new "git status") this is right: (pfuture-new "git" "status") (fn &rest CMD) (defalias 'pfuture-new #[128 "\302\303\304\305\206 \306\307!\211\310\311\312\313&\314\315\"\210\3161D\317\303\320\321\322\323\312\324\325 \310\311&\f\326\327\330\327\331\257\332\"\210\332\"\210\266\2020\207\311\333!\210)\334@A\"\207" [pfuture--dummy-buffer inhibit-redisplay make-pipe-process :name "Process Future stderr" :buffer get-buffer-create " *pfuture stderr dummy*" :noquery t :filter pfuture--append-stderr set-process-buffer nil (error) make-process "Process Future" :stderr :sentinel pfuture--sentinel pfuture--append-stdout :command stdout "" stderr stderr-process set-process-plist delete-process signal] 15 (#$ . 1163)]) #@151 Expands into the correct call form for FN and ARGS. FN may either be a (sharp) quoted function, and unquoted function or an sexp. (fn FN &rest ARGS) (defalias 'pfuture--decompose-fn-form '(macro . #[385 ":\203A\242\211\300\267\202?\243\211:\203$\211\242\243\211\204\"\211B\207\207\207\243\211:\203=\211\242\243\211\204;\211B\207\207\207\207\204G\301\207\302BB\207" [#s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (function 13 quote 38)) nil funcall] 9 (#$ . 2350)])) (byte-code "\300\301\302\303#\300\207" [function-put pfuture--decompose-fn-form lisp-indent-function 1] 4) #@3025 Pfuture variant that supports a callback-based workflow. Internally based on `make-process'. Requires lexical scope. The first - and only required - argument is COMMAND. It is an (unquoted) list of the command and the arguments for the process that should be started. A vector is likewise acceptable - the difference is purely cosmetic (this does not apply when command is passed as a variable, in this case it must be a list). The rest of the argument list is made up of the following keyword arguments: ON-SUCCESS is the code that will run once the process has finished with an exit code of 0. In its context, these variables are bound: `process': The process object, as passed to the sentinel callback function. `status': The string exit status, as passed to the sentinel callback function. `pfuture-buffer': The buffer where the output of the process is collected, including both stdin and stdout. You can use `pfuture-callback-output' to quickly grab the buffer's content. ON-SUCCESS may take one of 3 forms: an unquoted sexp, a quoted function or an unquoted function. In the former two cases the passed fuction will be called with `process', `status' and `buffer' as its arguments. ON-FAILURE is the inverse to ON-SUCCESS; it will only run if the process has finished with a non-zero exit code. Otherwise the same conditions apply as for ON-SUCCESS. ON-STATUS-CHANGE will run on every status change, even if the process remains running. It is meant for debugging and has access to the same variables as ON-SUCCESS and ON-ERROR, including the (potentially incomplete) process output buffer. Otherwise the same conditions as for ON-SUCCESS and ON-ERROR apply. DIRECTORY is the value given to `default-directory' for the context of the process. If not given it will fall back the current value of `default-directory'. NAME will be passed to the :name property of `make-process'. If not given it will fall back to "Pfuture Callback [$COMMAND]". CONNECTION-TYPE will be passed to the :connection-process property of `make-process'. If not given it will fall back to 'pipe. BUFFER is the buffer that will be used by the process to collect its output, quickly collectible with `pfuture-output-from-buffer'. Providing a buffer outside of specific use-cases is not necessary, as by default pfuture will assign every launched command its own unique buffer and kill it after ON-SUCCESS or ON-ERROR have finished running. However, no such cleanup will take place if a custom buffer is provided. FILTER is a process filter-function (quoted function reference) that can be used to overwrite pfuture's own filter. By default pfuture uses its filter function to collect the launched process' output in its buffer, thus when providing a custom filter output needs to be gathered another way. Note that the process' buffer is stored in its `buffer' property and is therefore accessible via (process-get process 'buffer). (fn COMMAND &key DIRECTORY ON-SUCCESS ON-ERROR ON-STATUS-CHANGE NAME CONNECTION-TYPE BUFFER FILTER) (defalias 'pfuture-callback '(macro . #[385 "\301\302\"A@\301\303\"A@\301\304\"A@\301\305\"A@\301\306\"A@\301\307\"A@\301\310\"A@\301\311\"A@\312\n!\203U\313\314\315\f\316\317\320$\205O\321\"\266\205D\202W \206\\\322 \206b \204o\204o\323\262\n\324\300D\325\326\n\327\330 EED\331\326 \332BBD\333\334\306\325\335 \307\f\311\206\227\336\337\340\341\342\343\205\250\344\345BBC\346\347\350\351\344\"\352BB\344\"\353BBF?\205\300\354FC\"BBB\257 DF\355BB\207" [default-directory plist-member :directory :on-success :on-error :on-status-change :name :connection-type :buffer :filter vectorp quote list identity nil apply cl-mapcar cl-coerce 'pipe #'ignore let* name or format "Pfuture-Callback %s" pfuture-buffer ((let (buffer-list-update-hook) (generate-new-buffer name))) process make-process :command #'pfuture--append-output-to-buffer :sentinel lambda (process status) (ignore status) append pfuture--decompose-fn-form (process status pfuture-buffer) unless (process-live-p process) if (= 0 (process-exit-status process)) (process status pfuture-buffer) (process status pfuture-buffer) (kill-buffer (process-get process 'buffer)) ((process-put process 'buffer pfuture-buffer) process)] 41 (#$ . 2999)])) (byte-code "\300\301\302\303#\300\207" [function-put pfuture-callback lisp-indent-function 1] 4) #@118 Retrieve the output from the pfuture-buffer variable in the current scope. Meant to be used with `pfuture-callback'. (defalias 'pfuture-callback-output '(macro . #[0 "\300\207" [(pfuture-output-from-buffer pfuture-buffer)] 1 (#$ . 7379)])) #@449 Block until PROCESS has produced output and return it. Will accept the following optional keyword arguments: TIMEOUT: The timeout in seconds to wait for the process. May be a float to specify fractional number of seconds. In case of a timeout nil will be returned. JUST-THIS-ONE: When t only read from the process of FUTURE and no other. For details see documentation of `accept-process-output'. (fn PROCESS &key (TIMEOUT 1) (JUST-THIS-ONE t)) (defalias 'pfuture-await #[385 "\301\302\"\206\303A@\301\304\"\206\305A@\306\307\306$\210)\310\311\"\207" [inhibit-quit plist-member :timeout (nil 1) :just-this-one (nil t) nil accept-process-output process-get result] 9 (#$ . 7626)]) #@55 Return the output of a pfuture PROCESS. (fn PROCESS) (defalias 'pfuture-result #[257 "\300\301\"\207" [process-get stdout] 4 (#$ . 8326)]) (byte-code "\300\301\302\303#\300\301\304\305#\300\207" [function-put pfuture-result compiler-macro pfuture-result--inliner side-effect-free t] 5) #@29 (fn INLINE--FORM PROCESS) (defalias 'pfuture-result--inliner #[514 "\3002.\211\301!\203\211\202\302\303!\304\305\306DE=\203$\211\266\203\202-\307DC\"\266\2030\207" [inline--just-use macroexp-copyable-p make-symbol "process" process-get quote stdout macroexp-let*] 8 (#$ . 8620)]) #@61 Return the error output of a pfuture PROCESS. (fn PROCESS) (defalias 'pfuture-stderr #[257 "\300\301\"\207" [process-get stderr] 4 (#$ . 8922)]) (byte-code "\300\301\302\303#\300\301\304\305#\300\207" [function-put pfuture-stderr compiler-macro pfuture-stderr--inliner side-effect-free t] 5) #@29 (fn INLINE--FORM PROCESS) (defalias 'pfuture-stderr--inliner #[514 "\3002.\211\301!\203\211\202\302\303!\304\305\306DE=\203$\211\266\203\202-\307DC\"\266\2030\207" [inline--just-use macroexp-copyable-p make-symbol "process" process-get quote stderr macroexp-let*] 8 (#$ . 9222)]) #@243 Keep reading the output of PROCESS until it is done. Same as `pfuture-await', but will keep reading (and blocking) so long as the process is *alive*. If the process never quits this method will block forever. Use with caution! (fn PROCESS) (defalias 'pfuture-await-to-finish #[257 "\302\303\"\210\303\304!\204)\305!\306\307\"\211\203 \310\311!\210)\306\312\"\207" [inhibit-quit inhibit-redisplay set-process-sentinel nil accept-process-output process-plist plist-get stderr-process t delete-process stdout] 6 (#$ . 9525)]) #@61 Append PROCESS' MSG to its output buffer. (fn PROCESS MSG) (defalias 'pfuture--append-output-to-buffer #[514 "r\300\301\"q\210db\210\211c)\207" [process-get buffer] 5 (#$ . 10067)]) #@75 Append PROCESS' MSG to the already saved stdout output. (fn PROCESS MSG) (defalias 'pfuture--append-stdout #[514 "\300!\301\302\"\303\302\304!\305U\203\202P#\207" [process-plist plist-get stdout plist-put string-bytes 0] 9 (#$ . 10257)]) #@75 Append PROCESS' MSG to the already saved stderr output. (fn PROCESS MSG) (defalias 'pfuture--append-stderr #[514 "\300!\301\302\"\303\302\304!\305U\203\202P#\207" [process-plist plist-get stderr plist-put string-bytes 0] 9 (#$ . 10514)]) #@61 Return the process output collected in BUFFER. (fn BUFFER) (defalias 'pfuture-output-from-buffer #[257 "r\211q\210\300 )\207" [buffer-string] 2 (#$ . 10771)]) (byte-code "\300\301\302\303#\300\301\304\305#\300\207" [function-put pfuture-output-from-buffer compiler-macro pfuture-output-from-buffer--inliner side-effect-free t] 5) #@28 (fn INLINE--FORM BUFFER) (defalias 'pfuture-output-from-buffer--inliner #[514 "\3002-\211\301!\203\211\202\302\303!\304\305CE=\203#\211\266\203\202,\306DC\"\266\2030\207" [inline--just-use macroexp-copyable-p make-symbol "buffer" with-current-buffer buffer-string macroexp-let*] 8 (#$ . 11108)]) (provide 'pfuture)