;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\304\305\306\307\310DD\311\312\313\314\315&\210\304\316\306\307\317DD\320\312\321\314\315&\210\304\322\306\307\323DD\324\312\313\314\315&\210\304\325\306\307\326DD\327\312\330\314\315&\207" [require cl-lib comint server custom-declare-variable with-emacs-executable-path funcall function #[0 " P\207" [invocation-directory invocation-name] 2] "Location of Emacs executable." :type string :group with-emacs with-emacs-lexical-binding #[0 "\300\207" [nil] 1] "Whether to use lexical binding when evaluating code." boolean with-emacs-output-regexp #[0 "\300\207" [#1="\\`\n*\\([^z-a]*\\)\n\\(?:\\(.*\\)\\|\\(\"\\(\\(?:[^\"\\]+\\|\\\\[^z-a]\\)*\\)\"\\)\\)\\'"] 1 #1#] "Regexp for extracting message or result from output." with-emacs-server-timeout #[0 "\300\207" [nil] 1] "Number of minutes idle time before kill server process, ‘nil’ means no timeout.\n\nThis can be overwritten by parameter :timeout in ‘with-emacs-server’." number] 8) #@41 Comint buffer/process polling interval. (defvar with-emacs-sit-for-seconds 0.1 (#$ . 1086)) (byte-code "\300\301\302\303!\203\f\303\202 \304\"\207" [defalias with-emacs--flatten fboundp flatten-tree #[257 "\300:\203+\211A\262\242\211:\203\211AB\262\211@\262\202\f\211\203'\211B\262\210\202\2034B\262\211\237\207" [nil] 5 "Return a \"flattened\" copy of TREE.\nIn other words, return a list of the non-nil terminal nodes, or\nleaves, of the tree of cons cells rooted at TREE. Leaves in the\nreturned list are in the same order as in TREE.\n\n(flatten-tree \\='(1 (2 . 3) nil (4 5 (6)) 7))\n=> (1 2 3 4 5 6 7)\n\n(fn TREE)"]] 4) #@93 Advice for FN to Replace CR character in STRING while sending to PROC. (fn FN PROC STRING) (defalias 'with-emacs--replace-CR-character-while-sending #[771 "\300\301\302#\"\207" [replace-regexp-in-string " " "\\\\r"] 9 (#$ . 1742)]) #@54 Remove leading key-value pairs from ARGS. (fn ARGS) (defalias 'with-emacs--cl-args-body #[257 "\211\3002\301@!\203\211AA\262\202\302\300\"\210\202\207" [break keywordp throw] 5 (#$ . 1984)]) #@21 (fn PATH LEXICAL) (defalias 'with-emacs--cli-args #[514 "\300\301\302\303\"\301\302\304\305\"\257\207" ["--batch" "--eval" format "(setq lexical-binding %s)" "%s" (while t (prin1 (eval (read) lexical-binding)))] 10 (#$ . 2193)]) #@32 (fn PROC FORM EOE-INDICATOR) (defalias 'with-emacs--eval-expr-send-input #[771 "ed|\210\304\211\305U\205 \306\211\203\307 \310#\210\311\312\"\216\313\314\"\210+\266\315\316\317\"\"\207" [emacs-major-version print-escape-control-characters print-escape-newlines comint-input-sender t 25 with-emacs--replace-CR-character-while-sending advice-add :around make-closure #[0 "\300\205\302 \300\"\207" [V0 comint-input-sender advice-remove] 3] mapc #[257 "\300\301\"c\210\302 \207" [format "%S" comint-send-input] 4 "\n\n(fn IT)"] process-send-string format "%S\n"] 10 (#$ . 2433)]) #@27 (fn PROC EOE-INDICATOR) (defalias 'with-emacs--eval-expr-accept-output #[514 "\302!\303=\203$b\210\212\304\305!\306\307#)\204$\310\311p!!\210\312 !\210\202\302!\303=\2031\313\314\"\210\302!\315>?\205A\312 !\210\2021\207" [comint-last-input-end with-emacs-sit-for-seconds process-status run re-search-forward regexp-quote nil t accept-process-output get-buffer-process sit-for process-send-string "(kill-emacs)\n" (exit signal)] 6 (#$ . 3035)]) #@13 (fn PROC) (defalias 'with-emacs--eval-expr-error-message #[257 "\301\302!W\205\212b\210\214\303`!b}\210\304ed\"*\207" [comint-last-output-start 0 process-exit-status next-property-change buffer-substring-no-properties] 4 (#$ . 3500)]) #@31 (fn BUF FORM EOE-INDICATOR) (defalias 'with-emacs--eval-expr #[771 "\301!rq\210\302#\210\303\"\210\304!\305\306!\210*\207" [kill-buffer-query-functions get-buffer-process with-emacs--eval-expr-send-input with-emacs--eval-expr-accept-output with-emacs--eval-expr-error-message nil kill-buffer] 8 (#$ . 3748)]) #@45 Extract return value from string S. (fn S) (defalias 'with-emacs--extract-return-value #[257 "\300\301\302\"r\211q\210\303\304\"\216c\210\305 \210db\210\306 *\207" [generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] emacs-lisp-mode sexp-at-point] 5 (#$ . 4075)]) #@21 (fn OUTPUT ERROR) (defalias 'with-emacs--handle-output #[514 "\211\203\n\301\302C\"\207\205\"\303\"\304!AA@\305\306\"\210\307!\266\202\207" [comint-prompt-regexp signal error split-string reverse mapc #[257 "\302\"\205!r\303\304!q\210\305\306\307\"db\210\310c\210\211c\210)\262)\207" [with-emacs-output-regexp inhibit-read-only string-match get-buffer "*Messages*" t match-string 1 "\n"] 5 "\n\n(fn S)"] with-emacs--extract-return-value] 7 (#$ . 4408)]) #@255 Start a emacs in a subprocess, and execute BODY there. If PATH not set, use `with-emacs-executable-path'. If LEXICAL not set, use `with-emacs-lexical-binding.' (fn &rest BODY &key (PATH nil HAS-PATH\=\?) (LEXICAL nil HAS-LEXICAL\=\?) &allow-other-keys) (defalias 'with-emacs '(macro . #[128 "\302\303\"\211\205\211A@\304\262\302\305\"\211\205\211A@\304\262\306\203%\202&\203.\202/ \"\307\310\311\312\313\314DD\315pD\316BBBBB\317\320\321\322\314\fD\323BBBDC\324BBE\207" [with-emacs-executable-path with-emacs-lexical-binding plist-member :path t :lexical with-emacs--cli-args let* (process-connection-type nil) (eoe-indicator "with-emacs-eoe") (comint-prompt-regexp "Lisp expression: ") cmdlist quote pbuf ((output nil) (comint-output-filter-functions (lambda (text) (setq output (concat output text)))) (buf (apply 'make-comint-in-buffer "with-emacs" (generate-new-buffer-name "*with-emacs*") (car cmdlist) nil (cdr cmdlist)))) let error with-emacs--eval-expr buf (eoe-indicator) ((with-emacs--handle-output output error))] 14 (#$ . 4887)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put with-emacs lisp-indent-function defun put edebug-form-spec t] 5) #@634 Contact the Emacs server named SERVER and evaluate FORM there. Returns the result of the evaluation, or signals an error if it cannot contact the specified server. If ENSURE not nil, start a server when necessary. It can be t or a path of emacs, if it is t, use `with-emacs-executable-path' as default. The server will be killed after TIMEOUT minutes, if TIMEOUT not given, use `with-emacs-server-timeout' as default, if TIMEOUT is nil, disable timeout timer. (with-emacs-server "foo" :ensure t :timeout 100 (1+ 1)) => 2 (fn SERVER &rest BODY &key (ENSURE nil HAS-ENSURE\=\?) (TIMEOUT nil HAS-TIMEOUT\=\?) &allow-other-keys) (defalias 'with-emacs-server '(macro . #[385 "\301\302\"\211\205\211A@\303\262\301\304\"\211\205\211A@\303\262\305\306\307\310 \311BBDD\312\313\314\315\316\317\320\321 D D\322BBFD\323\324EFE\325 \326\327\330\331\332\333\f\203X \202YDC\334BB\335!BB\336BBBDEF\207" [with-emacs-server-timeout plist-member :ensure t :timeout let* (server-dir (if server-use-tcp server-auth-dir server-socket-dir)) server-file expand-file-name (server-dir) unless (file-exists-p server-file) if shell-command format "%s -Q --daemon=%s" cond stringp ((t with-emacs-executable-path)) error "No such server: %s" server-eval-at quote condition-case err progn let time ((when time (run-with-idle-timer time 0 (lambda nil (kill-emacs))))) with-emacs--cl-args-body ((error err))] 18 (#$ . 6088)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put with-emacs-server lisp-indent-function 1 put edebug-form-spec t] 5) #@37 List of partially applied functions (defvar with-emacs-partially-applied-functions nil (#$ . 7656)) #@489 Generate functions that are partial application of `with-emacs' to ARGS. The form of ARGS is: (part-name1 path1 lexical-or-not) (part-name2 path2 lexical-or-not) ... For example: ``` (with-emacs-define-partially-applied (t nil t) (24.3 "/path/to/emacs-24.3") (24.4-t "/path/to/emacs-24.4" t)) ;; => ;; (with-emacs-t &rest BODY &key PATH) ;; (with-emacs-24.3 &rest BODY &key LEXICAL) ;; (with-emacs-24.4-t &rest BODY) ``` (fn &rest ARGS) (defalias 'with-emacs-define-partially-applied '(macro . #[128 "\211\211\205\203\211@\211\242\243\211\242\243\211\242\243\301\302\303\"!\304\305?\205$\306?\205*\307D\"\211\203;\310\311B\211\262\312\"\262\313\314\315\316BB\317\320\321\322\304\305\323\324\325\326DDE\324\325\327DDEEEDDC\330BB\257!\210\235\203v\266\f\202|B\266 A\266\202\202\207" [with-emacs-partially-applied-functions intern format "with-emacs-%s" remove nil (path nil has-path\?) (lexical nil has-lexical\?) append &key (&allow-other-keys) eval cl-defmacro &rest body (declare (indent defun) (debug t)) let params with-emacs--flatten list when quote :path :lexical (`(with-emacs ,@params ,@body))] 31 (#$ . 7763)])) (provide 'with-emacs)