diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-07-15 00:00:25 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-07-15 00:00:25 -0400 |
commit | db06164f33ff5c3bcd879b94be4e0a07a5316cf0 (patch) | |
tree | 9ce37ee3ae06451b38499f96f8784fa924abd4f0 /lisp | |
parent | a32452281dcae6856b2f59f58c98e6be89f9d4f5 (diff) | |
download | emacs.d-db06164f33ff5c3bcd879b94be4e0a07a5316cf0.tar.gz |
Add km/org-remove-title-leader
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-org.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/init-org.el b/lisp/init-org.el index 276d6e1..594227d 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -83,6 +83,7 @@ 'km/org-tree-to-indirect-buffer-current-window) (define-key org-mode-map (kbd "C-c m w") 'km/org-refile-to-other-org-buffer) (define-key org-mode-map (kbd "C-c m s") 'km/org-sort-parent) + (define-key org-mode-map (kbd "C-c m l") 'km/org-remove-title-leader) ;; Override global `imenu' binding. (define-key org-mode-map (kbd "C-c j") 'org-goto) ;; Don't let `org-cycle-agenda-files' binding override custom @@ -155,6 +156,25 @@ under the current heading." (mapconcat 'identity heading-words " ")) nil)) +(defun km/org-remove-title-leader () + "Remove leader from Org heading title. + +Convert + + * TODO leader: Rest of title :tag: + +to + + * TODO Rest of title :tag:" + (interactive) + (save-excursion + (let ((regex (format "^%s\\(?:%s \\)?\\(.*: \\)\\w+" + org-outline-regexp org-todo-regexp))) + (org-back-to-heading) + (when (re-search-forward regex (point-at-eol) t) + (replace-match "" nil nil nil 2) + (org-set-tags nil t))))) + ;;; Org in other modes (defun km/load-orgstruct () (turn-on-orgstruct++) |