From: Matt Lundin <mdl@imapmail.org>
To: Marcin Borkowski <mbork@wmi.amu.edu.pl>
Cc: Org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Seeking advice on structuring my org-mode file
Date: Wed, 22 May 2013 17:10:17 -0500 [thread overview]
Message-ID: <87y5b68y46.fsf@fastmail.fm> (raw)
In-Reply-To: <20130522204329.6532e03c@aga-netbook> (Marcin Borkowski's message of "Wed, 22 May 2013 20:43:29 +0200")
Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:
> I have an Org-mode file with notes concerning a large project connected
> with teaching at my university. One of the headlines is dedicated to
> one particular course, where I am part of a group developing a concept
> of this course. So, one subheadline is devoted to that. Yet another
> (subsub)headline is a list if my proposals of things that should be
> covered during that course, and now it needs 3 more levels down.
> Summing it up: I have 5 levels of headlines and now I need a sixth
> one. So, my question is: what are good practices of other Org-moders?
> Do you push such a monster to an external file and just include a link
> to it?
If a file grows to large, I simply create a new one. In this instance, I
would recommend creating a separate file for each course.
Below you'll find a very hackish helper function that I use to generate
a new file from a headline. It leaves a link to the new file in the
original location.
Best,
Matt
--8<---------------cut here---------------start------------->8---
(defun my-org-file-from-headline (file)
(interactive
(list
(completing-read "File: "
(mapcar 'file-name-nondirectory
(file-expand-wildcards "~/org/*.org"))
nil nil)))
(unless (string-match "\\.org$" file)
(error "Not an org file"))
(save-excursion
(beginning-of-line)
(unless (org-at-heading-p)
(error "Not on a headline")))
(let* ((exists (file-exists-p file))
(ftags (append
(list (file-name-sans-extension file))
(mapcar 'substring-no-properties org-file-tags)))
(headline (nth 4 (org-heading-components)))
(org-archive-reversed-order t)
(org-archive-location (concat file "::"))
(org-archive-save-context-info nil))
(org-archive-subtree)
(save-excursion (insert "* [[file:" file "][" file "]] - " headline "\n"))
(find-file file)
(goto-char (point-min))
(save-excursion
(if (re-search-forward "#\\+FILETAGS:\\(.*\\)$" nil t)
(progn
(save-match-data
(setq ftags
(mapconcat 'identity
(org-uniquify
(append ftags
(split-string
(substring-no-properties
(match-string 1))))) " ")))
(replace-match (concat "#+FILETAGS: " ftags)))
(insert "#+FILETAGS: " (mapconcat 'identity ftags " ") "\n"))
(goto-char (point-min))
(unless (re-search-forward "#\\+CATEGORY:\\(.*\\)$" nil t)
(insert "#+CATEGORY: " (file-name-sans-extension file) "\n"))
(goto-char (point-min))
(when (re-search-forward "^Archived entries from file.+\n" nil t)
(replace-match ""))))
(write-file file))
--8<---------------cut here---------------end--------------->8---
next prev parent reply other threads:[~2013-05-22 22:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-22 18:43 Seeking advice on structuring my org-mode file Marcin Borkowski
2013-05-22 22:10 ` Matt Lundin [this message]
2013-05-23 11:57 ` Julian M. Burgos
2013-05-26 9:49 ` Karl Voit
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=87y5b68y46.fsf@fastmail.fm \
--to=mdl@imapmail.org \
--cc=emacs-orgmode@gnu.org \
--cc=mbork@wmi.amu.edu.pl \
/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).