comparison lisp/eshell/em-unix.el @ 111456:646142bd4c38

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.
author Glenn Morris <rgm@gnu.org>
date Tue, 09 Nov 2010 19:57:32 -0800
parents f21190964294
children 417b1e4d63cd
comparison
equal deleted inserted replaced
111455:f21190964294 111456:646142bd4c38
910 "total\n")))))))) 910 "total\n"))))))))
911 911
912 (defvar eshell-time-start nil) 912 (defvar eshell-time-start nil)
913 913
914 (defun eshell-show-elapsed-time () 914 (defun eshell-show-elapsed-time ()
915 (let ((elapsed (format "%.3f secs\n" 915 (let ((elapsed (format "%.3f secs\n" (- (float-time) eshell-time-start))))
916 (- (eshell-time-to-seconds (current-time))
917 eshell-time-start))))
918 (set-text-properties 0 (length elapsed) '(face bold) elapsed) 916 (set-text-properties 0 (length elapsed) '(face bold) elapsed)
919 (eshell-interactive-print elapsed)) 917 (eshell-interactive-print elapsed))
920 (remove-hook 'eshell-post-command-hook 'eshell-show-elapsed-time t)) 918 (remove-hook 'eshell-post-command-hook 'eshell-show-elapsed-time t))
921 919
922 (defun eshell/time (&rest args) 920 (defun eshell/time (&rest args)
938 '((?h "help" nil nil "show this usage screen") 936 '((?h "help" nil nil "show this usage screen")
939 :external "time" 937 :external "time"
940 :show-usage 938 :show-usage
941 :usage "COMMAND... 939 :usage "COMMAND...
942 Show wall-clock time elapsed during execution of COMMAND.") 940 Show wall-clock time elapsed during execution of COMMAND.")
943 (setq eshell-time-start (eshell-time-to-seconds (current-time))) 941 (setq eshell-time-start (float-time))
944 (add-hook 'eshell-post-command-hook 'eshell-show-elapsed-time nil t) 942 (add-hook 'eshell-post-command-hook 'eshell-show-elapsed-time nil t)
945 ;; after setting 943 ;; after setting
946 (throw 'eshell-replace-command 944 (throw 'eshell-replace-command
947 (eshell-parse-command (car time-args) 945 (eshell-parse-command (car time-args)
948 ;;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-08/msg00205.html 946 ;;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-08/msg00205.html