0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 23:17:49 +00:00

org-sort: Call org-sort-* functions non-interactively

* lisp/org.el (org-sort): Use funcall instead of org-call-with-arg,
and make WITH-CASE an optional argument.
* lisp/org-table.el (org-table-sort-lines): Make WITH-CASE an optional
argument.
This commit is contained in:
Kyle Meyer 2017-05-08 11:13:19 -04:00
parent f4fca13598
commit c1addc8252
2 changed files with 6 additions and 7 deletions

View file

@ -1639,7 +1639,7 @@ In particular, this does handle wide and invisible characters."
dline -1 dline))))
;;;###autoload
(defun org-table-sort-lines (with-case &optional sorting-type getkey-func compare-func)
(defun org-table-sort-lines (&optional with-case sorting-type getkey-func compare-func)
"Sort table lines according to the column at point.
The position of point indicates the column to be used for

View file

@ -8845,15 +8845,14 @@ with the original repeater."
;;; Outline Sorting
(defun org-sort (with-case)
(defun org-sort (&optional with-case)
"Call `org-sort-entries', `org-table-sort-lines' or `org-sort-list'.
Optional argument WITH-CASE means sort case-sensitively."
(interactive "P")
(cond
((org-at-table-p) (org-call-with-arg 'org-table-sort-lines with-case))
((org-at-item-p) (org-call-with-arg 'org-sort-list with-case))
(t
(org-call-with-arg 'org-sort-entries with-case))))
(funcall (cond ((org-at-table-p) #'org-table-sort-lines)
((org-at-item-p) #'org-sort-list)
(t #'org-sort-entries))
with-case))
(defun org-sort-remove-invisible (s)
"Remove invisible part of links and emphasis markers from string S."