From 72088b763efbcc6d3e2f4c724917cd6a66754535 Mon Sep 17 00:00:00 2001 From: shoshin Date: Mon, 4 Jul 2022 15:12:28 -0500 Subject: Add: my-org-top-level-heading command --- shoshin-config.org | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'shoshin-config.org') diff --git a/shoshin-config.org b/shoshin-config.org index e9accc2..b67f689 100644 --- a/shoshin-config.org +++ b/shoshin-config.org @@ -397,6 +397,23 @@ config might get what i want with vanilla built ins. #+end_src ** org mode +*** jump to top level parent heading + +a friend was wanting this functionality, so i dug around in the org functions +to find one i could build a command out of: + +#+begin_src emacs-lisp + (defun my-org-top-level-heading () + (interactive) + (let ((moo 1)) + (while moo (setq moo (org-up-heading-safe))))) +#+end_src + +~org-up-heading-safe~ is designed not to throw an error and returns the level +of the headline found (as it goes up) or nil if no higher level is found. +this just uses a dumb while loop to call it until it returns nil, which should +get us where we are looking to go 😃 + *** exporting #+begin_src (require 'ox-md) -- cgit v1.2.3