瀏覽代碼

Tables: Allow sorting inactive time stamps.

Hsui-Khuern Tang writes:

   I have a table where one column consists of inactive dates, such as
   this:

     | Date             | OK? |
     |------------------+-----|
     | [2009-01-30 Fri] | x   |
     | [2009-01-27 Tue] | x   |
     | [2009-01-28 Wed] | x   |

   I can't sort the table by that column.  If I change the dates to
   active, then sorting (by time) works fine.  Is this behavior
   intentional?

Yes, intentional, because the same routine also does sorting of
entries and should prefer active time stamps.  However, I realize that
we can still look for an inactive time stamp when no active one can be
found.   This is what this commit implements.
Carsten Dominik 17 年之前
父節點
當前提交
5f68200625
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 3 0
      lisp/ChangeLog
  2. 2 1
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-02-06  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-do-sort): Also take an inactive timestamp if no
+	active one is found.
+
 	* org-colview-xemacs.el (org-columns-capture-view): Copy before
 	deleting duplicates.
 

+ 2 - 1
lisp/org.el

@@ -5889,7 +5889,8 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive."
      ((= dcst ?t)
       (setq extractfun
 	    (lambda (x)
-	      (if (string-match org-ts-regexp x)
+	      (if (or (string-match org-ts-regexp x)
+		      (string-match org-ts-regexp-both x))
 		  (time-to-seconds
 		   (org-time-string-to-time (match-string 0 x)))
 		0))