1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-14 09:39:21 +00:00

Fix bug with time sorting

This commit is contained in:
Carsten Dominik 2009-05-25 15:55:59 +02:00
parent 3ee470daa1
commit 1cd03213f5

View File

@ -6213,7 +6213,7 @@ WITH-CASE, the sorting considers case as well."
(if plain-list-p (if plain-list-p
"Sort %s: [a]lpha [n]umeric [t]ime [f]unc A/N/T/F means reversed:" "Sort %s: [a]lpha [n]umeric [t]ime [f]unc A/N/T/F means reversed:"
"Sort %s: [a]lpha [n]umeric [p]riority p[r]operty todo[o]rder [f]unc "Sort %s: [a]lpha [n]umeric [p]riority p[r]operty todo[o]rder [f]unc
[t]ime [s ]cheduled [d]eadline [c]reated [t]ime [s]cheduled [d]eadline [c]reated
A/N/T/S/D/C/P/O/F means reversed:") A/N/T/S/D/C/P/O/F means reversed:")
what) what)
(setq sorting-type (read-char-exclusive)) (setq sorting-type (read-char-exclusive))
@ -6274,8 +6274,7 @@ WITH-CASE, the sorting considers case as well."
(if (or (re-search-forward org-ts-regexp (point-at-eol) t) (if (or (re-search-forward org-ts-regexp (point-at-eol) t)
(re-search-forward org-ts-regexp-both (re-search-forward org-ts-regexp-both
(point-at-eol) t)) (point-at-eol) t))
(time-to-seconds (org-time-string-to-seconds (match-string 0))
(org-time-string-to-time (match-string 0)))
(time-to-seconds now))) (time-to-seconds now)))
((= dcst ?f) ((= dcst ?f)
(if getkey-func (if getkey-func
@ -6299,26 +6298,25 @@ WITH-CASE, the sorting considers case as well."
(let ((end (save-excursion (outline-next-heading) (point)))) (let ((end (save-excursion (outline-next-heading) (point))))
(if (or (re-search-forward org-ts-regexp end t) (if (or (re-search-forward org-ts-regexp end t)
(re-search-forward org-ts-regexp-both end t)) (re-search-forward org-ts-regexp-both end t))
(org-time-string-to-time (match-string 0)) (org-time-string-to-seconds (match-string 0))
(org-time-string-to-time now)))) (time-to-seconds now))))
((= dcst ?c) ((= dcst ?c)
(let ((end (save-excursion (outline-next-heading) (point)))) (let ((end (save-excursion (outline-next-heading) (point))))
(if (re-search-forward (if (re-search-forward
(concat "^[ \t]*\\[" org-ts-regexp1 "\\]") (concat "^[ \t]*\\[" org-ts-regexp1 "\\]")
end t) end t)
(time-to-seconds (org-time-string-to-time (org-time-string-to-seconds (match-string 0))
(match-string 0)))
(time-to-seconds now)))) (time-to-seconds now))))
((= dcst ?s) ((= dcst ?s)
(let ((end (save-excursion (outline-next-heading) (point)))) (let ((end (save-excursion (outline-next-heading) (point))))
(if (re-search-forward org-scheduled-time-regexp end t) (if (re-search-forward org-scheduled-time-regexp end t)
(org-time-string-to-time (match-string 1)) (org-time-string-to-seconds (match-string 1))
(org-time-string-to-time now)))) (time-to-seconds now))))
((= dcst ?d) ((= dcst ?d)
(let ((end (save-excursion (outline-next-heading) (point)))) (let ((end (save-excursion (outline-next-heading) (point))))
(if (re-search-forward org-deadline-time-regexp end t) (if (re-search-forward org-deadline-time-regexp end t)
(org-time-string-to-time (match-string 1)) (org-time-string-to-seconds (match-string 1))
(org-time-string-to-time now)))) (time-to-seconds now))))
((= dcst ?p) ((= dcst ?p)
(if (re-search-forward org-priority-regexp (point-at-eol) t) (if (re-search-forward org-priority-regexp (point-at-eol) t)
(string-to-char (match-string 2)) (string-to-char (match-string 2))
@ -12789,6 +12787,8 @@ days in order to avoid rounding problems."
(defun org-time-string-to-time (s) (defun org-time-string-to-time (s)
(apply 'encode-time (org-parse-time-string s))) (apply 'encode-time (org-parse-time-string s)))
(defun org-time-string-to-seconds (s)
(time-to-seconds (org-time-string-to-time s)))
(defun org-time-string-to-absolute (s &optional daynr prefer show-all) (defun org-time-string-to-absolute (s &optional daynr prefer show-all)
"Convert a time stamp to an absolute day number. "Convert a time stamp to an absolute day number.