;;; time conversion
-(defun midnight-float-time (&optional tm)
- "Convert `current-time' to a float number of seconds."
- (multiple-value-bind (s0 s1 s2) (or tm (current-time))
- (+ (* (float (ash 1 16)) s0) (float s1) (* 0.0000001 s2))))
-
(defun midnight-time-float (num)
"Convert the float number of seconds since epoch to the list of 3 integers."
(let* ((div (ash 1 16)) (1st (floor num div)))
(defun midnight-buffer-display-time (&optional buf)
"Return the time-stamp of the given buffer, or current buffer, as float."
(with-current-buffer (or buf (current-buffer))
- (when buffer-display-time (midnight-float-time buffer-display-time))))
+ (when buffer-display-time (float-time buffer-display-time))))
;;; clean-buffer-list stuff
displayed (can be nil if the buffer was never displayed) and its
lifetime, i.e., its \"age\" when it will be purged."
(interactive)
- (let ((tm (midnight-float-time)) bts (ts (format-time-string "%Y-%m-%d %T"))
+ (let ((tm (float-time)) bts (ts (format-time-string "%Y-%m-%d %T"))
(bufs (buffer-list)) buf delay cbld bn)
(while (setq buf (pop bufs))
(setq bts (midnight-buffer-display-time buf) bn (buffer-name buf)
))))
(ange-ftp-real-file-attributes file))))
+(defun ange-ftp-file-newer-than-file-p (f1 f2)
+ (let ((f1-parsed (ange-ftp-ftp-name f1))
+ (f2-parsed (ange-ftp-ftp-name f2)))
+ (if (or f1-parsed f2-parsed)
+ (let ((f1-mt (nth 5 (file-attributes f1)))
+ (f2-mt (nth 5 (file-attributes f2))))
+ (cond ((null f1-mt) nil)
+ ((null f2-mt) t)
+ (t (> (float-time f1-mt) (float-time f2-mt)))))
+ (ange-ftp-real-file-newer-than-file-p f1 f2))))
+
(defun ange-ftp-file-writable-p (file)
(setq file (expand-file-name file))
(if (ange-ftp-ftp-name file)
(let ((file-mdtm (ange-ftp-file-modtime name))
(buf-mdtm (with-current-buffer buf (visited-file-modtime))))
(or (zerop (car file-mdtm))
- (< (car file-mdtm) (car buf-mdtm))
- (and (= (car file-mdtm) (car buf-mdtm))
- (< (cadr file-mdtm) (cdr buf-mdtm)))))
+ (< (float-time file-mdtm) (float-time buf-mdtm))))
(ange-ftp-real-verify-visited-file-modtime buf))))
\f
;;;; ------------------------------------------------------------
(put 'copy-file 'ange-ftp 'ange-ftp-copy-file)
(put 'rename-file 'ange-ftp 'ange-ftp-rename-file)
(put 'file-attributes 'ange-ftp 'ange-ftp-file-attributes)
+(put 'file-newer-than-file-p 'ange-ftp 'ange-ftp-file-newer-than-file-p)
(put 'file-name-all-completions 'ange-ftp 'ange-ftp-file-name-all-completions)
(put 'file-name-completion 'ange-ftp 'ange-ftp-file-name-completion)
(put 'insert-directory 'ange-ftp 'ange-ftp-insert-directory)
(ange-ftp-run-real-handler 'rename-file args))
(defun ange-ftp-real-file-attributes (&rest args)
(ange-ftp-run-real-handler 'file-attributes args))
+(defun ange-ftp-real-file-newer-than-file-p (&rest args)
+ (ange-ftp-run-real-handler 'file-newer-than-file-p args))
(defun ange-ftp-real-file-name-all-completions (&rest args)
(ange-ftp-run-real-handler 'file-name-all-completions args))
(defun ange-ftp-real-file-name-completion (&rest args)
;;;; VMS support.
;;;; ------------------------------------------------------------
-(defun ange-ftp-dot-to-slash (string)
- (mapconcat (lambda (char)
- (if (= char ?.)
- (vector ?/)
- (vector char)))
- string ""))
-
;; Convert NAME from UNIX-ish to VMS. If REVERSE given then convert from VMS
;; to UNIX-ish.
(defun ange-ftp-fix-name-for-vms (name &optional reverse)
(setq file
(substring name (match-beginning 3) (match-end 3))))
(and dir
- (setq dir (ange-ftp-dot-to-slash (substring dir 1 -1))))
+ (setq dir (subst-char-in-string
+ ?. ?/ (substring dir 1 -1) t)))
(concat (and drive
(concat "/" drive "/"))
dir (and dir "/")
name (substring name (match-end 0))))
(setq tmp (file-name-directory name))
(if tmp
- (setq dir (ange-ftp-dot-to-slash (substring tmp 0 -1))))
+ (setq dir (subst-char-in-string ?. ?/ (substring tmp 0 -1) t)))
(setq file (file-name-nondirectory name))
(concat drive
(and dir (concat "[" (if drive nil ".") dir "]"))
:tag "GUD modes"
:group 'tooltip)
-
+
(defcustom tooltip-gud-display
'((eq (tooltip-event-buffer tooltip-gud-event)
(marker-buffer overlay-arrow-position)))
\f
;;; Timeout for tooltip display
-(defun tooltip-float-time ()
- "Return the values of `current-time' as a float."
- (let ((now (current-time)))
- (+ (* 65536.0 (nth 0 now))
- (nth 1 now)
- (/ (nth 2 now) 1000000.0))))
-
-
(defun tooltip-delay ()
"Return the delay in seconds for the next tooltip."
(let ((delay tooltip-delay)
- (now (tooltip-float-time)))
+ (now (float-time)))
(when (and tooltip-hide-time
(< (- now tooltip-hide-time) tooltip-recent-seconds))
(setq delay tooltip-short-delay))
Value is non-nil if tooltip was open."
(tooltip-disable-timeout)
(when (x-hide-tip)
- (setq tooltip-hide-time (tooltip-float-time))))
+ (setq tooltip-hide-time (float-time))))
\f
(xdb (concat "p " expr))
(sdb (concat expr "/"))
(perldb expr)))
-
+
(defun tooltip-gud-tips (event)
"Show tip for identifier or selection under the mouse.