diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-05-11 01:37:47 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-05-11 01:39:44 -0400 |
commit | 5691bb18c78e8d2e5856b9b508fd8e9d830d2593 (patch) | |
tree | f384532a4a8e4cf9565db2707c6117077e47558e | |
parent | d24a9cd33dfc9b2ce8c78b83258207d4ec8bb8c7 (diff) | |
download | emacs.d-5691bb18c78e8d2e5856b9b508fd8e9d830d2593.tar.gz |
Add km/org-sort-heading-ignoring-articles
-rw-r--r-- | lisp/init-org.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/init-org.el b/lisp/init-org.el index 1c52630..86a051d 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -139,6 +139,20 @@ under the current heading." (goto-char (+ (org-find-exact-headline-in-buffer heading nil t) chars-after-heading)))) +(defun km/org-sort-heading-ignoring-articles () + "Sort alphabetically, but ignore any leading articles." + (if (looking-at org-complex-heading-regexp) + (let ((ignored-words '("a" "an" "the")) + heading heading-words) + (setq heading + (funcall 'downcase + (org-sort-remove-invisible (match-string 4)))) + (setq heading-words (split-string heading)) + (when (member (car heading-words) ignored-words) + (setq heading-words (cdr heading-words))) + (mapconcat 'identity heading-words " ")) + nil)) + ;;; Org in other modes (defun km/load-orgstruct () (turn-on-orgstruct++) |