diff options
| author | Richard M. Stallman | 1993-03-19 05:30:19 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-03-19 05:30:19 +0000 |
| commit | f5d5eccf37278ee1fca2b77f8f181f06ae9ae65b (patch) | |
| tree | a581c750601a809332a38032505e48a8ba1560c6 /src | |
| parent | a6af86963639a8c4ed94f3b79589b6a6df3fbe5a (diff) | |
| download | emacs-f5d5eccf37278ee1fca2b77f8f181f06ae9ae65b.tar.gz emacs-f5d5eccf37278ee1fca2b77f8f181f06ae9ae65b.zip | |
(Fvisited_file_modtime): New function.
(Fset_visited_file_modtime): Accept an argument specifying time value.
If arg is nil, really use the filename handler.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/src/fileio.c b/src/fileio.c index 0a534287c8c..6948653f968 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2822,27 +2822,45 @@ Next attempt to save will certainly not complain of a discrepancy.") | |||
| 2822 | return Qnil; | 2822 | return Qnil; |
| 2823 | } | 2823 | } |
| 2824 | 2824 | ||
| 2825 | DEFUN ("visited-file-modtime", Fvisited_file_modtime, | ||
| 2826 | Svisited_file_modtime, 0, 0, 0, | ||
| 2827 | "Return the current buffer's recorded visited file modification time.\n\ | ||
| 2828 | The value is a list of the form (HIGH . LOW), like the time values\n\ | ||
| 2829 | that `file-attributes' returns.") | ||
| 2830 | () | ||
| 2831 | { | ||
| 2832 | return long_to_cons (current_buffer->modtime); | ||
| 2833 | } | ||
| 2834 | |||
| 2825 | DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime, | 2835 | DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime, |
| 2826 | Sset_visited_file_modtime, 0, 0, 0, | 2836 | Sset_visited_file_modtime, 0, 1, 0, |
| 2827 | "Update buffer's recorded modification time from the visited file's time.\n\ | 2837 | "Update buffer's recorded modification time from the visited file's time.\n\ |
| 2828 | Useful if the buffer was not read from the file normally\n\ | 2838 | Useful if the buffer was not read from the file normally\n\ |
| 2829 | or if the file itself has been changed for some known benign reason.") | 2839 | or if the file itself has been changed for some known benign reason.\n\ |
| 2830 | () | 2840 | An argument specifies the modification time value to use\n\ |
| 2841 | \(instead of that of the visited file), in the form of a list\n\ | ||
| 2842 | \(HIGH . LOW) or (HIGH LOW).") | ||
| 2843 | (time_list) | ||
| 2844 | Lisp_Object time_list; | ||
| 2831 | { | 2845 | { |
| 2832 | register Lisp_Object filename; | 2846 | if (!NILP (time_list)) |
| 2833 | struct stat st; | 2847 | current_buffer->modtime = cons_to_long (time_list); |
| 2834 | Lisp_Object handler; | 2848 | else |
| 2849 | { | ||
| 2850 | register Lisp_Object filename; | ||
| 2851 | struct stat st; | ||
| 2852 | Lisp_Object handler; | ||
| 2835 | 2853 | ||
| 2836 | filename = Fexpand_file_name (current_buffer->filename, Qnil); | 2854 | filename = Fexpand_file_name (current_buffer->filename, Qnil); |
| 2837 | 2855 | ||
| 2838 | /* If the file name has special constructs in it, | 2856 | /* If the file name has special constructs in it, |
| 2839 | call the corresponding file handler. */ | 2857 | call the corresponding file handler. */ |
| 2840 | handler = Ffind_file_name_handler (filename); | 2858 | handler = Ffind_file_name_handler (filename); |
| 2841 | if (!NILP (handler)) | 2859 | if (!NILP (handler)) |
| 2842 | current_buffer->modtime = 0; | 2860 | return call3 (handler, Qfile_name_directory, filename, Qnil); |
| 2843 | 2861 | else if (stat (XSTRING (filename)->data, &st) >= 0) | |
| 2844 | else if (stat (XSTRING (filename)->data, &st) >= 0) | 2862 | current_buffer->modtime = st.st_mtime; |
| 2845 | current_buffer->modtime = st.st_mtime; | 2863 | } |
| 2846 | 2864 | ||
| 2847 | return Qnil; | 2865 | return Qnil; |
| 2848 | } | 2866 | } |
| @@ -3378,6 +3396,7 @@ for its argument."); | |||
| 3378 | defsubr (&Swrite_region); | 3396 | defsubr (&Swrite_region); |
| 3379 | defsubr (&Sverify_visited_file_modtime); | 3397 | defsubr (&Sverify_visited_file_modtime); |
| 3380 | defsubr (&Sclear_visited_file_modtime); | 3398 | defsubr (&Sclear_visited_file_modtime); |
| 3399 | defsubr (&Svisited_file_modtime); | ||
| 3381 | defsubr (&Sset_visited_file_modtime); | 3400 | defsubr (&Sset_visited_file_modtime); |
| 3382 | defsubr (&Sdo_auto_save); | 3401 | defsubr (&Sdo_auto_save); |
| 3383 | defsubr (&Sset_buffer_auto_saved); | 3402 | defsubr (&Sset_buffer_auto_saved); |