about the manual of visited-file-modtime

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

about the manual of visited-file-modtime

zhang cc
The manual says:

     If the buffer has no recorded last modification time, this function
     returns zero.

and also says this at the end:

     If the buffer is not visiting a file, this function returns -1.


Tested with the buffer “*scratch*” and “*Messages*”, it both returned 0 not -1.
It seems that the latter sentence in manual is useless. 

Reply | Threaded
Open this post in threaded view
|

Re: about the manual of visited-file-modtime

Radon Rosborough
> If the buffer is not visiting a file, this function returns -1.

In my copy of Emacs 26, it says

  If the visited file doesn’t exist, return -1.

Which is exactly what it does. *scratch* and *Messages* do not visit
files, so they have no recorded modtime, hence 0. If you visit a new
file but don't save it, you get -1.

Reply | Threaded
Open this post in threaded view
|

Re: about the manual of visited-file-modtime

zhang cc
Maybe my copy of emacs 26 is too old.

  If the visited file doesnt exist, return -1.


If the visited file is deleted by external program, then does it return -1?


On 13 Mar 2018, 1:25 PM +0800, Radon Rosborough <[hidden email]>, wrote:
If the buffer is not visiting a file, this function returns -1.

In my copy of Emacs 26, it says

If the visited file doesn’t exist, return -1.

Which is exactly what it does. *scratch* and *Messages* do not visit
files, so they have no recorded modtime, hence 0. If you visit a new
file but don't save it, you get -1.
Reply | Threaded
Open this post in threaded view
|

Re: about the manual of visited-file-modtime

Radon Rosborough
> If the buffer is not visiting a file, this function returns -1.
> If the visited file doesn’t exist, return -1.

Ah. I re-read your message and noticed you were talking about the
manual rather than the docstring. The two are inconsistent, and you're
right that the manual should be fixed.

Sorry for the confusion.

> If the visited file is deleted by external program, then does it return -1?

No, just the same value it would have returned if the file were not deleted.