From cd6599799a55bcf65f9fde50d0c7b1eabb120c3b Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Mon, 26 Sep 2022 15:21:42 -0400 Subject: [PATCH] =?UTF-8?q?=CE=B1=20define=20first=20hydras=20for=20refili?= =?UTF-8?q?ng=20and=20moving?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (I am not 100% on these; there is some overlap with speed commands) --- global.org | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/global.org b/global.org index 5118335..5807785 100644 --- a/global.org +++ b/global.org @@ -1243,6 +1243,38 @@ (org-timestamp-down-day 7) (hydra-timestamp/hl-paren-force-fix)) "-1W"))) #+end_src +*** Hydras for refiling + This bit evolved from [[https://www.mollermara.com/blog/Fast-refiling-in-org-mode-with-hydras/][this post]]; see more at [[https://gist.github.com/mm--/60e0790bcbf8447160cc87a66dc949ab ][this gist]]. + #+begin_src emacs-lisp + (defun wilder/refile (file headline &optional arg) + (let ((pos (save-excursion + (find-file file) + (org-find-exact-headline-in-buffer headline)))) + (org-refile arg nil (list headline file nil pos))) + (switch-to-buffer (current-buffer))) + #+end_src +#+begin_src emacs-lisp + (defhydra wilder/hydra-org-refile (:foreign-keys run) + "Refile" + ("g" (wilder/refile "hack.org" "emacs") "Refile to Hack-emacs") + ("q" nil "cancel")) + (define-key org-mode-map (kbd "C-x \\") 'wilder/hydra-org-refile/body) +#+end_src +*** Hydras for moving headlines around +#+begin_src emacs-lisp + (defhydra wilder/hydra-org-move () + "Move subtree" + ("f" org-backward-heading-same-level "move up" :column "Movement") + ("s" org-forward-heading-same-level "move down") + ("r" outline-up-heading "level down") + ("n" org-promote-subtree "promote" :column "Bubbling") + ("l" org-demote-subtree "demote") + ("i" org-move-subtree-up "bubble up") + ("e" org-move-subtree-down "bubble down") + ("q" nil "cancel")) + (define-key org-mode-map (kbd "C-x SPC") 'wilder/hydra-org-move/body) +#+end_src + *** Capture Set default keybinding #+begin_src emacs-lisp