unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15895: describe-package inserts invalid buffer when readme buffer killed in after-save-hook
@ 2013-11-14 14:36 Kazuhiro NISHIYAMA
  2013-11-16 22:49 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Kazuhiro NISHIYAMA @ 2013-11-14 14:36 UTC (permalink / raw)
  To: 15895

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 think that buffer-string should be before save-buffer.





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#15895: describe-package inserts invalid buffer when readme buffer killed in after-save-hook
  2013-11-14 14:36 bug#15895: describe-package inserts invalid buffer when readme buffer killed in after-save-hook Kazuhiro NISHIYAMA
@ 2013-11-16 22:49 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2013-11-16 22:49 UTC (permalink / raw)
  To: Kazuhiro NISHIYAMA; +Cc: 15895

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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-16 22:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 14:36 bug#15895: describe-package inserts invalid buffer when readme buffer killed in after-save-hook Kazuhiro NISHIYAMA
2013-11-16 22:49 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).