GNU bug report logs - #15895
describe-package inserts invalid buffer when readme buffer killed in after-save-hook

Previous Next

Package: emacs;

Reported by: Kazuhiro NISHIYAMA <zn <at> mbf.nifty.com>

Date: Thu, 14 Nov 2013 16:53:02 UTC

Severity: minor

Tags: wontfix

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Glenn Morris <rgm <at> gnu.org>
To: Kazuhiro NISHIYAMA <zn <at> mbf.nifty.com>
Cc: 15895 <at> debbugs.gnu.org
Subject: bug#15895: describe-package inserts invalid buffer when readme buffer killed in after-save-hook
Date: Sat, 16 Nov 2013 17:49:05 -0500
Kazuhiro NISHIYAMA wrote:

> I use delete-file-if-no-contents in after-save-hook, and open
> git-gutter-fringe or git-gutter-fringe+ from *Packages* buffer, the
> hook asks me "Delete file and kill buffer?". When I answer "y", the
> buffer for *-readme.txt killed, and buffer-string after save-buffer in
> describe-package-1 returns from invalid buffer's content.

I'm going to say: "don't do that then". There are ~ 200 calls to
save-buffer in the Emacs sources, and I imagine none of them expect
save-buffer to kill the buffer in question. Maybe some of them should be
using something lower-level like write-region, but I'm not going to
bother to check them.

I suggest you make your delete-file-if-no-contents thing only take
effect in _interactive_ calls to save-buffer.

> I think that buffer-string should be before save-buffer.

Then it would not get the (minor) benefit of require-final-newline.
Obviously, we could reimplement that, but I don't think we should have
to bother.




This bug report was last modified 11 years and 173 days ago.

Previous Next


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