unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
@ 2011-07-21  9:29 Bastien
  2011-07-21 10:17 ` Eli Zaretskii
  2011-09-11  2:52 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 9+ messages in thread
From: Bastien @ 2011-07-21  9:29 UTC (permalink / raw)
  To: 9139

Emacs sends an inappropriate warning message when trying to 
find a file that isn't on the hardrive but is the filename of 
a buffer, thus somehow "existing" in Emacs.

To reproduce the problem:

emacs -Q
C-x f ~/foo.txt
C-x b bar
C-x f ~/foo.txt

  => File no longer exists!

I suggest simply removing this warning is such a case.


In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.5)
 of 2011-07-10 on myhost
Windowing system distributor `The X.Org Foundation', version 11.0.11002000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Text

-- 
 Bastien





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

* bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
  2011-07-21  9:29 bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!" Bastien
@ 2011-07-21 10:17 ` Eli Zaretskii
  2011-07-21 10:27   ` Bastien
  2011-09-11  2:52 ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2011-07-21 10:17 UTC (permalink / raw)
  To: Bastien; +Cc: 9139

> From: Bastien <bzg@altern.org>
> Date: Thu, 21 Jul 2011 11:29:39 +0200
> 
> Emacs sends an inappropriate warning message when trying to 
> find a file that isn't on the hardrive but is the filename of 
> a buffer, thus somehow "existing" in Emacs.
> 
> To reproduce the problem:
> 
> emacs -Q
> C-x f ~/foo.txt
> C-x b bar
> C-x f ~/foo.txt
> 
>   => File no longer exists!

Why is that inappropriate?  Emacs checks whether the file is newer
than it was when it was last visited or saved, to make sure you don't
accidentally overwrite the file with stale data.  If the file no
longer exists, this test cannot be performed, so Emacs alerts you to
that fact.





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

* bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
  2011-07-21 10:17 ` Eli Zaretskii
@ 2011-07-21 10:27   ` Bastien
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2011-07-21 10:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9139

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Bastien <bzg@altern.org>
>> Date: Thu, 21 Jul 2011 11:29:39 +0200
>> 
>> Emacs sends an inappropriate warning message when trying to 
>> find a file that isn't on the hardrive but is the filename of 
>> a buffer, thus somehow "existing" in Emacs.
>> 
>> To reproduce the problem:
>> 
>> emacs -Q
>> C-x f ~/foo.txt
>> C-x b bar
>> C-x f ~/foo.txt
>> 
>>   => File no longer exists!
>
> Why is that inappropriate?
>
> Emacs checks whether the file is newer
> than it was when it was last visited or saved, to make sure you don't
> accidentally overwrite the file with stale data.  If the file no
> longer exists, this test cannot be performed, so Emacs alerts you to
> that fact.

I understand the need for a warning, but emacs asserts that the file 
*no longer* exists while this file never existed before.

I suggest changing the message like this:

  "File %s doesn't exist"

-- 
 Bastien





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

* bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
  2011-07-21  9:29 bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!" Bastien
  2011-07-21 10:17 ` Eli Zaretskii
@ 2011-09-11  2:52 ` Lars Magne Ingebrigtsen
  2011-09-11  6:00   ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-11  2:52 UTC (permalink / raw)
  To: Bastien; +Cc: 9139

Bastien <bzg@altern.org> writes:

> Emacs sends an inappropriate warning message when trying to 
> find a file that isn't on the hardrive but is the filename of 
> a buffer, thus somehow "existing" in Emacs.
>
> To reproduce the problem:
>
> emacs -Q
> C-x f ~/foo.txt
> C-x b bar
> C-x f ~/foo.txt
>
>   => File no longer exists!

Yes, it shouldn't say anything in this instance.

But how?  It's this code in files.el:

		  (cond ((not (file-exists-p filename))
			 (setq nonexistent t)
			 (message "File %s no longer exists!" filename))

Is there something stored in the buffer that's stored if the file once
has existed, but no longer exists?  Let's see...

(visited-file-modtime)
=> (-1 65535)

in foo.txt.  But is that a bug?

The doc string says:

Return the current buffer's recorded visited file modification time.
The value is a list of the form (HIGH LOW), like the time values
that `file-attributes' returns.  If the current buffer has no recorded
file modification time, this function returns 0.

So I think that perhaps is should return 0?
                         
-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
  2011-09-11  2:52 ` Lars Magne Ingebrigtsen
@ 2011-09-11  6:00   ` Eli Zaretskii
  2011-09-11 14:49     ` Lars Magne Ingebrigtsen
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Eli Zaretskii @ 2011-09-11  6:00 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 9139-done, bzg

> From: Lars Magne Ingebrigtsen <larsi@gnus.org>
> Date: Sun, 11 Sep 2011 04:52:29 +0200
> Cc: 9139@debbugs.gnu.org
> 
> > emacs -Q
> > C-x f ~/foo.txt
> > C-x b bar
> > C-x f ~/foo.txt
> >
> >   => File no longer exists!
> 
> Yes, it shouldn't say anything in this instance.
> 
> But how?  It's this code in files.el:
> 
> 		  (cond ((not (file-exists-p filename))
> 			 (setq nonexistent t)
> 			 (message "File %s no longer exists!" filename))

The magic is in the previous line.  The code does this:

	      (or nowarn
		  (verify-visited-file-modtime buf)
		  (cond ((not (file-exists-p filename))
			 (setq nonexistent t)
			 (message "File %s no longer exists!" filename))

The problem was that verify-visited-file-modtime would return nil in
this case, where it returned t in Emacs 23.  And that's because the
internal details of verify-visited-file-modtime changed, but
insert-file-contents didn't have the corresponding change.  It does
now (revno 105721).

> (visited-file-modtime)
> => (-1 65535)
> 
> in foo.txt.  But is that a bug?

No.  -1 as the modtime exactly means that the file does not exist.  So
at most we need to update the doc string, assuming that we want to
reveal such implementation details.

Btw, WIBNI visited-file-modtime returned (-1 -1) in this case, instead
of forcing us to invoke the unsigned-to-signed converter in our heads?

> So I think that perhaps is should return 0?

Zero is for existing files that were not modified since visited.





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

* bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
  2011-09-11  6:00   ` Eli Zaretskii
@ 2011-09-11 14:49     ` Lars Magne Ingebrigtsen
  2011-09-11 18:57     ` Glenn Morris
  2011-09-11 23:32     ` bug#7547: Glenn Morris
  2 siblings, 0 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-11 14:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9139, bzg

Eli Zaretskii <eliz@gnu.org> writes:

>> (visited-file-modtime)
>> => (-1 65535)
>> 
>> in foo.txt.  But is that a bug?
>
> No.  -1 as the modtime exactly means that the file does not exist.  So
> at most we need to update the doc string, assuming that we want to
> reveal such implementation details.

I've now updated the doc string.  It seems like a non-optimal return
value for this situation (nil might make more sense), though, but
changing that might break stuff, I guess.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
  2011-09-11  6:00   ` Eli Zaretskii
  2011-09-11 14:49     ` Lars Magne Ingebrigtsen
@ 2011-09-11 18:57     ` Glenn Morris
  2011-09-11 20:05       ` Eli Zaretskii
  2011-09-11 23:32     ` bug#7547: Glenn Morris
  2 siblings, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2011-09-11 18:57 UTC (permalink / raw)
  To: 9139

Eli Zaretskii wrote:

> The problem was that verify-visited-file-modtime would return nil in
> this case, where it returned t in Emacs 23.  And that's because the
> internal details of verify-visited-file-modtime changed, but
> insert-file-contents didn't have the corresponding change.  It does
> now (revno 105721).

Sounds like you've fixed bug#7547? (Thanks.)





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

* bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!"
  2011-09-11 18:57     ` Glenn Morris
@ 2011-09-11 20:05       ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2011-09-11 20:05 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 9139

> From: Glenn Morris <rgm@gnu.org>
> Cc: eliz@gnu.org
> Date: Sun, 11 Sep 2011 14:57:59 -0400
> 
> Eli Zaretskii wrote:
> 
> > The problem was that verify-visited-file-modtime would return nil in
> > this case, where it returned t in Emacs 23.  And that's because the
> > internal details of verify-visited-file-modtime changed, but
> > insert-file-contents didn't have the corresponding change.  It does
> > now (revno 105721).
> 
> Sounds like you've fixed bug#7547? (Thanks.)

I guess so.  You're welcome.





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

* bug#7547:
  2011-09-11  6:00   ` Eli Zaretskii
  2011-09-11 14:49     ` Lars Magne Ingebrigtsen
  2011-09-11 18:57     ` Glenn Morris
@ 2011-09-11 23:32     ` Glenn Morris
  2 siblings, 0 replies; 9+ messages in thread
From: Glenn Morris @ 2011-09-11 23:32 UTC (permalink / raw)
  To: 7547-done


Fixed in bug #9139:

Eli Zaretskii wrote:

> The problem was that verify-visited-file-modtime would return nil in
> this case, where it returned t in Emacs 23.  And that's because the
> internal details of verify-visited-file-modtime changed, but
> insert-file-contents didn't have the corresponding change.  It does
> now (revno 105721).





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

end of thread, other threads:[~2011-09-11 23:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-21  9:29 bug#9139: 24.0.50; Inappropriate warning: "File no longer exists!" Bastien
2011-07-21 10:17 ` Eli Zaretskii
2011-07-21 10:27   ` Bastien
2011-09-11  2:52 ` Lars Magne Ingebrigtsen
2011-09-11  6:00   ` Eli Zaretskii
2011-09-11 14:49     ` Lars Magne Ingebrigtsen
2011-09-11 18:57     ` Glenn Morris
2011-09-11 20:05       ` Eli Zaretskii
2011-09-11 23:32     ` bug#7547: 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).