diff options
| author | Sam Steingold | 2000-07-26 18:44:36 +0000 |
|---|---|---|
| committer | Sam Steingold | 2000-07-26 18:44:36 +0000 |
| commit | a1f84f6d16f1fe08bbfb16ac4928a5f08679a9e2 (patch) | |
| tree | 28ce57ba5093c8e574f404018394203569d59588 | |
| parent | 34a7a2672ad6bbb5751db3e13e99a16f5adde9d3 (diff) | |
| download | emacs-a1f84f6d16f1fe08bbfb16ac4928a5f08679a9e2.tar.gz emacs-a1f84f6d16f1fe08bbfb16ac4928a5f08679a9e2.zip | |
use float-time
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/midnight.el | 9 | ||||
| -rw-r--r-- | lisp/net/ange-ftp.el | 30 | ||||
| -rw-r--r-- | lisp/tooltip.el | 16 |
4 files changed, 34 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c18144af04a..69997691b32 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2000-07-26 Sam Steingold <sds@gnu.org> | ||
| 2 | |||
| 3 | * net/ange-ftp.el (ange-ftp-file-newer-than-file-p): New function. | ||
| 4 | (ange-ftp-real-file-newer-than-file-p): New function. | ||
| 5 | (ange-ftp-verify-visited-file-modtime): Use `float-time'. | ||
| 6 | (ange-ftp-dot-to-slash): Removed (use `subst-char-in-string'). | ||
| 7 | |||
| 8 | * tooltip.el (tooltip-float-time): Removed (use `float-time'). | ||
| 9 | * midnight.el (midnight-float-time): Ditto. | ||
| 10 | |||
| 1 | 2000-07-26 Andreas Schwab <schwab@suse.de> | 11 | 2000-07-26 Andreas Schwab <schwab@suse.de> |
| 2 | 12 | ||
| 3 | * files.el (normal-backup-enable-predicate): Correct | 13 | * files.el (normal-backup-enable-predicate): Correct |
diff --git a/lisp/midnight.el b/lisp/midnight.el index 2c05ad14d19..2995dbd8ed6 100644 --- a/lisp/midnight.el +++ b/lisp/midnight.el | |||
| @@ -63,11 +63,6 @@ call `cancel-timer' or `timer-activate' on `midnight-timer' instead." | |||
| 63 | 63 | ||
| 64 | ;;; time conversion | 64 | ;;; time conversion |
| 65 | 65 | ||
| 66 | (defun midnight-float-time (&optional tm) | ||
| 67 | "Convert `current-time' to a float number of seconds." | ||
| 68 | (multiple-value-bind (s0 s1 s2) (or tm (current-time)) | ||
| 69 | (+ (* (float (ash 1 16)) s0) (float s1) (* 0.0000001 s2)))) | ||
| 70 | |||
| 71 | (defun midnight-time-float (num) | 66 | (defun midnight-time-float (num) |
| 72 | "Convert the float number of seconds since epoch to the list of 3 integers." | 67 | "Convert the float number of seconds since epoch to the list of 3 integers." |
| 73 | (let* ((div (ash 1 16)) (1st (floor num div))) | 68 | (let* ((div (ash 1 16)) (1st (floor num div))) |
| @@ -77,7 +72,7 @@ call `cancel-timer' or `timer-activate' on `midnight-timer' instead." | |||
| 77 | (defun midnight-buffer-display-time (&optional buf) | 72 | (defun midnight-buffer-display-time (&optional buf) |
| 78 | "Return the time-stamp of the given buffer, or current buffer, as float." | 73 | "Return the time-stamp of the given buffer, or current buffer, as float." |
| 79 | (with-current-buffer (or buf (current-buffer)) | 74 | (with-current-buffer (or buf (current-buffer)) |
| 80 | (when buffer-display-time (midnight-float-time buffer-display-time)))) | 75 | (when buffer-display-time (float-time buffer-display-time)))) |
| 81 | 76 | ||
| 82 | ;;; clean-buffer-list stuff | 77 | ;;; clean-buffer-list stuff |
| 83 | 78 | ||
| @@ -177,7 +172,7 @@ the current date/time, buffer name, how many seconds ago it was | |||
| 177 | displayed (can be nil if the buffer was never displayed) and its | 172 | displayed (can be nil if the buffer was never displayed) and its |
| 178 | lifetime, i.e., its \"age\" when it will be purged." | 173 | lifetime, i.e., its \"age\" when it will be purged." |
| 179 | (interactive) | 174 | (interactive) |
| 180 | (let ((tm (midnight-float-time)) bts (ts (format-time-string "%Y-%m-%d %T")) | 175 | (let ((tm (float-time)) bts (ts (format-time-string "%Y-%m-%d %T")) |
| 181 | (bufs (buffer-list)) buf delay cbld bn) | 176 | (bufs (buffer-list)) buf delay cbld bn) |
| 182 | (while (setq buf (pop bufs)) | 177 | (while (setq buf (pop bufs)) |
| 183 | (setq bts (midnight-buffer-display-time buf) bn (buffer-name buf) | 178 | (setq bts (midnight-buffer-display-time buf) bn (buffer-name buf) |
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 693be20a8ac..e710540f785 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el | |||
| @@ -3357,6 +3357,17 @@ system TYPE.") | |||
| 3357 | )))) | 3357 | )))) |
| 3358 | (ange-ftp-real-file-attributes file)))) | 3358 | (ange-ftp-real-file-attributes file)))) |
| 3359 | 3359 | ||
| 3360 | (defun ange-ftp-file-newer-than-file-p (f1 f2) | ||
| 3361 | (let ((f1-parsed (ange-ftp-ftp-name f1)) | ||
| 3362 | (f2-parsed (ange-ftp-ftp-name f2))) | ||
| 3363 | (if (or f1-parsed f2-parsed) | ||
| 3364 | (let ((f1-mt (nth 5 (file-attributes f1))) | ||
| 3365 | (f2-mt (nth 5 (file-attributes f2)))) | ||
| 3366 | (cond ((null f1-mt) nil) | ||
| 3367 | ((null f2-mt) t) | ||
| 3368 | (t (> (float-time f1-mt) (float-time f2-mt))))) | ||
| 3369 | (ange-ftp-real-file-newer-than-file-p f1 f2)))) | ||
| 3370 | |||
| 3360 | (defun ange-ftp-file-writable-p (file) | 3371 | (defun ange-ftp-file-writable-p (file) |
| 3361 | (setq file (expand-file-name file)) | 3372 | (setq file (expand-file-name file)) |
| 3362 | (if (ange-ftp-ftp-name file) | 3373 | (if (ange-ftp-ftp-name file) |
| @@ -3417,9 +3428,7 @@ system TYPE.") | |||
| 3417 | (let ((file-mdtm (ange-ftp-file-modtime name)) | 3428 | (let ((file-mdtm (ange-ftp-file-modtime name)) |
| 3418 | (buf-mdtm (with-current-buffer buf (visited-file-modtime)))) | 3429 | (buf-mdtm (with-current-buffer buf (visited-file-modtime)))) |
| 3419 | (or (zerop (car file-mdtm)) | 3430 | (or (zerop (car file-mdtm)) |
| 3420 | (< (car file-mdtm) (car buf-mdtm)) | 3431 | (< (float-time file-mdtm) (float-time buf-mdtm)))) |
| 3421 | (and (= (car file-mdtm) (car buf-mdtm)) | ||
| 3422 | (< (cadr file-mdtm) (cdr buf-mdtm))))) | ||
| 3423 | (ange-ftp-real-verify-visited-file-modtime buf)))) | 3432 | (ange-ftp-real-verify-visited-file-modtime buf)))) |
| 3424 | 3433 | ||
| 3425 | ;;;; ------------------------------------------------------------ | 3434 | ;;;; ------------------------------------------------------------ |
| @@ -4164,6 +4173,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4164 | (put 'copy-file 'ange-ftp 'ange-ftp-copy-file) | 4173 | (put 'copy-file 'ange-ftp 'ange-ftp-copy-file) |
| 4165 | (put 'rename-file 'ange-ftp 'ange-ftp-rename-file) | 4174 | (put 'rename-file 'ange-ftp 'ange-ftp-rename-file) |
| 4166 | (put 'file-attributes 'ange-ftp 'ange-ftp-file-attributes) | 4175 | (put 'file-attributes 'ange-ftp 'ange-ftp-file-attributes) |
| 4176 | (put 'file-newer-than-file-p 'ange-ftp 'ange-ftp-file-newer-than-file-p) | ||
| 4167 | (put 'file-name-all-completions 'ange-ftp 'ange-ftp-file-name-all-completions) | 4177 | (put 'file-name-all-completions 'ange-ftp 'ange-ftp-file-name-all-completions) |
| 4168 | (put 'file-name-completion 'ange-ftp 'ange-ftp-file-name-completion) | 4178 | (put 'file-name-completion 'ange-ftp 'ange-ftp-file-name-completion) |
| 4169 | (put 'insert-directory 'ange-ftp 'ange-ftp-insert-directory) | 4179 | (put 'insert-directory 'ange-ftp 'ange-ftp-insert-directory) |
| @@ -4245,6 +4255,8 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4245 | (ange-ftp-run-real-handler 'rename-file args)) | 4255 | (ange-ftp-run-real-handler 'rename-file args)) |
| 4246 | (defun ange-ftp-real-file-attributes (&rest args) | 4256 | (defun ange-ftp-real-file-attributes (&rest args) |
| 4247 | (ange-ftp-run-real-handler 'file-attributes args)) | 4257 | (ange-ftp-run-real-handler 'file-attributes args)) |
| 4258 | (defun ange-ftp-real-file-newer-than-file-p (&rest args) | ||
| 4259 | (ange-ftp-run-real-handler 'file-newer-than-file-p args)) | ||
| 4248 | (defun ange-ftp-real-file-name-all-completions (&rest args) | 4260 | (defun ange-ftp-real-file-name-all-completions (&rest args) |
| 4249 | (ange-ftp-run-real-handler 'file-name-all-completions args)) | 4261 | (ange-ftp-run-real-handler 'file-name-all-completions args)) |
| 4250 | (defun ange-ftp-real-file-name-completion (&rest args) | 4262 | (defun ange-ftp-real-file-name-completion (&rest args) |
| @@ -4727,13 +4739,6 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4727 | ;;;; VMS support. | 4739 | ;;;; VMS support. |
| 4728 | ;;;; ------------------------------------------------------------ | 4740 | ;;;; ------------------------------------------------------------ |
| 4729 | 4741 | ||
| 4730 | (defun ange-ftp-dot-to-slash (string) | ||
| 4731 | (mapconcat (lambda (char) | ||
| 4732 | (if (= char ?.) | ||
| 4733 | (vector ?/) | ||
| 4734 | (vector char))) | ||
| 4735 | string "")) | ||
| 4736 | |||
| 4737 | ;; Convert NAME from UNIX-ish to VMS. If REVERSE given then convert from VMS | 4742 | ;; Convert NAME from UNIX-ish to VMS. If REVERSE given then convert from VMS |
| 4738 | ;; to UNIX-ish. | 4743 | ;; to UNIX-ish. |
| 4739 | (defun ange-ftp-fix-name-for-vms (name &optional reverse) | 4744 | (defun ange-ftp-fix-name-for-vms (name &optional reverse) |
| @@ -4752,7 +4757,8 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4752 | (setq file | 4757 | (setq file |
| 4753 | (substring name (match-beginning 3) (match-end 3)))) | 4758 | (substring name (match-beginning 3) (match-end 3)))) |
| 4754 | (and dir | 4759 | (and dir |
| 4755 | (setq dir (ange-ftp-dot-to-slash (substring dir 1 -1)))) | 4760 | (setq dir (subst-char-in-string |
| 4761 | ?. ?/ (substring dir 1 -1) t))) | ||
| 4756 | (concat (and drive | 4762 | (concat (and drive |
| 4757 | (concat "/" drive "/")) | 4763 | (concat "/" drive "/")) |
| 4758 | dir (and dir "/") | 4764 | dir (and dir "/") |
| @@ -4765,7 +4771,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") | |||
| 4765 | name (substring name (match-end 0)))) | 4771 | name (substring name (match-end 0)))) |
| 4766 | (setq tmp (file-name-directory name)) | 4772 | (setq tmp (file-name-directory name)) |
| 4767 | (if tmp | 4773 | (if tmp |
| 4768 | (setq dir (ange-ftp-dot-to-slash (substring tmp 0 -1)))) | 4774 | (setq dir (subst-char-in-string ?. ?/ (substring tmp 0 -1) t))) |
| 4769 | (setq file (file-name-nondirectory name)) | 4775 | (setq file (file-name-nondirectory name)) |
| 4770 | (concat drive | 4776 | (concat drive |
| 4771 | (and dir (concat "[" (if drive nil ".") dir "]")) | 4777 | (and dir (concat "[" (if drive nil ".") dir "]")) |
diff --git a/lisp/tooltip.el b/lisp/tooltip.el index b3fc461ff21..a7484dc7fd5 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el | |||
| @@ -102,7 +102,7 @@ Do so after `tooltip-short-delay'." | |||
| 102 | :tag "GUD modes" | 102 | :tag "GUD modes" |
| 103 | :group 'tooltip) | 103 | :group 'tooltip) |
| 104 | 104 | ||
| 105 | 105 | ||
| 106 | (defcustom tooltip-gud-display | 106 | (defcustom tooltip-gud-display |
| 107 | '((eq (tooltip-event-buffer tooltip-gud-event) | 107 | '((eq (tooltip-event-buffer tooltip-gud-event) |
| 108 | (marker-buffer overlay-arrow-position))) | 108 | (marker-buffer overlay-arrow-position))) |
| @@ -195,18 +195,10 @@ With ARG, turn tooltip mode on if and only if ARG is positive." | |||
| 195 | 195 | ||
| 196 | ;;; Timeout for tooltip display | 196 | ;;; Timeout for tooltip display |
| 197 | 197 | ||
| 198 | (defun tooltip-float-time () | ||
| 199 | "Return the values of `current-time' as a float." | ||
| 200 | (let ((now (current-time))) | ||
| 201 | (+ (* 65536.0 (nth 0 now)) | ||
| 202 | (nth 1 now) | ||
| 203 | (/ (nth 2 now) 1000000.0)))) | ||
| 204 | |||
| 205 | |||
| 206 | (defun tooltip-delay () | 198 | (defun tooltip-delay () |
| 207 | "Return the delay in seconds for the next tooltip." | 199 | "Return the delay in seconds for the next tooltip." |
| 208 | (let ((delay tooltip-delay) | 200 | (let ((delay tooltip-delay) |
| 209 | (now (tooltip-float-time))) | 201 | (now (float-time))) |
| 210 | (when (and tooltip-hide-time | 202 | (when (and tooltip-hide-time |
| 211 | (< (- now tooltip-hide-time) tooltip-recent-seconds)) | 203 | (< (- now tooltip-hide-time) tooltip-recent-seconds)) |
| 212 | (setq delay tooltip-short-delay)) | 204 | (setq delay tooltip-short-delay)) |
| @@ -287,7 +279,7 @@ ACTIVATEP non-nil means activate mouse motion events." | |||
| 287 | Value is non-nil if tooltip was open." | 279 | Value is non-nil if tooltip was open." |
| 288 | (tooltip-disable-timeout) | 280 | (tooltip-disable-timeout) |
| 289 | (when (x-hide-tip) | 281 | (when (x-hide-tip) |
| 290 | (setq tooltip-hide-time (tooltip-float-time)))) | 282 | (setq tooltip-hide-time (float-time)))) |
| 291 | 283 | ||
| 292 | 284 | ||
| 293 | 285 | ||
| @@ -397,7 +389,7 @@ If TOOLTIP-GUD-DEREFERENCE is t, also prepend a `*' to EXPR." | |||
| 397 | (xdb (concat "p " expr)) | 389 | (xdb (concat "p " expr)) |
| 398 | (sdb (concat expr "/")) | 390 | (sdb (concat expr "/")) |
| 399 | (perldb expr))) | 391 | (perldb expr))) |
| 400 | 392 | ||
| 401 | 393 | ||
| 402 | (defun tooltip-gud-tips (event) | 394 | (defun tooltip-gud-tips (event) |
| 403 | "Show tip for identifier or selection under the mouse. | 395 | "Show tip for identifier or selection under the mouse. |