GNU bug report logs - #13197
24.3.50; org-odt.el code that kills modified buffers

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Sat, 15 Dec 2012 22:38:02 UTC

Severity: normal

Found in version 24.3.50

Done: Bastien <bzg <at> altern.org>

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 13197 in the body.
You can then email your comments to 13197 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#13197; Package emacs. (Sat, 15 Dec 2012 22:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 15 Dec 2012 22:38:02 GMT) Full text and rfc822 format available.

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

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.3.50; org-odt.el code that kills modified buffers
Date: Sat, 15 Dec 2012 14:35:45 -0800
This is a question, but it might also be a bug report regarding the code
cited.
 
IIUC, `set-buffer-modified-p' (and also `restore-buffer-modified-p',
which is a lousy name BTW) always acts on the current buffer.  There is
no way to tell it which buffer to act on, other than, say, using
`with-current-buffer'.
 
I use `find-file-noselect' over a large set of files, and at a later
point I kill many such visited-file buffers.  But even just
`find-file-no-select' can cause visiting to modify some buffers.  So
when I go to kill them I need to prevent the user being queried about
killing a modified buffer.
 
I was grepping some source files to see how other code handles this kind
of thing, and I came across this in org-odt.el (in
`org-odt-cleanup-xml-buffers'):
 
(mapc (lambda (file)
        (let ((buf (find-file-noselect
                     (expand-file-name file org-odt-zip-dir) t)))
          (when (buffer-name buf)
            (set-buffer-modified-p nil)
            (kill-buffer buf))))
      xml-files)
 
I don't see how that can work properly, since `find-file-noselect' does
not make the visited-file buffer current, and `set-buffer-modified-p'
acts only on the current buffer.
 
Am I missing something here, or is that a bug?
 
In any case, I would like to learn more about this.  Currently I am
doing this (since this code is for Emacs 23+, which has
`restore-buffer-modified-p'):
 
(with-current-buffer buf
  (restore-buffer-modified-p nil)
  (kill-buffer buf))
 
Is there a way to accomplish that without making BUF current?
 
 
In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600)
 of 2012-12-13 on ODIEONE
Bzr revision: 111211 eggert <at> cs.ucla.edu-20121213021749-eyqqen0ewhn2hogq
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -IC:/Devel/emacs/build/include -Wall -Wextra -Wno-sign-compare
 -Wno-type-limits -Wno-missing-field-initializers -Wno-pointer-sign
 -Wdeclaration-after-statement --ldflags -LC:/Devel/emacs/build/lib'
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13197; Package emacs. (Sun, 16 Dec 2012 04:36:01 GMT) Full text and rfc822 format available.

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

From: Jambunathan K <kjambunathan <at> gmail.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 13197 <at> debbugs.gnu.org
Subject: Re: bug#13197: 24.3.50; org-odt.el code that kills modified buffers
Date: Sun, 16 Dec 2012 10:07:29 +0530
"Drew Adams" <drew.adams <at> oracle.com> writes:

> I was grepping some source files to see how other code handles this kind
> of thing, and I came across this in org-odt.el (in
> `org-odt-cleanup-xml-buffers'):
>  
> (mapc (lambda (file)
>         (let ((buf (find-file-noselect
>                      (expand-file-name file org-odt-zip-dir) t)))
>           (when (buffer-name buf)
>             (set-buffer-modified-p nil)
>             (kill-buffer buf))))
>       xml-files)
>  
> I don't see how that can work properly, since `find-file-noselect' does
> not make the visited-file buffer current, and `set-buffer-modified-p'
> acts only on the current buffer.
>  
> Am I missing something here, or is that a bug?

It looks like a slip on my part.  In all other places in org-odt.el, I
do

    (with-current-buffer (find-file-noselect )

      )

When an error is thrown during the export process, the buffer will be in
modified but unsaved state.  I forcibly mark the buffer as modified
before killing it.

Let me put in a fix in Org repo.  Next merge will take care of this
issue.
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13197; Package emacs. (Sun, 16 Dec 2012 23:17:02 GMT) Full text and rfc822 format available.

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

From: Bastien <bzg <at> altern.org>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 13197 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#13197: 24.3.50; org-odt.el code that kills modified buffers
Date: Mon, 17 Dec 2012 00:15:27 +0100
Hi Jambunathan,

Jambunathan K <kjambunathan <at> gmail.com> writes:

> Let me put in a fix in Org repo.

thanks for taking care of this in Org's repo.

Let me know if you're with sending a patch to the mailing list or 
if you plan to contribute back and want push access.

Best,

-- 
 Bastien




Reply sent to Bastien <bzg <at> altern.org>:
You have taken responsibility. (Thu, 20 Dec 2012 15:08:03 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Thu, 20 Dec 2012 15:08:03 GMT) Full text and rfc822 format available.

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

From: Bastien <bzg <at> altern.org>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 13197-done <at> debbugs.gnu.org
Subject: Re: bug#13197: 24.3.50; org-odt.el code that kills modified buffers
Date: Thu, 20 Dec 2012 16:07:16 +0100
Hi Drew and Jambunathan,

Bastien <bzg <at> altern.org> writes:

> thanks for taking care of this in Org's repo.

I've taken care of it in Org's maint branch, it will be
part of the next merge with the emacs-24 branch.

Thanks,

-- 
 Bastien




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 18 Jan 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 157 days ago.

Previous Next


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