emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Export each top level heading to separate file


From: Marvin Doyley
Subject: Re: [O] Export each top level heading to separate file
Date: Sun, 5 Jan 2014 20:51:35 -0500

This may help, but I can’t take the credit. Someone in this forum wrote this 
for me several years ago.

Cheers,
M

;; turn header into file
(defun turn-headline-into-org-mode-link ()
 "Replace word at point by an Org mode link."
 (interactive)
 (when (org-at-heading-p)
   (let ((hl-text (nth 4 (org-heading-components))))
     (unless (or (null hl-text)
                 (org-string-match-p "^[ \t]*:[^:]+:$" hl-text))
       (beginning-of-line)
       (search-forward hl-text (point-at-eol))
       (replace-string
        hl-text
        (format "[[file:%s.org][%s]]"
                (org-link-escape hl-text)
                (org-link-escape hl-text '((?\] . "%5D") (?\[ . "%5B"))))
        nil (- (point) (length hl-text)) (point))))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]