emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r102304: Replace some eshell function


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102304: Replace some eshell functions that duplicate standard functions.
Date: Tue, 09 Nov 2010 19:57:32 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102304
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2010-11-09 19:57:32 -0800
message:
  Replace some eshell functions that duplicate standard functions.
  
  * lisp/eshell/esh-util.el (eshell-time-less-p, eshell-time-to-seconds): 
Remove.
  (eshell-read-passwd, eshell-read-hosts): Use time-less-p.
  * lisp/eshell/esh-test.el (eshell-test, eshell-show-usage-metrics):
  * lisp/eshell/em-unix.el (eshell-show-elapsed-time, eshell/time):
  * lisp/eshell/em-pred.el (eshell-pred-file-time): Use float-time.
  * lisp/eshell/em-ls.el (eshell-ls-sort-entries): Use time-less-p.
modified:
  lisp/ChangeLog
  lisp/eshell/em-ls.el
  lisp/eshell/em-pred.el
  lisp/eshell/em-unix.el
  lisp/eshell/esh-test.el
  lisp/eshell/esh-util.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-11-10 03:53:03 +0000
+++ b/lisp/ChangeLog    2010-11-10 03:57:32 +0000
@@ -1,5 +1,13 @@
 2010-11-10  Glenn Morris  <address@hidden>
 
+       * eshell/esh-util.el (eshell-time-less-p, eshell-time-to-seconds):
+       Remove.
+       (eshell-read-passwd, eshell-read-hosts): Use time-less-p.
+       * eshell/esh-test.el (eshell-test, eshell-show-usage-metrics):
+       * eshell/em-unix.el (eshell-show-elapsed-time, eshell/time):
+       * eshell/em-pred.el (eshell-pred-file-time): Use float-time.
+       * eshell/em-ls.el (eshell-ls-sort-entries): Use time-less-p.
+
        * eshell/em-unix.el (eshell-remove-entries, eshell/rm)
        (eshell-shuffle-files, eshell-shorthand-tar-command)
        (eshell-mvcpln-template, eshell/mv, eshell/cp, eshell/ln):

=== modified file 'lisp/eshell/em-ls.el'
--- a/lisp/eshell/em-ls.el      2010-09-25 21:51:55 +0000
+++ b/lisp/eshell/em-ls.el      2010-11-10 03:57:32 +0000
@@ -612,11 +612,11 @@
             (let ((result
                    (cond
                     ((eq sort-method 'by-atime)
-                     (eshell-ls-compare-entries l r 4 'eshell-time-less-p))
+                     (eshell-ls-compare-entries l r 4 'time-less-p))
                     ((eq sort-method 'by-mtime)
-                     (eshell-ls-compare-entries l r 5 'eshell-time-less-p))
+                     (eshell-ls-compare-entries l r 5 'time-less-p))
                     ((eq sort-method 'by-ctime)
-                     (eshell-ls-compare-entries l r 6 'eshell-time-less-p))
+                     (eshell-ls-compare-entries l r 6 'time-less-p))
                     ((eq sort-method 'by-size)
                      (eshell-ls-compare-entries l r 7 '<))
                     ((eq sort-method 'by-extension)
@@ -941,5 +941,4 @@
 ;; generated-autoload-file: "esh-groups.el"
 ;; End:
 
-;; arch-tag: 9295181c-0cb2-499c-999b-89f5359842cb
 ;;; em-ls.el ends here

=== modified file 'lisp/eshell/em-pred.el'
--- a/lisp/eshell/em-pred.el    2010-09-25 21:51:55 +0000
+++ b/lisp/eshell/em-pred.el    2010-11-10 03:57:32 +0000
@@ -427,7 +427,7 @@
       (forward-char))
     (if (looking-at "[0-9]+")
        (progn
-         (setq when (- (eshell-time-to-seconds (current-time))
+         (setq when (- (float-time)
                        (* (string-to-number (match-string 0))
                           quantum)))
          (goto-char (match-end 0)))
@@ -444,7 +444,7 @@
             (attrs (file-attributes file)))
        (unless attrs
          (error "Cannot stat file `%s'" file))
-       (setq when (eshell-time-to-seconds (nth attr-index attrs))))
+       (setq when (float-time (nth attr-index attrs))))
       (goto-char (1+ end)))
     `(lambda (file)
        (let ((attrs (file-attributes file)))
@@ -453,7 +453,7 @@
                   '<
                 (if (eq qual ?+)
                     '>
-                  '=)) ,when (eshell-time-to-seconds
+                  '=)) ,when (float-time
                               (nth ,attr-index attrs))))))))
 
 (defun eshell-pred-file-type (type)
@@ -605,5 +605,4 @@
 ;; generated-autoload-file: "esh-groups.el"
 ;; End:
 
-;; arch-tag: 8b5ce022-17f3-4c40-93c7-5faafaa63f31
 ;;; em-pred.el ends here

=== modified file 'lisp/eshell/em-unix.el'
--- a/lisp/eshell/em-unix.el    2010-11-10 03:53:03 +0000
+++ b/lisp/eshell/em-unix.el    2010-11-10 03:57:32 +0000
@@ -912,9 +912,7 @@
 (defvar eshell-time-start nil)
 
 (defun eshell-show-elapsed-time ()
-  (let ((elapsed (format "%.3f secs\n"
-                        (- (eshell-time-to-seconds (current-time))
-                           eshell-time-start))))
+  (let ((elapsed (format "%.3f secs\n" (- (float-time) eshell-time-start))))
     (set-text-properties 0 (length elapsed) '(face bold) elapsed)
     (eshell-interactive-print elapsed))
   (remove-hook 'eshell-post-command-hook 'eshell-show-elapsed-time t))
@@ -940,7 +938,7 @@
        :show-usage
        :usage "COMMAND...
 Show wall-clock time elapsed during execution of COMMAND.")
-     (setq eshell-time-start (eshell-time-to-seconds (current-time)))
+     (setq eshell-time-start (float-time))
      (add-hook 'eshell-post-command-hook 'eshell-show-elapsed-time nil t)
      ;; after setting
      (throw 'eshell-replace-command

=== modified file 'lisp/eshell/esh-test.el'
--- a/lisp/eshell/esh-test.el   2010-09-25 21:51:55 +0000
+++ b/lisp/eshell/esh-test.el   2010-11-10 03:57:32 +0000
@@ -150,7 +150,7 @@
 (defun eshell-test (&optional arg)
   "Test Eshell to verify that it works as expected."
   (interactive "P")
-  (let* ((begin (eshell-time-to-seconds (current-time)))
+  (let* ((begin (float-time))
         (test-buffer (get-buffer-create "*eshell test*")))
     (set-buffer (let ((inhibit-redisplay t))
                  (save-window-excursion (eshell t))))
@@ -176,8 +176,7 @@
     (with-current-buffer test-buffer
       (insert (format "\n\n--- %s --- (completed in %d seconds)\n"
                      (current-time-string)
-                     (- (eshell-time-to-seconds (current-time))
-                        begin)))
+                     (- (float-time) begin)))
       (message "Eshell test suite completed: %s failure%s"
               (if (> eshell-test-failures 0)
                   (number-to-string eshell-test-failures)
@@ -223,14 +222,13 @@
                  (if (eq eshell-show-usage-metrics t)
                      (- eshell-metric-after-command
                         eshell-metric-before-command 7)
-                   (- (eshell-time-to-seconds
+                   (- (float-time
                        eshell-metric-after-command)
-                      (eshell-time-to-seconds
+                      (float-time
                        eshell-metric-before-command))))
                 "\n"))))
            nil t))
 
 (provide 'esh-test)
 
-;; arch-tag: 6e32275a-8285-4a4e-b7cf-819aa7c86b8e
 ;;; esh-test.el ends here

=== modified file 'lisp/eshell/esh-util.el'
--- a/lisp/eshell/esh-util.el   2010-11-07 01:56:09 +0000
+++ b/lisp/eshell/esh-util.el   2010-11-10 03:57:32 +0000
@@ -341,20 +341,6 @@
   "Flatten and stringify all of the ARGS into a single string."
   (mapconcat 'eshell-stringify (eshell-flatten-list args) " "))
 
-;; the next two are from GNUS, and really should be made part of Emacs
-;; some day
-(defsubst eshell-time-less-p (t1 t2)
-  "Say whether time T1 is less than time T2."
-  (or (< (car t1) (car t2))
-      (and (= (car t1) (car t2))
-          (< (nth 1 t1) (nth 1 t2)))))
-
-(defsubst eshell-time-to-seconds (time)
-  "Convert TIME to a floating point number."
-  (+ (* (car time) 65536.0)
-     (cadr time)
-     (/ (or (car (cdr (cdr time))) 0) 1000000.0)))
-
 (defsubst eshell-directory-files (regexp &optional directory)
   "Return a list of files in the given DIRECTORY matching REGEXP."
   (directory-files (or directory default-directory)
@@ -468,7 +454,7 @@
   "Read the contents of /etc/passwd for user names."
   (if (or (not (symbol-value result-var))
          (not (symbol-value timestamp-var))
-         (eshell-time-less-p
+         (time-less-p
           (symbol-value timestamp-var)
           (nth 5 (file-attributes file))))
       (progn
@@ -522,7 +508,7 @@
   "Read the contents of /etc/passwd for user names."
   (if (or (not (symbol-value result-var))
          (not (symbol-value timestamp-var))
-         (eshell-time-less-p
+         (time-less-p
           (symbol-value timestamp-var)
           (nth 5 (file-attributes file))))
       (progn


reply via email to

[Prev in Thread] Current Thread [Next in Thread]