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 which 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 essentially done by establishing a local binding for process-environment and changing the value of the $EDITOR environment variable. This affects all processes started by forms inside BODY.

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.