Next: , Previous: , Up: Top   [Contents]


2 Using With-Editor as a library

This section describes how to use the with-editor library outside of Magit to teach another package how to have its child processes call home, just like Magit does. You don’t need to know any of this just to create commits using Magit. You can also ignore this if you use with-editor outside of Magit, but only as an end-user.

For information about interactive use and options that affect both interactive and non-interactive use, see Using the With-Editor package.

Macro: with-editor &rest body

This macro arranges for the emacsclient or the sleeping editor to be used as the editor of child processes, effectively teaching them to call home to the current Emacs instance when they require that the user edits a file.

This is done by establishing a local binding for process-environment and changing the value of the EDITOR environment variable in that scope. This affects all (asynchronous) processes started by forms (dynamically) inside BODY.

If BODY begins with a literal string, then that variable is set instead of EDITOR.

Macro: with-editor envvar &rest body

This macro is like with-editor instead that the ENVVAR argument is required and that it is evaluated at run-time.

Function: with-editor-set-process-filter process filter

This function is like set-process-filter but ensures that adding the new FILTER does not remove the with-editor-process-filter. This is done by wrapping the two filter functions using a lambda, which becomes the actual filter. It calls with-editor-process-filter first, passing t as NO-STANDARD-FILTER. Then it calls FILTER.


Next: , Previous: , Up: Top   [Contents]