;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\207" [require files cl-lib] 2) #@54 Last keybind used by `with-simulated-input', if any. (defvar wsi-last-used-next-action-bind nil (#$ . 153)) #@244 Return non-nil if KEY is bound in any keymap. This function checks every keymap in `obarray' for a binding for KEY, and returns t if it finds and and nil otherwise. Note that this checks ALL keymaps, not just currently active ones. (fn KEY) (defalias 'wsi-key-bound-p #[257 "\3002\301\302\303\"!\210\304\300\305\"0\207" [bound mapatoms make-closure #[257 "\301!\205\211J\302!\205\303\304\300!\"\211\205\305\306\307\"\262\207" [V0 boundp keymapp lookup-key kbd throw bound t] 6 "\n\n(fn SYM)"] throw nil] 5 (#$ . 268)]) #@1124 Return a key binding that is not bound in any known keymap. This function will check every letter from a to z and every number from 0 through 9 with several combinations of multiple modifiers (i.e. control, meta, alt, super, hyper). For each such key combination, it will check for bindings in all known keymaps, and return the first combination for which no such bindings exist. Thus, it should be safe to bind this key in a new keymap without interfering with any existing keymap. Optional arguments MODIFIERS and KEYS can be used the change the search space. MODIFIERS is a list of strings representing modifier combinations, e.g.: '("C-" "M-" "C-M-") for control, meta, or both. KEYS is a string containing all keys to check. When this function returns, it also sets `wsi-last-used-next-action-bind' to the return value. The next time it is called, it checks this variable to see if it is still usable, and returns it if so, even if it isn't a valid choice given the value of MODIFIERS and KEYS. (fn &optional (MODIFIERS \='("C-M-A-s-H-" "C-M-A-s-" "C-M-A-H-")) (KEYS "abcdefghijklmnopqrstuvwxyz0123456789")) (defalias 'wsi-get-unbound-key #[128 "\211\203 \211A\262\242\202\301\203\211A\262\242\202\302\203+\303\304\305\306G\\D\"\210;\2034C\262\211<\203?\307\310\"\262\203K\311!\204K\207\3122\235\313:\203\226@\262\314\313\211\211T\211\262\203\215GW\203\215H\262\315!P\262\311!\204\207\316\312\211\"\210\313\262\202_\266A\262\202Q\317\320!\266\3130\207" [wsi-last-used-next-action-bind ("C-M-A-s-H-" "C-M-A-s-" "C-M-A-H-") "abcdefghijklmnopqrstuvwxyz0123456789" signal wrong-number-of-arguments wsi-get-unbound-key 2 apply concat wsi-key-bound-p --cl-block-findkey-- nil -1 string throw error "Could not find an unbound key with the specified modifiers"] 14 (#$ . 810)]) (set-advertised-calling-convention 'wsi-get-unbound-key '(&optional modifiers keys) nil) #@390 Return non-nil if EXPR looks like a constant expression. This function may return nil for some constant expressions, but if it returns non-nil, then EXPR is definitely constant. "Constant" means that EXPR will always evaluate to the same value and will never have side effects. In general, this means that EXPR consists only of calls to pure functions with constant arguments. (fn EXPR) (defalias 'wsi--looks-constant-p #[257 "\300!\203\301\207\2119\203\302\207\211:\204\301\207\303!\203\301\207\211:\205d\211\242\211\304\267\202a\243\211:\205A\211\242\243\211?\205?\302\301\262\266\202\262\202b\243\211:\205\\\211\242\243\211?\205Z\302\301\262\266\202\262\202b\302\262\207" [hack-one-local-variable-constantp t nil functionp #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (quote 43 function 70))] 7 (#$ . 2749)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put wsi--looks-constant-p speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@444 Return non-nil if EXPR looks like a pure expression. In this context, "pure" means that the expression has no side effects and its value depends only on its arguments. In general, this means that EXPR consists only of calls to pure functions, constants, and variables. In particular, any constant expression is pure. This function may return nil for some pure expressions, but if it returns non-nil, then EXPR is definitely pure. (fn EXPR) (defalias 'wsi--looks-pure-p #[257 "\2119\203\300\207\301!\205\300\207" [t #[257 "\300!\203\301\207\2119\203\302\207\211:\204\301\207\303!\203\301\207\211:\205d\211\242\211\304\267\202a\243\211:\205A\211\242\243\211?\205?\302\301\262\266\202\262\202b\243\211:\205\\\211\242\243\211?\205Z\302\301\262\266\202\262\202b\302\262\207" [hack-one-local-variable-constantp t nil functionp #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (quote 43 function 70))] 7 "Return non-nil if EXPR looks like a constant expression.\n\nThis function may return nil for some constant expressions, but if\nit returns non-nil, then EXPR is definitely constant.\n\"Constant\" means that EXPR will always evaluate to the same\nvalue and will never have side effects. In general, this means\nthat EXPR consists only of calls to pure functions with constant\narguments.\n\n(fn EXPR)"]] 3 (#$ . 3784)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put wsi--looks-pure-p speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@210 Return non-nil if EXPR definitely does not read input. This function may return nil for some expressions that don't read input, but if it returns non-nil, then EXPR definitely does not read input. (fn EXPR) (defalias 'wsi--looks-input-free-p #[257 "\211\2119\203\300\207\301!\205\300\207" [t #[257 "\300!\203\301\207\2119\203\302\207\211:\204\301\207\303!\203\301\207\211:\205d\211\242\211\304\267\202a\243\211:\205A\211\242\243\211?\205?\302\301\262\266\202\262\202b\243\211:\205\\\211\242\243\211?\205Z\302\301\262\266\202\262\202b\302\262\207" [hack-one-local-variable-constantp t nil functionp #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (quote 43 function 70))] 7 "Return non-nil if EXPR looks like a constant expression.\n\nThis function may return nil for some constant expressions, but if\nit returns non-nil, then EXPR is definitely constant.\n\"Constant\" means that EXPR will always evaluate to the same\nvalue and will never have side effects. In general, this means\nthat EXPR consists only of calls to pure functions with constant\narguments.\n\n(fn EXPR)"]] 4 (#$ . 5322)]) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put wsi--looks-input-free-p speed -1 put byte-optimizer byte-compile-inline-expand] 5) #@362 Filter out irrelevant elements from KEYS. Helper function for `with-simulated-input'. The only relevant elements of KEYS are strings, characters, nil, and expressions that will have side effects (e.g. `(insert "hello")'). Other elements are filtered out, and an appropriate warning is generated for each one unless QUIET is non-nil. (fn KEYS &optional QUIET) (defalias 'wsi--remove-irrelevant-keys #[513 "\300\211:\203\200@\262;\203B\262\202y\301!\203'B\262\202y\203y\2119\2037\302\262\202@\303!\205>\302\262\203t\204y\304\305\306\307\310!\203V\311\202k\303!\203a\312\202k9\203j\313\202k\314\"P\"\210\202yB\262A\262\202\211\237\207" [nil characterp t #[257 "\300!\203\301\207\2119\203\302\207\211:\204\301\207\303!\203\301\207\211:\205d\211\242\211\304\267\202a\243\211:\205A\211\242\243\211?\205?\302\301\262\266\202\262\202b\243\211:\205\\\211\242\243\211?\205Z\302\301\262\266\202\262\202b\302\262\207" [hack-one-local-variable-constantp t nil functionp #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (quote 43 function 70))] 7 "Return non-nil if EXPR looks like a constant expression.\n\nThis function may return nil for some constant expressions, but if\nit returns non-nil, then EXPR is definitely constant.\n\"Constant\" means that EXPR will always evaluate to the same\nvalue and will never have side effects. In general, this means\nthat EXPR consists only of calls to pure functions with constant\narguments.\n\n(fn EXPR)"] display-warning with-simulated-input-1 "Non-string forms in KEYS are evaluated for side effects only. " format functionp "Functions in KEYS have no effect unless they are called: %S" "Non-string constants in KEYS have no effect: %S" "Variables in KEYS have no effect: %S" "Pure expressions in KEYS have no effect: %S"] 11 (#$ . 6642)]) #@311 Internal `with-simulated-input' helper. MAIN is a zero-argument function containing the body forms to be evaluated, and KEYS is a list of key sequences (as strings) or other actions to simulate user interaction (as zero-argument functions, which are called only for their side effects). (fn MAIN &rest KEYS) (defalias 'with-simulated-input-1 #[385 "\301 \302\303!\302\304!p\305\306$C\307\310\"\244\311C\244C\203%\312!\202'\313 \314\315!\305\316##\2102\2002w\317\315\320\321C\n\322\211:\203i@\262;\203\\\202^\fB\262A\262\202J\211\237\266\203\244 C\244\323#!!0\324@A\"\2620)\207" [overriding-terminal-local-map wsi-get-unbound-key make-symbol "result" "error" make-closure #[0 "\303\302!\210\304\301\300 \"\207" [V0 V1 V2 switch-to-buffer throw] 3] cl-remove-if-not functionp #[0 "\300\301!\207" [error "Aborted evaluation of BODY after reaching end of KEYS without returning"] 2] copy-keymap make-sparse-keymap define-key kbd #[0 "\3021\301\242\301\211\242A\240\210\242 0\207\303\300\"\207" [V0 V1 (error) throw] 4 nil nil] execute-kbd-macro mapconcat identity nil " " signal] 17 (#$ . 8537)]) #@2651 Eval BODY forms with KEYS as simulated input. This macro is intended for automated testing of normally interactive functions by simulating input. If BODY tries to read user input (e.g. via `completing-read'), it will read input events from KEYS instead, as if the user had manually typed those keys after initiating evaluation of BODY. KEYS should be a string representing a sequence of key presses, in the format understood by `kbd'. In the most common case of typing in some text and pressing RET, KEYS would be something like `"hello RET"'. Note that spaces must be indicated explicitly using `SPC', e.g. `"hello SPC world RET"'. KEYS can also be a single character, which is equivalent to a string of length 1. KEYS can also be a list of strings (or characters), which will be used as consecutive inputs. (This list should not be quoted, since `with-simulated-input' is a macro.) Elements of the list can also be function calls, which will be evaluated at that point in the input sequence. This can be used as an alternative to writing out a full key sequence. For example, `"hello SPC world RET"' could also be written as: `((insert "hello world") "RET")' It can also be used to implement more complex logic, such as conditionally inserting a string. Note that the return value of any function call in KEYS is ignored, so the function should actually perform some kind of action, or else it will have no effect. Lastly, KEYS can also be the name of a variable whose value is a string. The variable's value will be used as described above. If BODY tries to read more input events than KEYS provides, an error is signaled. This is to ensure that BODY will never get stuck waiting for input, since this macro is intended for non-interactive use. If BODY does not consume all the input events in KEYS, the remaining input events in KEYS are discarded, and any remaining function calls in KEYS are never evaluated. In particular, if KEYS is nil, then an error will be signaled if BODY attempts to read any input, and if BODY is nil, a constant expression, or an expression that does not read any input, then KEYS will be ignored completely. Any errors generated by any means during the evaluation of BODY or the evaluation of function calls in KEYS are propagated normally. The return value is the last form in BODY, as if it was wrapped in `progn'. (Note: KEYS supports some additional semantics for backward-compatibilty reasons. These semantics are considered deprecated and are left intentionally undocumented. They should not be used in newly written code, since they will stop working in a future release.) (fn KEYS &rest BODY) (defalias 'with-simulated-input '(macro . #[385 "\300\301\"\204\302\303\203\304\202\305\"\210\306!@\207\300\307\"\204)\302\303\310\"\210\311B\207\2047\312\313\314BB\315BB\207\203\2519\203\251\316!\203K\317\320\"\210\321\322D\312\313\314BB\323BBD\324D\312\313\314BBED\325D\312\313\314BB\326\327 DDED\330D\331\332\333\313\314\nBB\334\335\336\337\340D\341BBBBBFE\342\317\343\344\nD\345 D \257D\257\207<\203 @\345=\204 \346@!\204\303\347@!\203 \302\303\350\351\"\"\210\352\353!\354DC\355\356\357\360\361BB\362BBD\363\364\365DDD\366\367EDF\332\370\313\314BB\334\335\336\337\340 D\371BBBBBFF\207:\2035\242\211\345=\2034\243\211:\2033\211\242\243\211\2041\302\303\350\372\n\"\"\210\262\266\210\210<\204X\203I;\204I\325!\203PC\262\202X\317\373\344!#\210\312\313\314BB\340!\314\211:\203\236@\262;\203yB\262\202\227\325!\203\213\326\327!!B\262\202\227\203\227\313\314EB\262A\262\202c\211\237\266\203BB\207" [cl-find-if-not wsi--looks-constant-p display-warning with-simulated-input "BODY consists of only constant expressions; KEYS will be ignored." "BODY is empty; KEYS will be ignored." last wsi--looks-input-free-p "BODY does not read input; KEYS will be ignored." progn with-simulated-input-1 lambda nil (nil) keywordp error "KEYS must be a string, character, or list, not keyword: %s" cond null (nil) stringp characterp key-description string consp (display-warning 'with-simulated-input "Passing a variable with a list value as KEYS is deprecated and will not be supported in future releases.") apply #'with-simulated-input-1 cl-loop for key in wsi--remove-irrelevant-keys (if (stringp key) collect key else if (characterp key) collect (key-description (string key)) else if key collect `(lambda nil ,key)) t "KEYS must be a string, character, or list, not %s: %s = %S" type-of quote functionp macrop format "Passing a function call as KEYS is deprecated and will not be supported in future releases: %S" make-symbol "evaluated-keys" let pcase `',x prog1 setq (x) ((display-warning 'with-simulated-input "Passing a quoted list as KEYS is deprecated and will not be supported in future releases.")) guard not listp cl-callf list #'with-simulated-input-1 (if (stringp key) collect key else if (characterp key) collect (key-description (string key)) else if key collect `(lambda nil ,key)) "Passing a quoted list as KEYS is deprecated and will not be supported in future releases: %S" "KEYS must be a string, character, or list, not %s: KEYS = %S"] 17 (#$ . 9686)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put with-simulated-input lisp-indent-function 1 put edebug-form-spec ([&or ("quote" (&rest &or stringp characterp form)) (&rest &or stringp characterp form) stringp characterp symbolp ([&or functionp macrop] &rest form)] body)] 5) #@354 The current simulated idle time. While simulating idle time using `wsi-simulated-idle-time', this variable will always be set to the amount of idle time that has been simulated so far. For example, if an idle time is set to run every 5 seconds while idle, then on its first run, this will be set to 5 seconds, then 10 seconds the next time, and so on. (defvar wsi-simulated-idle-time nil (#$ . 15211)) #@302 Return the faked value while simulating idle time. While executing `wsi-simulate-idle-time', this advice causes the simulated idle time to be returned instead of the real value. ORIG-FUN is the original function, passed by `advice-add'; ARGS are the arguments given to it. (fn ORIG-FUN &rest ARGS) (defalias 'current-idle-time@simulate-idle-time #[385 "\203\301\302\303!\"\205\207\304\"\207" [wsi-simulated-idle-time time-less-p seconds-to-time 0 apply] 5 (#$ . 15621)]) (advice-add 'current-idle-time :around 'current-idle-time@simulate-idle-time) #@985 Run all idle timers with delay less than SECS. This simulates resetting the idle time to zero and then being idle for SECS seconds. Hence calling this function twice with SECS = 1 is not equivalent to 2 seconds of idle time. If ACTUALLY-WAIT is non-nil, this function will also wait for the specified amount of time before running each timer. If SECS is nil, simulate enough idle time to run each timer in `timer-idle-list' at least once. (It's possible that some timers will be run more than once, since each timer could potentially add new timers to the list.) While each timer is running, `current-idle-time' will be overridden to return the current simulated idle time. The idle time simulation provided by this function is not perfect. For example, this function does not run any timers in `timer-list', even though they would run as normal during real idle time. In addition, weird effects may occur if idle timers add other idle timers. (fn &optional SECS ACTUALLY-WAIT) (defalias 'wsi-simulate-idle-time #[512 "\204/\302\211:\203+@\262\303\304!!\203!]\266\202\202$\211\266\202A\262\202\266\202\262\305\\\262\302C\306!\306\307!\302\211\211\310\311\312\"\"@\262\203\224\313\304!\"\203\224 \262\313 \304!\"\203h\304!\203u\314\303\315 \"!!\210\313 \"\203\224\307H\204\206\316!\210\242B\240\210\302\262\202@\203\242\314\303\315 \"!!\210)\302\207" [timer-idle-list wsi-simulated-idle-time nil float-time timer--time 0.0001 seconds-to-time 0 cl-member-if-not make-closure #[257 "\211\300\242>\207" [V0] 3 "\n\n(fn TIMER)"] time-less-p sleep-for time-subtract timer-event-handler] 12 (#$ . 16189) "nSeconds of idle time: \nP"]) #@44 Unload the `with-simulated-input' library. (defalias 'with-simulated-input-unload-function #[0 "\300\301\302\"\207" [advice-remove current-idle-time current-idle-time@simulate-idle-time] 3 (#$ . 17883)]) (provide 'with-simulated-input)