all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (file-exists-p "") --> t??
@ 2009-04-27 12:08 Alfred M. Szmidt
  2009-04-27 12:12 ` Harald Hanche-Olsen
  0 siblings, 1 reply; 6+ messages in thread
From: Alfred M. Szmidt @ 2009-04-27 12:08 UTC (permalink / raw)
  To: emacs-devel

Is it intended that file-exists-p returns t for the empty string?




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

* Re: (file-exists-p "") --> t??
  2009-04-27 12:08 (file-exists-p "") --> t?? Alfred M. Szmidt
@ 2009-04-27 12:12 ` Harald Hanche-Olsen
  2009-04-27 12:16   ` Alfred M. Szmidt
  0 siblings, 1 reply; 6+ messages in thread
From: Harald Hanche-Olsen @ 2009-04-27 12:12 UTC (permalink / raw)
  To: ams; +Cc: emacs-devel

+ "Alfred M. Szmidt" <ams@gnu.org>:

> Is it intended that file-exists-p returns t for the empty string?

I don't know if it is intended or not, but it does make some sort of
sense: Try (find-file "") to see for yourself what you get.

- Harald




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

* Re: (file-exists-p "") --> t??
  2009-04-27 12:12 ` Harald Hanche-Olsen
@ 2009-04-27 12:16   ` Alfred M. Szmidt
  2009-04-27 12:25     ` Deniz Dogan
  2009-04-27 12:28     ` Harald Hanche-Olsen
  0 siblings, 2 replies; 6+ messages in thread
From: Alfred M. Szmidt @ 2009-04-27 12:16 UTC (permalink / raw)
  To: Harald Hanche-Olsen; +Cc: emacs-devel

   X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
	   version=3.1.0
   Date: Mon, 27 Apr 2009 14:12:42 +0200 (CEST)
   Cc: emacs-devel@gnu.org
   From: Harald Hanche-Olsen <hanche@math.ntnu.no>
   Mime-Version: 1.0
   Content-Type: Text/Plain; charset=us-ascii

   + "Alfred M. Szmidt" <ams@gnu.org>:

   > Is it intended that file-exists-p returns t for the empty string?

   I don't know if it is intended or not, but it does make some sort of
   sense: Try (find-file "") to see for yourself what you get.

I guess that makes sense, I am actually fiine with the behaviour,
other than it is annoying when you use file-exists-p in a loop, and
you start of with a empty string...

(let ((foo ""))
  (while (not (file-exists-p foo))
    (setq foo (generate-foo-some-how))))





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

* Re: (file-exists-p "") --> t??
  2009-04-27 12:16   ` Alfred M. Szmidt
@ 2009-04-27 12:25     ` Deniz Dogan
  2009-04-29 10:00       ` Alfred M. Szmidt
  2009-04-27 12:28     ` Harald Hanche-Olsen
  1 sibling, 1 reply; 6+ messages in thread
From: Deniz Dogan @ 2009-04-27 12:25 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: Harald Hanche-Olsen, emacs-devel

2009/4/27 Alfred M. Szmidt <ams@gnu.org>:
> I guess that makes sense, I am actually fiine with the behaviour,
> other than it is annoying when you use file-exists-p in a loop, and
> you start of with a empty string...
>
> (let ((foo ""))
>  (while (not (file-exists-p foo))
>    (setq foo (generate-foo-some-how))))

Why not use the following?

(let ((foo (generate-foo-some-how)))
 (while (not (file-exists-p foo))
   (setq foo (generate-foo-some-how))))

--
Deniz




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

* Re: (file-exists-p "") --> t??
  2009-04-27 12:16   ` Alfred M. Szmidt
  2009-04-27 12:25     ` Deniz Dogan
@ 2009-04-27 12:28     ` Harald Hanche-Olsen
  1 sibling, 0 replies; 6+ messages in thread
From: Harald Hanche-Olsen @ 2009-04-27 12:28 UTC (permalink / raw)
  To: ams; +Cc: emacs-devel

+ "Alfred M. Szmidt" <ams@gnu.org>:

> I guess that makes sense, I am actually fiine with the behaviour,
> other than it is annoying when you use file-exists-p in a loop, and
> you start of with a empty string...
> 
> (let ((foo ""))
>   (while (not (file-exists-p foo))
>     (setq foo (generate-foo-some-how))))

Ah, I see.

(let (foo)
  (while (not (file-exists-p (setq foo (generate-foo-some-how)))))
  (do-something-with-existing-file foo))

- Harald




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

* Re: (file-exists-p "") --> t??
  2009-04-27 12:25     ` Deniz Dogan
@ 2009-04-29 10:00       ` Alfred M. Szmidt
  0 siblings, 0 replies; 6+ messages in thread
From: Alfred M. Szmidt @ 2009-04-29 10:00 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: hanche, emacs-devel

   > I guess that makes sense, I am actually fiine with the behaviour,
   > other than it is annoying when you use file-exists-p in a loop, and
   > you start of with a empty string...
   >
   > (let ((foo ""))
   >  (while (not (file-exists-p foo))
   >    (setq foo (generate-foo-some-how))))

   Why not use the following?

   (let ((foo (generate-foo-some-how)))
    (while (not (file-exists-p foo))
      (setq foo (generate-foo-some-how))))

You might be passing a counter to the function that generates the file name.








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

end of thread, other threads:[~2009-04-29 10:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-27 12:08 (file-exists-p "") --> t?? Alfred M. Szmidt
2009-04-27 12:12 ` Harald Hanche-Olsen
2009-04-27 12:16   ` Alfred M. Szmidt
2009-04-27 12:25     ` Deniz Dogan
2009-04-29 10:00       ` Alfred M. Szmidt
2009-04-27 12:28     ` Harald Hanche-Olsen

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.