Post AdZXEDRuI9YB4i2URE by nickanderson@fosstodon.org
(DIR) More posts by nickanderson@fosstodon.org
(DIR) Post #AdZJ5oAR0STmzQxmq0 by mms@emacs.ch
2024-01-06T12:03:31Z
0 likes, 0 repeats
#org-mode how can I force export for a single file to default to "nearest level 2 heading"? I always want to export current tree but only up to level 2.
(DIR) Post #AdZXEDRuI9YB4i2URE by nickanderson@fosstodon.org
2024-01-06T14:41:55Z
0 likes, 0 repeats
@mms I jump to the headline for where I want to export, narrow to subtree and then export.
(DIR) Post #AdZZmL6yVeAiareCwq by mms@emacs.ch
2024-01-06T15:10:30Z
0 likes, 0 repeats
@nickanderson this what I’m doing but I guess there is a better way. It’s emacs after all :-)
(DIR) Post #AdZgOWYwywCkq1K8lE by sachac@emacs.ch
2024-01-06T16:24:32Z
0 likes, 0 repeats
@mms Do you always want to export to a specific format or do you want the dispatch menu?
(DIR) Post #AdZhFVPI0fMmbL4JH6 by sachac@emacs.ch
2024-01-06T16:34:05Z
0 likes, 0 repeats
@mms This might be useful:(defun my-export-level-2 ()(interactive)(when (< (org-current-level) 2)(user-error "Need to be in level 2 heading or lower."))(save-restriction(save-excursion(widen)(org-up-heading-all (- (org-current-level) 2))(narrow-to-region (point) (org-end-of-subtree))(org-export-dispatch))))
(DIR) Post #AdZkiL2puluuix0SYa by sachac@emacs.ch
2024-01-06T16:41:11Z
0 likes, 1 repeats
@mms This one should pass the prefix arg along:```(defun my-export-level-2 (&optional arg) (interactive "P")(when (< (org-current-level) 2)(user-error "Need to be in level 2 heading or lower."))(save-restriction(save-excursion(widen)(org-up-heading-all (- (org-current-level) 2))(narrow-to-region (point) (org-end-of-subtree))(org-export-dispatch arg))))```
(DIR) Post #AdZkjEKSMxgwBWfo9o by mms@emacs.ch
2024-01-06T17:13:08Z
0 likes, 0 repeats
@sachac wow, thanks!