syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.56k stars 4.9k forks source link

* layers/+lang/python/packages.el: Fix importmagic leak #16381

Closed sunlin7 closed 1 month ago

sunlin7 commented 2 months ago

Hi,

There is a serious resource leak when enable python layer with importmage package enabled. The reproduce steps are:

  1. enable python layer, and the imortmagic should also be instralled for its python layer dependency.
  2. open a python source code,
  3. start python interpreter
  4. execute python-shell-send-buffer or other send function.
  5. execute list-processes to show the process You will see every time execute the step 4, the epc:server in process list will increaced. The reason is the emacs-29 had enhanced implementation for with-temp-buffer which won't call the kill-buffer-hook while the importmagic-mode will create epc:server on mode hook and stop the epc:server on kill-buffer-hook but it won't be called for temp buffer. This change will fix the issue with avoiding starting the epc:server for temp buffer.

Please help review and merge the patch. Thanks

smile13241324 commented 1 month ago

Thanks for fixing this :)

sunlin7 commented 1 month ago

@smile13241324 Thank goodness you're back!

smile13241324 commented 1 month ago

No worries ;), I just need some breaks from time to time you know surgeries and stuff.