diff options
author | shoshin <shoshin@cicadas.surf> | 2022-07-04 15:12:28 -0500 |
---|---|---|
committer | shoshin <shoshin@cicadas.surf> | 2022-07-04 15:12:28 -0500 |
commit | 72088b763efbcc6d3e2f4c724917cd6a66754535 (patch) | |
tree | c2a4795a6876f0b8f3d6d575ec3c1e98e5cb50cd | |
parent | 50013edacf91a5c1b400b2310936e592b2b7598d (diff) |
Add: my-org-top-level-heading command
-rw-r--r-- | shoshin-config.el | 5 | ||||
-rw-r--r-- | shoshin-config.org | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/shoshin-config.el b/shoshin-config.el index 8bd307e..6fecaed 100644 --- a/shoshin-config.el +++ b/shoshin-config.el @@ -70,6 +70,11 @@ (package-install 'markdown-mode) +(defun my-org-top-level-heading () + (interactive) + (let ((moo 1)) + (while moo (setq moo (org-up-heading-safe))))) + (package-install 'htmlize) (recentf-mode) 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) |