[OS X Emacs] "with-current-buffer" issues

David Reitter david.reitter at gmail.com
Thu Jun 24 08:36:56 EDT 2010


On Jun 24, 2010, at 2:28 AM, James Harkins wrote:
> 
> The problem is when a buffer gets killed. There's a hook to close the document:
> 
> (defun sclang-document-kill-buffer-hook-function ()
>   (sclang-close-document (current-buffer)))

> 
> But, for instance, if I open a class library file, I can see on the interpreter side that it gets ID 3. But when I kill that buffer, supercollider closes the document for ID 2. So now I have a Document object in the interpreter for a buffer that is gone, and another buffer that is still open in Emacs has no Document object in the interpreter.
> 
> It sounds like with-current-buffer is operating on the wrong buffer.

Have you had a look at other kill-buffer-hook functions?

It could be that delete-window-if-one-buffer-one-frame or have some unintended side-effect of killing the buffer and/or selecting another one prematurely.
If you can identify the problem, then I could look into why that is happening.

I think your code is fine.

- David

--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://aquamacs.org/donate -- Could we help you? Return the favor and support the Aquamacs Project!


More information about the MacOSX-Emacs mailing list