diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2014-10-28 18:42:51 -0700 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-07-26 23:25:11 -0400 |
commit | 217ad4aafbf7daeb1045efac4a5c80a8f97d553a (patch) | |
tree | cfb1474daab887779e6f315e9435fe1c89f0f672 | |
parent | 2e1bc42db828d11a63354c3c57eed34b7f59921f (diff) | |
download | org-mode-217ad4aafbf7daeb1045efac4a5c80a8f97d553a.tar.gz |
Backport commit 123ddec from Emacs master branch
* doc/org.texi (Dynamic blocks):
* lisp/org-archive.el (org-archive-subtree)
(org-archive-to-archive-sibling):
* lisp/org-clock.el (org-resolve-clocks, org-clock-get-sum-start)
(org-clock-special-range):
* lisp/org-timer.el (org-timer-seconds):
* lisp/org.el (org-read-date-analyze, org-get-cursor-date):
* lisp/ox-html.el (org-html-format-spec):
* lisp/ox-icalendar.el (org-icalendar--vtodo):
Omit unnecessary call to current-time.
* lisp/org.el (org-get-cursor-date):
Don't call current-time twice to get the current time stamp,
as this can lead to inconsistent results.
* lisp/org-compat.el (org-float-time):
Simplify to an alias because time-to-seconds now behaves like float-time
with respect to nil arg.
* lisp/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy
conversion from floating point to Emacs time and back.
(org-resolve-clocks): Prefer two-argument floor.
Simplify use of current-time and friends.
123ddec7f807f4bd7400bbbe08219afb02269c00
Paul Eggert
Tue Oct 28 18:42:51 2014 -0700
-rw-r--r-- | doc/org.texi | 4 | ||||
-rw-r--r-- | lisp/org-archive.el | 6 | ||||
-rw-r--r-- | lisp/org-clock.el | 16 | ||||
-rw-r--r-- | lisp/org-compat.el | 8 | ||||
-rw-r--r-- | lisp/org-timer.el | 4 | ||||
-rw-r--r-- | lisp/org.el | 9 | ||||
-rw-r--r-- | lisp/ox-html.el | 3 | ||||
-rw-r--r-- | lisp/ox-icalendar.el | 2 |
8 files changed, 23 insertions, 29 deletions
diff --git a/doc/org.texi b/doc/org.texi index 5f248e9..ea91df3 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -13124,7 +13124,7 @@ Here is a thorough example, taken from @inforef{GNU Sample Texts,,texinfo}. #+TEXINFO_PRINTED_TITLE: GNU Sample #+SUBTITLE: for version 2.0, last updated 4 March 2014 -* Copying +* Copying :PROPERTIES: :COPYING: t :END: @@ -17536,7 +17536,7 @@ The corresponding block writer function could look like this: (defun org-dblock-write:block-update-time (params) (let ((fmt (or (plist-get params :format) "%d. %m. %Y"))) (insert "Last block update at: " - (format-time-string fmt (current-time))))) + (format-time-string fmt)))) @end lisp If you want to make sure that all dynamic blocks are always up-to-date, diff --git a/lisp/org-archive.el b/lisp/org-archive.el index 6deac47..87471a9 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -231,8 +231,7 @@ this heading." (error "No file associated to buffer")))) (olpath (mapconcat 'identity (org-get-outline-path) "/")) (time (format-time-string - (substring (cdr org-time-stamp-formats) 1 -1) - (current-time))) + (substring (cdr org-time-stamp-formats) 1 -1))) category todo priority ltags itags atags ;; end of variables that will be used for saving context location afile heading buffer level newfile-p infile-p visiting @@ -441,8 +440,7 @@ sibling does not exist, it will be created at the end of the subtree." (org-set-property "ARCHIVE_TIME" (format-time-string - (substring (cdr org-time-stamp-formats) 1 -1) - (current-time))) + (substring (cdr org-time-stamp-formats) 1 -1))) (outline-up-heading 1 t) (hide-subtree) (org-cycle-show-empty-lines 'folded) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index a772f03..e8fabab 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1046,9 +1046,9 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling (lambda (clock) (format "Dangling clock started %d mins ago" - (floor - (/ (- (org-float-time (current-time)) - (org-float-time (cdr clock))) 60)))))) + (floor (- (org-float-time) + (org-float-time (cdr clock))) + 60))))) (or last-valid (cdr clock))))))))))) @@ -1370,7 +1370,7 @@ decides which time to use." (current-time)) ((equal cmt "today") (setq org--msg-extra "showing today's task time.") - (let* ((dt (decode-time (current-time)))) + (let* ((dt (decode-time))) (setq dt (append (list 0 0 0) (nthcdr 3 dt))) (if org-extend-today-until (setf (nth 2 dt) org-extend-today-until)) @@ -2031,7 +2031,7 @@ If MSTART is non-nil, use this number to specify the starting day of a month (1 is the first day of the month). If you can combine both, the month starting day will have priority." (if (integerp key) (setq key (intern (number-to-string key)))) - (let* ((tm (decode-time (or time (current-time)))) + (let* ((tm (decode-time time)) (s 0) (m (nth 1 tm)) (h (nth 2 tm)) (d (nth 3 tm)) (month (nth 4 tm)) (y (nth 5 tm)) (dow (nth 6 tm)) @@ -2672,10 +2672,8 @@ TIME: The sum of all time spend in this tree, in minutes. This time (when (and te (listp te)) (setq te (format "%4d-%02d-%02d" (nth 2 te) (car te) (nth 1 te)))) ;; Now the times are strings we can parse. - (if ts (setq ts (org-float-time - (seconds-to-time (org-matcher-time ts))))) - (if te (setq te (org-float-time - (seconds-to-time (org-matcher-time te))))) + (if ts (setq ts (org-matcher-time ts))) + (if te (setq te (org-matcher-time te))) (save-excursion (org-clock-sum ts te (unless (null matcher) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 90380a8..7a22fcf 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -411,12 +411,10 @@ Pass BUFFER to the XEmacs version of `move-to-column'." (when focus-follows-mouse (set-mouse-position frame (1- (frame-width frame)) 0))))) -(defun org-float-time (&optional time) +(defalias 'org-float-time + (if (featurep 'xemacs) 'time-to-seconds 'float-time) "Convert time value TIME to a floating point number. -TIME defaults to the current time." - (if (featurep 'xemacs) - (time-to-seconds (or time (current-time))) - (float-time time))) +TIME defaults to the current time.") ;; `user-error' is only available from 24.2.50 on (unless (fboundp 'user-error) diff --git a/lisp/org-timer.el b/lisp/org-timer.el index 8161699..b22db7b 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -195,8 +195,8 @@ it in the buffer." (defun org-timer-seconds () (if org-timer-timer-is-countdown (- (org-float-time org-timer-start-time) - (org-float-time (current-time))) - (- (org-float-time (or org-timer-pause-time (current-time))) + (org-float-time)) + (- (org-float-time org-timer-pause-time) (org-float-time org-timer-start-time)))) ;;;###autoload diff --git a/lisp/org.el b/lisp/org.el index 4636830..4749e94 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16494,7 +16494,7 @@ user." (defun org-read-date-analyze (ans org-def org-defdecode) "Analyze the combined answer of the date prompt." ;; FIXME: cleanup and comment - (let ((nowdecode (decode-time (current-time))) + (let ((nowdecode (decode-time)) delta deltan deltaw deltadef year month day hour minute second wday pm h2 m2 tl wday1 iso-year iso-weekday iso-week iso-year iso-date futurep kill-year) @@ -16652,7 +16652,7 @@ user." (deltan (setq futurep nil) (unless deltadef - (let ((now (decode-time (current-time)))) + (let ((now (decode-time))) (setq day (nth 3 now) month (nth 4 now) year (nth 5 now)))) (cond ((member deltaw '("d" "")) (setq day (+ day deltan))) ((equal deltaw "w") (setq day (+ day (* 7 deltan)))) @@ -22066,8 +22066,9 @@ the agenda) or the current time of the day." (when (and tp (string-match "\\([0-9][0-9]\\):\\([0-9][0-9]\\)" tp)) (setq hod (string-to-number (match-string 1 tp)) mod (string-to-number (match-string 2 tp)))) - (or tp (setq hod (nth 2 (decode-time (current-time))) - mod (nth 1 (decode-time (current-time)))))) + (or tp (let ((now (decode-time))) + (setq hod (nth 2 now) + mod (nth 1 now))))) (cond ((eq major-mode 'calendar-mode) (setq date (calendar-cursor-to-date) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 23498b2..b6a3a7e 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1630,8 +1630,7 @@ used in the preamble or postamble." (?c . ,(plist-get info :creator)) (?C . ,(let ((file (plist-get info :input-file))) (format-time-string org-html-metadata-timestamp-format - (if file (nth 5 (file-attributes file)) - (current-time))))) + (if file (nth 5 (file-attributes file)))))) (?v . ,(or org-html-validation-link "")))) (defun org-html--build-pre/postamble (type info) diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index cd48bbf..38bdcf9 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -678,7 +678,7 @@ Return VTODO component as a string." (org-element-property :scheduled entry)) ;; If we can't use a scheduled time for some ;; reason, start task now. - (let ((now (decode-time (current-time)))) + (let ((now (decode-time))) (list 'timestamp (list :type 'active :minute-start (nth 1 now) |