all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* time values
@ 2004-07-11  0:33 Luc Teirlinck
  2004-07-11  8:23 ` Kai Grossjohann
  2004-07-11 23:23 ` Richard Stallman
  0 siblings, 2 replies; 13+ messages in thread
From: Luc Teirlinck @ 2004-07-11  0:33 UTC (permalink / raw)


At Richard's request, I plan to soon change the return values of
`visited-file-modtime' and `calendar-time-from-absolute' to the form
(HIGH LOW) instead of (HIGH . LOW).  Grepping shows that these are the
last two functions that still return time values in this obsolete
form.  The return value of `visited-file-modtime' is also inconsistent
with that of `file-attributes'.

The change to `visited-file-modtime' requires supporting changes in
dired.el and tramp.el.   I do not know how tramp.el has to be handled
since there is also a standalone version.

I do not believe that changes in `lisp/gnus/nnfolder.el' or
`lisp/fast-lock.el' are needed, but I use neither, so I do not feel
100% confident about that.  Anyway, any problems I missed should be
easy to correct by simple changes like replacing cdr by cadr or the
like.

Diffs:
 
===File ~/fileio.c-diff=====================================
*** fileio.c	04 Jul 2004 21:04:39 -0500	1.506
--- fileio.c	10 Jul 2004 09:18:18 -0500	
***************
*** 5628,5640 ****
  DEFUN ("visited-file-modtime", Fvisited_file_modtime,
         Svisited_file_modtime, 0, 0, 0,
         doc: /* 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.
  See Info node `(elisp)Modification Time' for more details.  */)
       ()
  {
!   return long_to_cons ((unsigned long) current_buffer->modtime);
  }
  
  DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime,
--- 5628,5644 ----
  DEFUN ("visited-file-modtime", Fvisited_file_modtime,
         Svisited_file_modtime, 0, 0, 0,
         doc: /* 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.
  See Info node `(elisp)Modification Time' for more details.  */)
       ()
  {
!   Lisp_Object tcons;
!   tcons = long_to_cons ((unsigned long) current_buffer->modtime);
!   if (CONSP (tcons))
!     return list2 (XCAR (tcons), XCDR (tcons));
!   return tcons;
  }
  
  DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime,
============================================================

===File ~/cal-dst.el-diff===================================
*** cal-dst.el	02 Sep 2003 07:40:04 -0500	1.20
--- cal-dst.el	09 Jul 2004 20:37:09 -0500	
***************
*** 70,83 ****
  (defun calendar-time-from-absolute (abs-date s)
    "Time of absolute date ABS-DATE, S seconds after midnight.
  
! Returns the pair (HIGH . LOW) where HIGH and LOW are the high and low
  16 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC,
  ignoring leap seconds, that is the equivalent moment to S seconds after
  midnight UTC on absolute date ABS-DATE."
    (let* ((a (- abs-date calendar-system-time-basis))
           (u (+ (* 163 (mod a 512)) (floor s 128))))
      ;; Overflow is a terrible thing!
!     (cons
       ;; floor((60*60*24*a + s) / 2^16)
       (+ a (* 163 (floor a 512)) (floor u 512))
       ;; (60*60*24*a + s) mod 2^16
--- 70,83 ----
  (defun calendar-time-from-absolute (abs-date s)
    "Time of absolute date ABS-DATE, S seconds after midnight.
  
! Returns the list (HIGH LOW) where HIGH and LOW are the high and low
  16 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC,
  ignoring leap seconds, that is the equivalent moment to S seconds after
  midnight UTC on absolute date ABS-DATE."
    (let* ((a (- abs-date calendar-system-time-basis))
           (u (+ (* 163 (mod a 512)) (floor s 128))))
      ;; Overflow is a terrible thing!
!     (list
       ;; floor((60*60*24*a + s) / 2^16)
       (+ a (* 163 (floor a 512)) (floor u 512))
       ;; (60*60*24*a + s) mod 2^16
============================================================

===File ~/dired.el-diff=====================================
*** dired.el	11 Jun 2004 16:28:02 -0500	1.291
--- dired.el	09 Jul 2004 22:00:40 -0500	
***************
*** 620,627 ****
  	     (modtime (visited-file-modtime)))
  	 (or (eq modtime 0)
  	     (not (eq (car attributes) t))
! 	     (and (= (car (nth 5 attributes)) (car modtime))
! 		  (= (nth 1 (nth 5 attributes)) (cdr modtime)))))))
  
  (defun dired-buffer-stale-p (&optional noconfirm)
    "Return non-nil if current dired buffer needs updating.
--- 620,626 ----
  	     (modtime (visited-file-modtime)))
  	 (or (eq modtime 0)
  	     (not (eq (car attributes) t))
! 	     (equal (nth 5 attributes) modtime)))))
  
  (defun dired-buffer-stale-p (&optional noconfirm)
    "Return non-nil if current dired buffer needs updating.
============================================================

===File ~/tramp.el-diff=====================================
*** tramp.el	26 Jun 2004 16:46:18 -0500	1.46
--- tramp.el	10 Jul 2004 15:10:30 -0500	
***************
*** 2338,2349 ****
  	(let* ((attr (file-attributes f))
  	       (modtime (nth 5 attr)))
  	  (cond ((and attr (not (equal modtime '(0 0))))
- 		 ;; Why does `file-attributes' return a list (HIGH
- 		 ;; LOW), but `visited-file-modtime' returns a cons
- 		 ;; (HIGH . LOW)?
  		 (let ((mt (visited-file-modtime)))
  		   (< (abs (tramp-time-diff
! 			    modtime (list (car mt) (cdr mt)))) 2)))
  		(attr
  		 (save-excursion
  		   (tramp-send-command
--- 2338,2346 ----
  	(let* ((attr (file-attributes f))
  	       (modtime (nth 5 attr)))
  	  (cond ((and attr (not (equal modtime '(0 0))))
  		 (let ((mt (visited-file-modtime)))
  		   (< (abs (tramp-time-diff
! 			    modtime mt)) 2)))
  		(attr
  		 (save-excursion
  		   (tramp-send-command
============================================================

===File ~/buffers.texi-diff=================================
*** buffers.texi	23 Jun 2004 10:21:06 -0500	1.37
--- buffers.texi	10 Jul 2004 18:48:30 -0500	
***************
*** 625,633 ****
  @c Emacs 19 feature
  @defun visited-file-modtime
  This function returns the current buffer's recorded last file
! modification time, as a list of the form @code{(@var{high} .
! @var{low})}.  (This is the same format that @code{file-attributes}
! uses to return time values; see @ref{File Attributes}.)
  
  The function returns zero if the buffer has no recorded last
  modification time, which can happen, for instance, if the record has
--- 625,633 ----
  @c Emacs 19 feature
  @defun visited-file-modtime
  This function returns the current buffer's recorded last file
! modification time, as a list of the form @code{(@var{high} @var{low})}.
! (This is the same format that @code{file-attributes} uses to return
! time values; see @ref{File Attributes}.)
  
  The function returns zero if the buffer has no recorded last
  modification time, which can happen, for instance, if the record has
============================================================

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

end of thread, other threads:[~2004-07-17 20:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-11  0:33 time values Luc Teirlinck
2004-07-11  8:23 ` Kai Grossjohann
2004-07-11 13:35   ` Andreas Schwab
2004-07-11 14:35   ` Alex Schroeder
2004-07-11 15:13   ` Luc Teirlinck
2004-07-11 15:18     ` Luc Teirlinck
2004-07-12  3:26     ` Luc Teirlinck
2004-07-11 15:37   ` Luc Teirlinck
2004-07-11 15:57   ` Luc Teirlinck
2004-07-11 23:23   ` Richard Stallman
2004-07-12 18:22   ` Luc Teirlinck
2004-07-17 20:33     ` Kai Grossjohann
2004-07-11 23:23 ` Richard Stallman

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.