pinard/Pymacs

"pymacs-unload"

Opened this issue · 5 comments

The pymacs-load function defines lots of new symbols and wreaks
havoc because of its dependency on the Pymacs buffer's helper
process. Pymacs should provide a sane way to unload itself and the
symbols it defines via pymacs-load. See also
http://www.gnu.org/software/emacs/manual/html_node/elisp/Unloading.html
and
http://www.gnu.org/software/emacs/manual/html_node/elisp/Named-Features.html.

I made myself a branch and added a little reminder in pymacs.el.in. Hopefully, I'll get around to implementing it. I'd love to know if someone else beats me to it or if there's an existing solution I should use instead.

Someone else asked me, today, if there was some pymacs-unload function! :-)

If I read you correctly, you even suggest a function that would unload all Pymacs loaded modules at once.

One problem that I see, but I do not know if it worth being considered or not, is about postponing the cleanup until all functions become quiescent. To implement such a modification, one would likely have to carefully consider zombies. Functions may exist in numbered slots, and unloading a function without clearing the associated slot is prone to producing later errors. This has been the source of difficulties in some previous Pymacs version, and even if zombies are more bearable nowadays that they once were, Pymacs should nevertheless take care.

In any case, keep us posted on your progress on this matter. Keep happy! François

@pinard,

Sorry, I haven't revisited this since I last commented. My real interest is #32, specifically so that I can use Rope with multiple Python projects in a single Emacs where the interpreters are executing on a VM ("remote" host).

I misspoke. I remember now, my biggest pain point has nothing to do with multiple Python interpreters. Rather, it happens when the remote Python interpreter or its Pymacs process goes away, most often because my VM suspended due to low battery on my laptop. That condition makes Emacs report a Pymacs error anytime I try to save a buffer or quit Emacs, so I have to force quit.

This is my current workaround to unwedge my Emacs when the Pymacs helper has died and can't restart:

(remove-hook 'before-save-hook 'rope-before-save-actions)
(remove-hook 'after-save-hook 'rope-after-save-actions)
(remove-hook 'kill-emacs-hook 'rope-exiting-actions)