* Problem using with-temp-file
@ 2007-02-07 15:52 rgb
2007-02-07 16:52 ` Robert Thorpe
0 siblings, 1 reply; 10+ messages in thread
From: rgb @ 2007-02-07 15:52 UTC (permalink / raw)
To: help-gnu-emacs
When I use with-temp-file I end up with an empty file although the
trace doesn't show me any good reason for the file being empty.
Does anyone see why I get an empty file?
I inserted the call to debug and looked at the temp buffer to be sure
the correct data really was in the buffer. The arguments to write-
region seem to confirm that it's working against the correct
buffer....
Thanks
Debugger entered--entering a function:
* write-region(1 2943 "~/Data-2007-02-07-07:17.txt" nil 0)
* (save-current-buffer (set-buffer temp-buffer) (widen) (write-region
(point-min) (point-max) temp-file nil 0))
* (with-current-buffer temp-buffer (widen) (write-region (point-min)
(point-max) temp-file nil 0))
(prog1 (with-current-buffer temp-buffer (insert ...) (debug)) (with-
current-buffer temp-buffer (widen) (write-region ... ... temp-file nil
0)))
(unwind-protect (prog1 (with-current-buffer temp-buffer ... ...)
(with-current-buffer temp-buffer ... ...)) (and (buffer-name temp-
buffer) (kill-buffer temp-buffer)))
(let ((temp-file my-data-file) (temp-buffer ...)) (unwind-protect
(prog1 ... ...) (and ... ...)))
(with-temp-file my-data-file (insert (get-my-data)) (debug))
eval((with-temp-file my-data-file (insert (get-my-data)) (debug)))
eval-expression((with-temp-file my-data-file (insert (get-my-data))
(debug)) nil)
call-interactively(eval-expression)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problem using with-temp-file
2007-02-07 15:52 Problem using with-temp-file rgb
@ 2007-02-07 16:52 ` Robert Thorpe
2007-02-07 18:05 ` rgb
0 siblings, 1 reply; 10+ messages in thread
From: Robert Thorpe @ 2007-02-07 16:52 UTC (permalink / raw)
To: help-gnu-emacs
On Feb 7, 3:52 pm, "rgb" <rbiel...@i1.net> wrote:
> When I use with-temp-file I end up with an empty file although the
> trace doesn't show me any good reason for the file being empty.
>
> Does anyone see why I get an empty file?
> I inserted the call to debug and looked at the temp buffer to be sure
> the correct data really was in the buffer. The arguments to write-
> region seem to confirm that it's working against the correct
> buffer....
Could you post your code too? It would help.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problem using with-temp-file
2007-02-07 16:52 ` Robert Thorpe
@ 2007-02-07 18:05 ` rgb
2007-02-07 18:29 ` rgb
0 siblings, 1 reply; 10+ messages in thread
From: rgb @ 2007-02-07 18:05 UTC (permalink / raw)
To: help-gnu-emacs
On Feb 7, 10:52 am, "Robert Thorpe" <rtho...@realworldtech.com> wrote:
> On Feb 7, 3:52 pm, "rgb" <rbiel...@i1.net> wrote:
>
> > When I use with-temp-file I end up with an empty file although the
> > trace doesn't show me any good reason for the file being empty.
>
> > Does anyone see why I get an empty file?
> > I inserted the call to debug and looked at the temp buffer to be sure
> > the correct data really was in the buffer. The arguments to write-
> > region seem to confirm that it's working against the correct
> > buffer....
>
> Could you post your code too? It would help.
By "your code" you must mean the contents of get-my-data?
It's big and messy but I tried to whittle it down.
At that point I found that when I brought it all the way down to
(defun get-my-data () "hello")
I still ended up with an empty file.
At which point I tried this with the same results
(with-temp-file my-data-file (insert "This really sucks"))
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problem using with-temp-file
2007-02-07 18:05 ` rgb
@ 2007-02-07 18:29 ` rgb
2007-02-08 10:30 ` Robert Thorpe
0 siblings, 1 reply; 10+ messages in thread
From: rgb @ 2007-02-07 18:29 UTC (permalink / raw)
To: help-gnu-emacs
On Feb 7, 12:05 pm, "rgb" <rbiel...@i1.net> wrote:
> On Feb 7, 10:52 am, "Robert Thorpe" <rtho...@realworldtech.com> wrote:
>
> > On Feb 7, 3:52 pm, "rgb" <rbiel...@i1.net> wrote:
>
> > > When I use with-temp-file I end up with an empty file although the
> > > trace doesn't show me any good reason for the file being empty.
>
> > > Does anyone see why I get an empty file?
> > > I inserted the call to debug and looked at the temp buffer to be sure
> > > the correct data really was in the buffer. The arguments to write-
> > > region seem to confirm that it's working against the correct
> > > buffer....
>
> > Could you post your code too? It would help.
>
> By "your code" you must mean the contents of get-my-data?
> It's big and messy but I tried to whittle it down.
> At that point I found that when I brought it all the way down to
> (defun get-my-data () "hello")
> I still ended up with an empty file.
> At which point I tried this with the same results
> (with-temp-file my-data-file (insert "This really sucks"))
After noticing that this
(with-temp-file "Test.txt" (insert "More testing"))
worked fine.
I realized wherein the problem lies
Debugger entered--entering a function:
* write-region(1 2943 "~/Data-2007-02-07-07:17.txt" nil 0)
The empty file's name is "Data-2007-02-07-07" not
"Data-2007-02-07-07:17.txt"
write-region must be mishandling an error of some kind.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problem using with-temp-file
2007-02-07 18:29 ` rgb
@ 2007-02-08 10:30 ` Robert Thorpe
2007-02-08 14:09 ` rgb
2007-02-09 4:38 ` Stefan Monnier
0 siblings, 2 replies; 10+ messages in thread
From: Robert Thorpe @ 2007-02-08 10:30 UTC (permalink / raw)
To: help-gnu-emacs
On Feb 7, 6:29 pm, "rgb" <rbiel...@i1.net> wrote:
> On Feb 7, 12:05 pm, "rgb" <rbiel...@i1.net> wrote:
>
>
>
> > On Feb 7, 10:52 am, "Robert Thorpe" <rtho...@realworldtech.com> wrote:
>
> > > On Feb 7, 3:52 pm, "rgb" <rbiel...@i1.net> wrote:
>
> > > > When I use with-temp-file I end up with an empty file although the
> > > > trace doesn't show me any good reason for the file being empty.
>
> > > > Does anyone see why I get an empty file?
> > > > I inserted the call to debug and looked at the temp buffer to be sure
> > > > the correct data really was in the buffer. The arguments to write-
> > > > region seem to confirm that it's working against the correct
> > > > buffer....
>
> > > Could you post your code too? It would help.
>
> > By "your code" you must mean the contents of get-my-data?
> > It's big and messy but I tried to whittle it down.
> > At that point I found that when I brought it all the way down to
> > (defun get-my-data () "hello")
> > I still ended up with an empty file.
> > At which point I tried this with the same results
> > (with-temp-file my-data-file (insert "This really sucks"))
>
> After noticing that this
> (with-temp-file "Test.txt" (insert "More testing"))
> worked fine.
> I realized wherein the problem lies
>
> Debugger entered--entering a function:
> * write-region(1 2943 "~/Data-2007-02-07-07:17.txt" nil 0)
>
> The empty file's name is "Data-2007-02-07-07" not
> "Data-2007-02-07-07:17.txt"
> write-region must be mishandling an error of some kind.
Looks like your Emacs is mistaking the ":" in the filename for the end
of the filename.
On MS Windows with GNU Emacs 21.3 this doesn't happen to me, the above
works fine.
This could be a bug in filename handling in Emacs, or in the C library
of the platform it is using.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problem using with-temp-file
2007-02-08 10:30 ` Robert Thorpe
@ 2007-02-08 14:09 ` rgb
2007-02-08 16:02 ` Robert Thorpe
2007-02-09 4:38 ` Stefan Monnier
1 sibling, 1 reply; 10+ messages in thread
From: rgb @ 2007-02-08 14:09 UTC (permalink / raw)
To: help-gnu-emacs
> > After noticing that this
> > (with-temp-file "Test.txt" (insert "More testing"))
> > worked fine.
> > I realized wherein the problem lies
>
> > Debugger entered--entering a function:
> > * write-region(1 2943 "~/Data-2007-02-07-07:17.txt" nil 0)
>
> > The empty file's name is "Data-2007-02-07-07" not
> > "Data-2007-02-07-07:17.txt"
> > write-region must be mishandling an error of some kind.
>
> Looks like your Emacs is mistaking the ":" in the filename for the end
> of the filename.
> On MS Windows with GNU Emacs 21.3 this doesn't happen to me, the above
> works fine.
I've been using 22.0.x for years and really don't know what I'd do
without it. So many things I take for granted wern't available in
21.3
>
> This could be a bug in filename handling in Emacs, or in the C library
> of the platform it is using.- Hide quoted text -
>
> - Show quoted text -
It's beyond me to tell if the name should have been checked by lisp
code (it wasn't) or the problem is within the C code of write-region
so a general bug report was made.
I can't help but be curious what 'works fine' means since : is
supposedly
illegal in MS filenames. Do you get a file with : in the name à
la .emacs
or is the : missing but the contents still good or do you get an
error...
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problem using with-temp-file
2007-02-08 14:09 ` rgb
@ 2007-02-08 16:02 ` Robert Thorpe
2007-02-10 9:38 ` Kevin Rodgers
0 siblings, 1 reply; 10+ messages in thread
From: Robert Thorpe @ 2007-02-08 16:02 UTC (permalink / raw)
To: help-gnu-emacs
On Feb 8, 2:09 pm, "rgb" <rbiel...@i1.net> wrote:
> > Looks like your Emacs is mistaking the ":" in the filename for the end
> > of the filename.
> > On MS Windows with GNU Emacs 21.3 this doesn't happen to me, the above
> > works fine.
>
> I've been using 22.0.x for years and really don't know what I'd do
> without it. So many things I take for granted wern't available in
> 21.3
I made a policy long ago of never using CVS software that wasn't
released. I'm considering making an exception for Emacs.
> illegal in MS filenames. Do you get a file with : in the name à
> la .emacs
> or is the : missing but the contents still good or do you get an
> error...
Checking again I see that it doesn't work, it's just that Emacs 21
does not raise an exception to report the error!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problem using with-temp-file
2007-02-08 10:30 ` Robert Thorpe
2007-02-08 14:09 ` rgb
@ 2007-02-09 4:38 ` Stefan Monnier
2007-02-09 9:02 ` Juanma Barranquero
1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2007-02-09 4:38 UTC (permalink / raw)
To: help-gnu-emacs
> Looks like your Emacs is mistaking the ":" in the filename for the end of
> the filename. On MS Windows with GNU Emacs 21.3 this doesn't happen to
> me, the above works fine.
IIRC this is a feature of your OS where the ":" is used for some special
file-handling thingy, maybe something like forks or some such.
It may depend on the specific version of w32 you're using, and/or on the
filesystem itself.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problem using with-temp-file
2007-02-09 4:38 ` Stefan Monnier
@ 2007-02-09 9:02 ` Juanma Barranquero
0 siblings, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2007-02-09 9:02 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
On 2/9/07, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> IIRC this is a feature of your OS where the ":" is used for some special
> file-handling thingy, maybe something like forks or some such.
Yes, rgb is creating a NTFS "stream". In fact, "notepad
Data-2007-02-07-07:17.txt" will allow him to edit the stream (though,
strangely enough, CMD's type won't show it, I think).
/L/e/k/t/u
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Problem using with-temp-file
2007-02-08 16:02 ` Robert Thorpe
@ 2007-02-10 9:38 ` Kevin Rodgers
0 siblings, 0 replies; 10+ messages in thread
From: Kevin Rodgers @ 2007-02-10 9:38 UTC (permalink / raw)
To: help-gnu-emacs
Robert Thorpe wrote:
> On Feb 8, 2:09 pm, "rgb" <rbiel...@i1.net> wrote:
>> I've been using 22.0.x for years and really don't know what I'd do
>> without it. So many things I take for granted wern't available in
>> 21.3
UTF coding systems!
> I made a policy long ago of never using CVS software that wasn't
> released. I'm considering making an exception for Emacs.
Me, too. You should feel pretty confident using the pretest versions
(e.g. 22.0.90 through 22.0.93) available at
ftp://alpha.gnu.org/gnu/emacs/pretest/
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-02-10 9:38 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-07 15:52 Problem using with-temp-file rgb
2007-02-07 16:52 ` Robert Thorpe
2007-02-07 18:05 ` rgb
2007-02-07 18:29 ` rgb
2007-02-08 10:30 ` Robert Thorpe
2007-02-08 14:09 ` rgb
2007-02-08 16:02 ` Robert Thorpe
2007-02-10 9:38 ` Kevin Rodgers
2007-02-09 4:38 ` Stefan Monnier
2007-02-09 9:02 ` Juanma Barranquero
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).