ソースを参照

Respect additional arguments to sorting functions

Without this patch, calls to the sorting functions from lisp did not
work as advertised.

* lisp/org-list.el (org-sort-list): Respect sorting-type and getkey-func when
they are specified in the call.

* lisp/org.el (org-sort-entries): Respect sorting-type and getkey-func when
they are specified in the call.
Carsten Dominik 12 年 前
コミット
651dfdfe33
2 ファイル変更17 行追加12 行削除
  1. 10 7
      lisp/org-list.el
  2. 7 5
      lisp/org.el

+ 10 - 7
lisp/org-list.el

@@ -2805,13 +2805,16 @@ COMPARE-FUNC to compare entries."
 	 (start (org-list-get-list-begin (point-at-bol) struct prevs))
 	 (end (org-list-get-list-end (point-at-bol) struct prevs))
 	 (sorting-type
-	  (progn
-	    (message
-	     "Sort plain list: [a]lpha  [n]umeric  [t]ime  [f]unc   A/N/T/F means reversed:")
-	    (read-char-exclusive)))
-	 (getkey-func (and (= (downcase sorting-type) ?f)
-			   (intern (org-icompleting-read "Sort using function: "
-							 obarray 'fboundp t nil nil)))))
+	  (or sorting-type
+	      (progn
+		(message
+		 "Sort plain list: [a]lpha  [n]umeric  [t]ime  [f]unc   A/N/T/F means reversed:")
+		(read-char-exclusive))))
+	 (getkey-func
+	  (or getkey-func
+	      (and (= (downcase sorting-type) ?f)
+		   (intern (org-icompleting-read "Sort using function: "
+						 obarray 'fboundp t nil nil))))))
     (message "Sorting items...")
     (save-restriction
       (narrow-to-region start end)

+ 7 - 5
lisp/org.el

@@ -8272,13 +8272,15 @@ WITH-CASE, the sorting considers case as well."
        what)
       (setq sorting-type (read-char-exclusive))
 
-      (and (= (downcase sorting-type) ?f)
-           (setq getkey-func
-                 (org-icompleting-read "Sort using function: "
-				       obarray 'fboundp t nil nil))
-           (setq getkey-func (intern getkey-func)))
+      (unless getkey-func
+	(and (= (downcase sorting-type) ?f)
+	     (setq getkey-func
+		   (org-icompleting-read "Sort using function: "
+					 obarray 'fboundp t nil nil))
+	     (setq getkey-func (intern getkey-func))))
 
       (and (= (downcase sorting-type) ?r)
+	   (not property)
            (setq property
                  (org-icompleting-read "Property: "
 				       (mapcar 'list (org-buffer-property-keys t))