* Buffer *temp* modified; kill anyway?
@ 2009-03-04 17:26 Bill White
2009-03-04 18:38 ` Nick Dokos
0 siblings, 1 reply; 6+ messages in thread
From: Bill White @ 2009-03-04 17:26 UTC (permalink / raw)
To: emacs-orgmode
Hi all -
"Buffer *temp* modified; kill anyway?" is driving me nuts.
Has anyone seen this error message when html-exporting pages that
contain #+begin_src ? I get this once for every #+begin_src
... #+end_src group on a page. I assume it's coming from htmlize.el,
but I haven't been able to isolate the problem with edebug. I'm using
the latest htmlize.el from
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el
Any ideas what's going on and how to silence it? If it weren't for this
I'd be able to publish without babysitting the process through
source-heavy files.
Cheers -
bw
--
Bill White . billw@wolfram.com . http://members.wolfram.com/billw
"No ma'am, we're musicians."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Buffer *temp* modified; kill anyway?
2009-03-04 17:26 Buffer *temp* modified; kill anyway? Bill White
@ 2009-03-04 18:38 ` Nick Dokos
2009-03-04 19:57 ` Bill White
0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2009-03-04 18:38 UTC (permalink / raw)
To: Bill White; +Cc: emacs-orgmode
Bill White <billw@wolfram.com> wrote:
> Hi all -
>
> "Buffer *temp* modified; kill anyway?" is driving me nuts.
>
> Has anyone seen this error message when html-exporting pages that
> contain #+begin_src ? I get this once for every #+begin_src
> ... #+end_src group on a page. I assume it's coming from htmlize.el,
> but I haven't been able to isolate the problem with edebug. I'm using
> the latest htmlize.el from
> http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el
>
> Any ideas what's going on and how to silence it? If it weren't for this
> I'd be able to publish without babysitting the process through
> source-heavy files.
>
Bill,
I just tried exporting the following:
,----
| * Lisp source code
|
| #+begin_src emacs-lisp
| (defun org-xor (a b)
| "Exclusive or."
| (if a (not b) b))
| #+end_src
`----
and did not have the problem you describe. Can you post a minimal example?
Version info:
Org-mode version 6.23trans
GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.12.9) of 2008-07-01 on alphaville.zko.hp.com
htmlize-version 1.34
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Buffer *temp* modified; kill anyway?
2009-03-04 18:38 ` Nick Dokos
@ 2009-03-04 19:57 ` Bill White
2009-03-04 21:47 ` Nick Dokos
0 siblings, 1 reply; 6+ messages in thread
From: Bill White @ 2009-03-04 19:57 UTC (permalink / raw)
To: nicholas.dokos; +Cc: emacs-orgmode
On Wed Mar 04 2009 at 12:38, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Bill White <billw@wolfram.com> wrote:
>
>> Hi all -
>>
>> "Buffer *temp* modified; kill anyway?" is driving me nuts.
>>
>> Has anyone seen this error message when html-exporting pages that
>> contain #+begin_src ? I get this once for every #+begin_src
>> ... #+end_src group on a page. I assume it's coming from htmlize.el,
>> but I haven't been able to isolate the problem with edebug. I'm using
>> the latest htmlize.el from
>> http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el
>>
>> Any ideas what's going on and how to silence it? If it weren't for this
>> I'd be able to publish without babysitting the process through
>> source-heavy files.
>>
>
> Bill,
>
> I just tried exporting the following:
>
> ,----
> | * Lisp source code
> |
> | #+begin_src emacs-lisp
> | (defun org-xor (a b)
> | "Exclusive or."
> | (if a (not b) b))
> | #+end_src
> `----
>
> and did not have the problem you describe. Can you post a minimal example?
Here's one that triggers it:
,----
| * Lisp source code
|
| #+begin_src message
| From: Nick Dokos <nicholas.dokos@hp.com>
| Subject: Re: [Orgmode] Buffer *temp* modified; kill anyway?
| To: Bill White <billw@wolfram.com>
| Cc: emacs-orgmode@gnu.org
| Date: Wed, 04 Mar 2009 13:38:32 -0500 (from Gnus)
| Reply-To: nicholas.dokos@hp.com
| X-Sent: 1 hour, 9 minutes, 51 seconds ago
| Message-ID: <9344.1236191912@alphaville.usa.hp.com>
| #+end_src
`----
Interestingly, the message is not triggered when I use your example with
its "#+begin_src emacs-lisp", nor does "#+begin_src mma" trigger
it (using Tim Wichmann's mma.el).
My versions are:
- Org-mode version 6.23trans
- GNU Emacs 23.0.90.1 (i686-pc-linux-gnu, GTK+ Version 2.12.9) of 2009-02-14 on billw-desktop
- htmlize-version 1.34
- message.el version 1.169 (from the emacs cvs checkout above)
Thanks for the example - I didn't realize that some src modes didn't
trigger the problem.
Cheers -
bw
--
Bill White . billw@wolfram.com . http://members.wolfram.com/billw
"No ma'am, we're musicians."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Buffer *temp* modified; kill anyway?
2009-03-04 19:57 ` Bill White
@ 2009-03-04 21:47 ` Nick Dokos
2009-03-04 22:26 ` Nick Dokos
0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2009-03-04 21:47 UTC (permalink / raw)
To: Bill White; +Cc: emacs-orgmode
Bill White <billw@wolfram.com> wrote:
> On Wed Mar 04 2009 at 12:38, Nick Dokos <nicholas.dokos@hp.com> wrote:
>
> > Bill White <billw@wolfram.com> wrote:
> >
> >> Hi all -
> >>
> >> "Buffer *temp* modified; kill anyway?" is driving me nuts.
> >>
> >> Has anyone seen this error message when html-exporting pages that
> >> contain #+begin_src ? I get this once for every #+begin_src
> >> ... #+end_src group on a page. I assume it's coming from htmlize.el,
> >> but I haven't been able to isolate the problem with edebug. I'm using
> >> the latest htmlize.el from
> >> http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el
> >>
> >> Any ideas what's going on and how to silence it? If it weren't for this
> >> I'd be able to publish without babysitting the process through
> >> source-heavy files.
> >>
> >
> > Bill,
> >
> > I just tried exporting the following:
> >
> > ,----
> > | * Lisp source code
> > |
> > | #+begin_src emacs-lisp
> > | (defun org-xor (a b)
> > | "Exclusive or."
> > | (if a (not b) b))
> > | #+end_src
> > `----
> >
> > and did not have the problem you describe. Can you post a minimal example?
>
> Here's one that triggers it:
>
> ,----
> | * Lisp source code
> |
> | #+begin_src message
> | From: Nick Dokos <nicholas.dokos@hp.com>
> | Subject: Re: [Orgmode] Buffer *temp* modified; kill anyway?
> | To: Bill White <billw@wolfram.com>
> | Cc: emacs-orgmode@gnu.org
> | Date: Wed, 04 Mar 2009 13:38:32 -0500 (from Gnus)
> | Reply-To: nicholas.dokos@hp.com
> | X-Sent: 1 hour, 9 minutes, 51 seconds ago
> | Message-ID: <9344.1236191912@alphaville.usa.hp.com>
> | #+end_src
> `----
>
> Interestingly, the message is not triggered when I use your example with
> its "#+begin_src emacs-lisp", nor does "#+begin_src mma" trigger
> it (using Tim Wichmann's mma.el).
>
> My versions are:
> - Org-mode version 6.23trans
> - GNU Emacs 23.0.90.1 (i686-pc-linux-gnu, GTK+ Version 2.12.9) of 2009-02-14 on billw-desktop
> - htmlize-version 1.34
> - message.el version 1.169 (from the emacs cvs checkout above)
>
> Thanks for the example - I didn't realize that some src modes didn't
> trigger the problem.
>
The problem seems to arise in the following code from
org-exp.el:org-export-format-source-code-or-example:
...
(setq rtn
(with-temp-buffer
(insert rtn)
(if (functionp mode)
(funcall mode)
(fundamental-mode))
(font-lock-fontify-buffer)
(org-export-htmlize-region-for-paste
(point-min) (point-max))))
...
The with-temp-buffer macro looks like this (it's in subr.el):
(defmacro with-temp-buffer (&rest body)
"Create a temporary buffer, and evaluate BODY there like `progn'.
See also `with-temp-file' and `with-output-to-string'."
(declare (indent 0) (debug t))
(let ((temp-buffer (make-symbol "temp-buffer")))
`(let ((,temp-buffer (generate-new-buffer " *temp*")))
;; FIXME: kill-buffer can change current-buffer in some odd cases.
(with-current-buffer ,temp-buffer
(unwind-protect
(progn ,@body)
(and (buffer-name ,temp-buffer)
(kill-buffer ,temp-buffer)))))))
The *temp* buffer that is created ends up with the body of the
begin_src/end_src construct as its contents, but in the emacs-lisp
instance, the call to kill-buffer in the macro succeeds without the
"Buffer modified" question being asked, whereas in the message case, it
asks the question. In both cases, however the temp buffer seems modified
to me.[1]
So I don't understand the difference in behavior between the two cases,
but maybe this provides enough detail for a better elisper than me to
understand and explain to the rest of us.
Nick
[1] I added a call to debug in the original code, like this:
(setq rtn
(with-temp-buffer
(let ((foo))
(insert rtn)
(if (functionp mode)
(funcall mode)
(fundamental-mode))
(font-lock-fontify-buffer)
(setq foo (org-export-htmlize-region-for-paste
(point-min) (point-max)))
(debug nil (buffer-name))
foo)))
and checked the *temp* buffer when I got to the breakpoint, but in both
cases it looks modified to my eye (I also evaluated (buffer-modified-p)
in each case: it returned t).
And I also checked kill-buffer-query-functions and kill-buffer-hook in the
two cases: they are the same. In particular, in my emacs, kill-buffer-query-functions
has the value
(server-kill-buffer-query-function)
and kill-buffer-hook has the value
(reftex-kill-buffer-hook tramp-flush-file-function
preview-kill-buffer-cleanup browse-url-delete-temp-file vc-kill-buffer-hook)
Mark me mystified.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Buffer *temp* modified; kill anyway?
2009-03-04 21:47 ` Nick Dokos
@ 2009-03-04 22:26 ` Nick Dokos
2009-03-05 4:55 ` Bill White
0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2009-03-04 22:26 UTC (permalink / raw)
To: nicholas.dokos; +Cc: emacs-orgmode
Nick Dokos <nicholas.dokos@hp.com> wrote:
> Bill White <billw@wolfram.com> wrote:
>
> > On Wed Mar 04 2009 at 12:38, Nick Dokos <nicholas.dokos@hp.com> wrote:
> >
> > > Bill White <billw@wolfram.com> wrote:
> > >
> > >> Hi all -
> > >>
> > >> "Buffer *temp* modified; kill anyway?" is driving me nuts.
> > >>
> > >> Has anyone seen this error message when html-exporting pages that
> > >> contain #+begin_src ? I get this once for every #+begin_src
> > >> ... #+end_src group on a page. I assume it's coming from htmlize.el,
> > >> but I haven't been able to isolate the problem with edebug. I'm using
> > >> the latest htmlize.el from
> > >> http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el
> > >>
> > >> Any ideas what's going on and how to silence it? If it weren't for this
> > >> I'd be able to publish without babysitting the process through
> > >> source-heavy files.
> > >>
> > >
> > > Bill,
> > >
>
> ....
>
> So I don't understand the difference in behavior between the two cases,
> but maybe this provides enough detail for a better elisper than me to
> understand and explain to the rest of us.
>
OK - I think I know why: the mode of the temp buffer is set according
to the language in the begin_src construct: emacs-lisp-mode in one case,
message-mode (and a bunch of minor modes) in the other. The difference is
that the latter associates the buffer with a file, whereas the former does
not. It's that difference that makes kill-buffer behave differently.
I suspect that the thing to do is to mark the buffer unmodified. Here's a patch:
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index a0d1e5f..c20112f 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2472,6 +2472,7 @@ Numbering lines works for all three major backends (html, latex, and ascii)."
(funcall mode)
(fundamental-mode))
(font-lock-fontify-buffer)
+ (set-buffer-modified-p nil)
(org-export-htmlize-region-for-paste
(point-min) (point-max))))
(if (string-match "<pre\\([^>]*\\)>\n?" rtn)
Nick
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Buffer *temp* modified; kill anyway?
2009-03-04 22:26 ` Nick Dokos
@ 2009-03-05 4:55 ` Bill White
0 siblings, 0 replies; 6+ messages in thread
From: Bill White @ 2009-03-05 4:55 UTC (permalink / raw)
To: nicholas.dokos; +Cc: emacs-orgmode
On Wed Mar 04 2009 at 16:26, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Nick Dokos <nicholas.dokos@hp.com> wrote:
>
>> Bill White <billw@wolfram.com> wrote:
>>
>> > On Wed Mar 04 2009 at 12:38, Nick Dokos <nicholas.dokos@hp.com> wrote:
>> >
>> > > Bill White <billw@wolfram.com> wrote:
>> > >
>> > >> Hi all -
>> > >>
>> > >> "Buffer *temp* modified; kill anyway?" is driving me nuts.
>> > >>
>> > >> Has anyone seen this error message when html-exporting pages that
>> > >> contain #+begin_src ? I get this once for every #+begin_src
>> > >> ... #+end_src group on a page. I assume it's coming from htmlize.el,
>> > >> but I haven't been able to isolate the problem with edebug. I'm using
>> > >> the latest htmlize.el from
>> > >> http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el
>> > >>
>> > >> Any ideas what's going on and how to silence it? If it weren't for this
>> > >> I'd be able to publish without babysitting the process through
>> > >> source-heavy files.
>> > >>
>> > >
>> > > Bill,
>> > >
>>
>> ....
>>
>> So I don't understand the difference in behavior between the two cases,
>> but maybe this provides enough detail for a better elisper than me to
>> understand and explain to the rest of us.
>>
>
> OK - I think I know why: the mode of the temp buffer is set according
> to the language in the begin_src construct: emacs-lisp-mode in one
> case, message-mode (and a bunch of minor modes) in the other. The
> difference is that the latter associates the buffer with a file,
> whereas the former does not. It's that difference that makes
> kill-buffer behave differently.
>
> I suspect that the thing to do is to mark the buffer
> unmodified. Here's a patch:
That did it - what a relief! Your elisp skills are pretty sharp. I was
looking in entirely the wrong place to solve this.
Many thanks!
bw
--
Bill White . billw@wolfram.com . http://members.wolfram.com/billw
"No ma'am, we're musicians."
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-03-05 4:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-04 17:26 Buffer *temp* modified; kill anyway? Bill White
2009-03-04 18:38 ` Nick Dokos
2009-03-04 19:57 ` Bill White
2009-03-04 21:47 ` Nick Dokos
2009-03-04 22:26 ` Nick Dokos
2009-03-05 4:55 ` Bill White
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.