Subject: bug#25656: [PATCH] 25.1; remember-notes-mode makes every temporary buffer created from it unkillable

From: Vasilij Schneidermann <[email-masked]>
Date: Sat, 25 Feb 2017 13:12:49 +0100

OK, I think I've figured out what's going on.  I'm calling a command in
a remember-notes buffer that happens to hold an org file.  It's set up
to be unkillable by having a locally added `kill-buffer-query-functions`
hook that returns nil.  Now, my command calls a number of things
including `org-table-export` which does a zillion of things, eventually
cloning the buffer it's working on with the
`org-export-with-buffer-copy` macro.  This macro is so good at cloning
buffers it preserves its buffer-local variables, including
`kill-buffer-query-functions`.  Although it tries killing the buffer
afterwards, it fails doing so because the hook forbids it.

The result of this avalanche of failures is that for every table cell,
an unkillable buffer is created.  The lesson from this is to be careful
with using Org's APIs, while some of them look reusable, most aren't.
While I could patch `remember-notes--kill-buffer-query` to work around
this problem, I'll just customize `remember-notes-bury-on-kill` and
raise an issue with Org's bug tracker.  Thanks for responding to this,
Noam!