How to catch all elisp function calls that require user interaction? -
I want to type a function that is emacs (in particular, kill-buffer-query -functions
), but if any of them requires the user's interaction, then instead I want to return just zero
so that the whole thing can run non-interactive. I am trying to use defadvice
to modify each function, which is usually the exception to the value of throw
with the value of zero
Instead indicates Then I'll wrap everything with a catch
form only the problem is that I do not have a detailed list of all emacs elisp functions which can prompt the user for something
yes-or-no-p
and y-or-np
will definitely be in this list, such as read-string
and full-read
. Actually, I want to fill in the code in this code:
(defun eval-but-return -f-required-user (form and optional interactive -Return) "evaluate the form, but stop immediately and return interactive-returns if user interaction will be required in any part of the form." ;; is required ((ui-requiring-functions' (...)); What is included in this list? (Ui-required-callback ;; function which argues in any number And throws an exception '(Lambda (& amp; left); (throw' UI-required interactive-return)) (callback for the above) to make a list of redefinitions for flat-redefinition; Use (fax, flet-redefinitions; function redefinitions, display, form))));) (Use mpeaker (lambda (fancy) (inconsistency (cd ui-required-call-back)))); Then evaluate the form
Actually, I wrap everything in a catch block, then I define a function body which simply takes a logic and can throw a proper exception . I have set up a list of definitions to pass flet
, which will temporarily define those functions to use the preceding exception-throwing body. After all, I evaluate the code in that code with the errors of form
due to some quoted errors in those codes.
Now, I think that if I had this appropriate task list that works to redefine it.
Note that if any user interaction is required, then I want to return the full form, not the special function call within the function that requires user interaction. To see why I need it, consider that the form might want to ask the following questions:
- Do you want to delete this very important file? Yes or no
- Do you want to keep this very important file? Yes or No
Obviously, if I just modified yes-or-no-p
to always return zero
(Meaning "no"), that still is not guaranteed to save my important file by deleting it, so, since I do not know what questions can be asked, I just want to cancel the whole form and if If he wants to ask something about the user then he should return it
Basically, I want to say "to evaluate this code, but if you have to ask me something to do, forget about it and return zero
. "
Then just run I think that you "commandp" Can only be used to tell that a particular function is interactive. If 'commandp kill-buffer-query-functions') (remove-I / P)
Comments
Post a Comment