emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marvin Doyley <marvinpas@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Export each top level heading to separate file
Date: Sun, 5 Jan 2014 20:51:35 -0500	[thread overview]
Message-ID: <23F445D4-9C02-4BE6-BCB9-F0A8222F0FFE@gmail.com> (raw)

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	other threads:[~2014-01-06  1:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06  1:51 Marvin Doyley [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-01-04 22:29 Export each top level heading to separate file Ista Zahn
2014-01-04 22:45 ` Charles Millar
2014-01-04 23:41   ` Alan L Tyree
2014-01-05  0:36     ` Ista Zahn
2014-01-05  2:44       ` Alan L Tyree
2014-01-05 13:40       ` John Kitchin
2014-01-05 19:49         ` Ista Zahn
2014-01-05 21:56           ` John Kitchin
2014-01-06  0:55             ` Ista Zahn
2014-01-05 18:34     ` Charles Millar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23F445D4-9C02-4BE6-BCB9-F0A8222F0FFE@gmail.com \
    --to=marvinpas@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).