APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1552226773 0
# Sun Mar 10 14:06:13 2019 +0000
# Node ID 5aaa9025873317ac1c3054debfddb90c77168838
# Parent 93f9adafefb31b803e6ed8d5062aa3ce70b46ff4
Make buf->modtime a time_t; use lisp_to_time(), make_time() as appropriate.
src/ChangeLog addition:
2019-03-10 Aidan Kehoe <kehoea(a)parhasard.net>
* buffer.c (complex_vars_of_buffer):
Document the revised format of the undo list, where the saved
modification time is now whatever was supplied by make_time().
* buffer.h (struct buffer):
Make modtime and auto_save_failure_time into time_t, not int.
* editfns.c (lisp_to_time):
Give this a docstring, and declare it as returning a Boolint, for
more clarity about what's going on with its return value.
* fileio.c:
* fileio.c (Fset_visited_file_modtime):
Update the time of buf->modtime in this function.
* lisp.h:
Make lisp_to_time() generally available.
* select-gtk.c (symbol_to_gtk_atom):
No need to declare lisp_to_time() here, nor the long-obsolete
time_to_lisp().
* select-x.c:
No need to declare lisp_to_time() here, and we are using
lisp_to_uint32_t() anyway, as appropriate for X11.
* undo.c (undo_prelude):
Just call make_time() here when saving the modification time,
don't implement it ourselves.
* undo.c (Fprimitive_undo):
Use lisp_to_time() here, rather than implementing it ourselves.
diff -r 93f9adafefb3 -r 5aaa90258733 src/ChangeLog
--- a/src/ChangeLog Sun Mar 10 13:09:43 2019 +0000
+++ b/src/ChangeLog Sun Mar 10 14:06:13 2019 +0000
@@ -1,3 +1,30 @@
+2019-03-10 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * buffer.c (complex_vars_of_buffer):
+ Document the revised format of the undo list, where the saved
+ modification time is now whatever was supplied by make_time().
+ * buffer.h (struct buffer):
+ Make modtime and auto_save_failure_time into time_t, not int.
+ * editfns.c (lisp_to_time):
+ Give this a docstring, and declare it as returning a Boolint, for
+ more clarity about what's going on with its return value.
+ * fileio.c:
+ * fileio.c (Fset_visited_file_modtime):
+ Update the time of buf->modtime in this function.
+ * lisp.h:
+ Make lisp_to_time() generally available.
+ * select-gtk.c (symbol_to_gtk_atom):
+ No need to declare lisp_to_time() here, nor the long-obsolete
+ time_to_lisp().
+ * select-x.c:
+ No need to declare lisp_to_time() here, and we are using
+ lisp_to_uint32_t() anyway, as appropriate for X11.
+ * undo.c (undo_prelude):
+ Just call make_time() here when saving the modification time,
+ don't implement it ourselves.
+ * undo.c (Fprimitive_undo):
+ Use lisp_to_time() here, rather than implementing it ourselves.
+
2019-03-10 Aidan Kehoe <kehoea(a)parhasard.net>
Move the buffer last_window_start to being a zero-length extent,
diff -r 93f9adafefb3 -r 5aaa90258733 src/buffer.c
--- a/src/buffer.c Sun Mar 10 13:09:43 2019 +0000
+++ b/src/buffer.c Sun Mar 10 14:06:13 2019 +0000
@@ -2816,9 +2816,9 @@
from (abs POSITION). If POSITION is positive, point was at the front
of the text being deleted; if negative, point was at the end.
-An entry (t HIGH . LOW) indicates that the buffer previously had
-"unmodified" status. HIGH and LOW are the high and low 16-bit portions
-of the visited file's modification time, as of that time. If the
+An entry (t CONS) indicates that the buffer previously had "unmodified"
+status. CONS is a Lisp representation of the visited file's modification time
+at that point. See the SPECIFIED-TIME argument to `decode-time'. If the
modification time of the most recent save is different, this entry is
obsolete.
diff -r 93f9adafefb3 -r 5aaa90258733 src/buffer.h
--- a/src/buffer.h Sun Mar 10 13:09:43 2019 +0000
+++ b/src/buffer.h Sun Mar 10 14:06:13 2019 +0000
@@ -245,14 +245,14 @@
-1 means visited file was nonexistent.
0 means visited file modtime unknown; in no case complain
about any mismatch on next save attempt. */
- int modtime;
+ time_t modtime;
/* the value of text->modiff at the last auto-save. */
long auto_save_modified;
/* The time at which we detected a failure to auto-save,
Or -1 if we didn't have a failure. */
- int auto_save_failure_time;
+ time_t auto_save_failure_time;
/* Everything from here down must be a Lisp_Object */
diff -r 93f9adafefb3 -r 5aaa90258733 src/editfns.c
--- a/src/editfns.c Sun Mar 10 13:09:43 2019 +0000
+++ b/src/editfns.c Sun Mar 10 14:06:13 2019 +0000
@@ -958,8 +958,12 @@
}
-int lisp_to_time (Lisp_Object specified_time, time_t *result);
-int
+/* Decode SPECIFIED_TIME, a Lisp_Object in the format documented in the
+ docstring to `decode-time', storing the result at the address specified by
+ RESULT.
+ Return non-zero if this decoding was successful.
+ Error if the format of SPECIFIED_TIME does not match what we expect. */
+Boolint
lisp_to_time (Lisp_Object specified_time, time_t *result)
{
Lisp_Object high, low;
diff -r 93f9adafefb3 -r 5aaa90258733 src/fileio.c
--- a/src/fileio.c Sun Mar 10 13:09:43 2019 +0000
+++ b/src/fileio.c Sun Mar 10 14:06:13 2019 +0000
@@ -63,8 +63,6 @@
#define DRIVE_LETTER(x) tolower (x)
#endif /* WIN32_NATIVE || CYGWIN */
-int lisp_to_time (Lisp_Object, time_t *);
-
/* Nonzero during writing of auto-save files */
static int auto_saving;
@@ -3286,7 +3284,7 @@
filename)));
/* If visiting nonexistent file, return nil. */
- if (buf->modtime == -1)
+ if (buf->modtime == (time_t)(-1))
report_file_error ("Opening input file",
filename);
}
@@ -3982,7 +3980,7 @@
{
time_t the_time;
lisp_to_time (time_list, &the_time);
- current_buffer->modtime = (int) the_time;
+ current_buffer->modtime = the_time;
}
else
{
diff -r 93f9adafefb3 -r 5aaa90258733 src/lisp.h
--- a/src/lisp.h Sun Mar 10 13:09:43 2019 +0000
+++ b/src/lisp.h Sun Mar 10 14:06:13 2019 +0000
@@ -4830,6 +4830,7 @@
Lisp_Object make_string_from_buffer (struct buffer *, Charbpos, Charcount);
Lisp_Object make_string_from_buffer_no_extents (struct buffer *, Charbpos, Charcount);
Lisp_Object make_time (time_t);
+Boolint lisp_to_time (Lisp_Object, time_t *);
Lisp_Object save_excursion_save (void);
Lisp_Object save_restriction_save (struct buffer *buf);
Lisp_Object save_excursion_restore (Lisp_Object);
diff -r 93f9adafefb3 -r 5aaa90258733 src/select-gtk.c
--- a/src/select-gtk.c Sun Mar 10 13:09:43 2019 +0000
+++ b/src/select-gtk.c Sun Mar 10 14:06:13 2019 +0000
@@ -45,9 +45,6 @@
Lisp_Object Qgtk_sent_selection_hooks;
-extern int lisp_to_time (Lisp_Object, time_t *);
-extern Lisp_Object time_to_lisp (time_t);
-
static GdkAtom
symbol_to_gtk_atom (struct device *UNUSED (d), Lisp_Object sym,
int only_if_exists)
diff -r 93f9adafefb3 -r 5aaa90258733 src/select-x.c
--- a/src/select-x.c Sun Mar 10 13:09:43 2019 +0000
+++ b/src/select-x.c Sun Mar 10 14:06:13 2019 +0000
@@ -35,8 +35,6 @@
#include "systime.h"
-int lisp_to_time (Lisp_Object, time_t *);
-
#ifdef LWLIB_USES_MOTIF
# define MOTIF_CLIPBOARDS
#endif
diff -r 93f9adafefb3 -r 5aaa90258733 src/undo.c
--- a/src/undo.c Sun Mar 10 13:09:43 2019 +0000
+++ b/src/undo.c Sun Mar 10 14:06:13 2019 +0000
@@ -92,10 +92,7 @@
entry we can tell whether it is obsolete because the file was
saved again. */
b->undo_list
- = Fcons (Fcons (Qt,
- Fcons (make_fixnum ((b->modtime >> 16) & 0xffff),
- make_fixnum (b->modtime & 0xffff))),
- b->undo_list);
+ = Fcons (Fcons (Qt, make_time (b->modtime)), b->undo_list);
}
return 1;
}
@@ -406,13 +403,10 @@
if (EQ (car, Qt))
{
/* Element (t high . low) records previous modtime. */
- Lisp_Object high, low;
- int mod_time;
- if (!CONSP (cdr)) goto rotten;
- high = XCAR (cdr);
- low = XCDR (cdr);
- if (!FIXNUMP (high) || !FIXNUMP (low)) goto rotten;
- mod_time = (XFIXNUM (high) << 16) + XFIXNUM (low);
+ time_t mod_time;
+
+ if (!lisp_to_time (cdr, &mod_time)) goto rotten;
+
/* If this records an obsolete save
(not matching the actual disk file)
then don't mark unmodified. */
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)