summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2012-10-09 08:27:17 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2012-10-09 08:27:17 +0200
commit651dfdfe33dca6b719c4c7dc23880fdd09e67b76 (patch)
treef0330375875d8626384d25af1d4039374b3cc11e
parent97956792999e3c58e4216355d5c9a7ac1cf40b7e (diff)
downloadorg-mode-651dfdfe33dca6b719c4c7dc23880fdd09e67b76.tar.gz
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.
-rw-r--r--lisp/org-list.el17
-rw-r--r--lisp/org.el12
2 files changed, 17 insertions, 12 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 10f5e6e..d97e8b4 100644
--- a/lisp/org-list.el
+++ b/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)
diff --git a/lisp/org.el b/lisp/org.el
index 7bfc18c..12b7703 100644
--- a/lisp/org.el
+++ b/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))