From 89cc82061d49bf296b73bf0adfaa52d21d83833b Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Thu, 8 Jun 2023 19:17:14 +0200 Subject: [PATCH] fixed demoting and promoting with c-left|right --- lisp/init-org.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lisp/init-org.el b/lisp/init-org.el index 1926527..7e86d42 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -91,6 +91,21 @@ down and unfold it, otherwise jump paragraph as usual." (org-cycle)) (forward-paragraph))) + ;; TODO: implement c- to demote+promote again + (defun tvd-org-demote-heading() + "Demote heading if on a heading." + (interactive) + (if (org-at-heading-p) + (org-demote-subtree) + (call-interactively 'right-word))) + + (defun tvd-org-promote-heading() + "Promote heading if on a heading." + (interactive) + (if (org-at-heading-p) + (org-promote-subtree) + (call-interactively 'left-word))) + ;; org-mode specific config, after load (eval-after-load "org" '(progn @@ -177,7 +192,8 @@ down and unfold it, otherwise jump paragraph as usual." (local-set-key (kbd "") 'tvd-org-heading-down) ;; move word left or heading up, depending where point is - (local-set-key (kbd "") 'tvd-org-left-or-level-up) + (local-set-key (kbd "") 'tvd-org-demote-heading) + (local-set-key (kbd "") 'tvd-org-promote-heading) ;; use nicer bullets (when (fboundp 'org-bullets-mode)