GNU bug report logs - #25656
25.1; remember-notes-mode makes every temporary buffer created from it unkillable

Previous Next

Package: emacs;

Reported by: Vasilij Schneidermann <v.schneidermann <at> gmail.com>

Date: Wed, 8 Feb 2017 23:13:01 UTC

Severity: normal

Found in version 25.1

Done: Vasilij Schneidermann <v.schneidermann <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25656 in the body.
You can then email your comments to 25656 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25656; Package emacs. (Wed, 08 Feb 2017 23:13:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vasilij Schneidermann <v.schneidermann <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 08 Feb 2017 23:13:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vasilij Schneidermann <v.schneidermann <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1; remember-notes-mode makes every temporary buffer created from
 it unkillable
Date: Thu, 9 Feb 2017 00:12:32 +0100
I wrote an Emacs package that takes an Org file, processes it with Org's
element API and exports to a file.  Later I've noticed that if I use it
on an Org buffer created with remember-notes-mode, it creates ~500
temporary buffers that cannot be killed.  Bisection reveals that this is
the fault of `remember-notes--kill-buffer-query` which is added locally
to `kill-buffer-query-functions` and returns nil if
`remember-notes-bury-on-kill` hasn't been customized.

This raises an interesting question, should a temporary buffer as
created by `with-temp-buffer` let-bind potentially troublesome hooks
including, but not limited to `kill-buffer-query-functions`?  Another
example coming to mind is `buffer-list-update-hook`, adding a function
to it that scans the buffer list makes creating and killing temporary
buffers an expensive action.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25656; Package emacs. (Fri, 24 Feb 2017 07:41:02 GMT) Full text and rfc822 format available.

Message #8 received at 25656 <at> debbugs.gnu.org (full text, mbox):

From: Vasilij Schneidermann <v.schneidermann <at> gmail.com>
Cc: 25656 <at> debbugs.gnu.org
Subject: Re: [PATCH] 25.1; remember-notes-mode makes every temporary buffer
 created from it unkillable
Date: Fri, 24 Feb 2017 08:40:34 +0100
[Message part 1 (text/plain, inline)]
I wrote a simple patch for merely checking whether the buffer about to
be killed happens to be the remember-notes buffer.
[0001-Make-only-remember-notes-buffer-unkillable.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25656; Package emacs. (Sat, 25 Feb 2017 01:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 25656 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Vasilij Schneidermann <v.schneidermann <at> gmail.com>
Cc: 25656 <at> debbugs.gnu.org
Subject: Re: bug#25656: [PATCH] 25.1;
 remember-notes-mode makes every temporary buffer created from it
 unkillable
Date: Fri, 24 Feb 2017 20:16:02 -0500
Vasilij Schneidermann <v.schneidermann <at> gmail.com> writes:

> I wrote a simple patch for merely checking whether the buffer about to
> be killed happens to be the remember-notes buffer.

I think that's a sensible change, but doesn't the fact that
remember-mode adds the hook buffer-locally mean that temp buffers (or
any other buffers) aren't affected?

    (add-hook 'kill-buffer-query-functions 'XXXX nil t)
    (with-temp-buffer
      kill-buffer-query-functions) ;=> (process-kill-buffer-query-function)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25656; Package emacs. (Sat, 25 Feb 2017 09:48:02 GMT) Full text and rfc822 format available.

Message #14 received at 25656 <at> debbugs.gnu.org (full text, mbox):

From: Vasilij Schneidermann <v.schneidermann <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Cc: 25656 <at> debbugs.gnu.org
Subject: Re: bug#25656: [PATCH] 25.1; remember-notes-mode makes every
 temporary buffer created from it unkillable
Date: Sat, 25 Feb 2017 10:47:11 +0100
> I think that's a sensible change, but doesn't the fact that
> remember-mode adds the hook buffer-locally mean that temp buffers (or
> any other buffers) aren't affected?

Hm, you're right, I can't repro this with a minimal example.  However
I'm sure that it has to do something with Org copying buffers and
failing to kill them, so I'll investigate a bit harder to see what it
could be, outside of its gratuitious use of `with-temp-buffer`.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25656; Package emacs. (Sat, 25 Feb 2017 12:13:01 GMT) Full text and rfc822 format available.

Message #17 received at 25656 <at> debbugs.gnu.org (full text, mbox):

From: Vasilij Schneidermann <v.schneidermann <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Cc: 25656 <at> debbugs.gnu.org
Subject: Re: bug#25656: [PATCH] 25.1; remember-notes-mode makes every
 temporary buffer created from it unkillable
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!




Reply sent to Vasilij Schneidermann <v.schneidermann <at> gmail.com>:
You have taken responsibility. (Sat, 25 Feb 2017 12:16:02 GMT) Full text and rfc822 format available.

Notification sent to Vasilij Schneidermann <v.schneidermann <at> gmail.com>:
bug acknowledged by developer. (Sat, 25 Feb 2017 12:16:03 GMT) Full text and rfc822 format available.

Message #22 received at 25656-done <at> debbugs.gnu.org (full text, mbox):

From: Vasilij Schneidermann <v.schneidermann <at> gmail.com>
To: 25656-done <at> debbugs.gnu.org
Subject: Re: bug#25656: [PATCH] 25.1; remember-notes-mode makes every
 temporary buffer created from it unkillable
Date: Sat, 25 Feb 2017 13:15:45 +0100
Bug reason found in Org, resubmitting issue on their bug tracker.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 26 Mar 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 92 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.