emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Skip Collins <skip.collins@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>,
	Chris Henderson <henders254@gmail.com>
Subject: Re: Create sub-directories and files from within org
Date: Mon, 21 Oct 2013 21:10:31 -0400	[thread overview]
Message-ID: <CAJ51ETqafp+_Vu3UChZgCMwgXp8tO4OuzJTXQ5O-EWX2Nj-y_A@mail.gmail.com> (raw)
In-Reply-To: <CABUh-75C7BkM-EGbz8VAJJGJvNrB4gwk=J799157+ijSadyWMw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2184 bytes --]

You can do something like this:

#+BEGIN_SRC emacs-lisp
(defun make-project-dir-from-heading ()
  (interactive)
  (save-restriction
    (org-narrow-to-subtree)
    (let ((heading-title (nth 4 (org-heading-components))))
      (make-directory heading-title t)
      (goto-char (point-max))
      (insert (format "[[file:%s]]" heading-title)))))
#+END_SRC

* test-dir

some stuff

[[file:test-dir]]
* next-project


John

-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Mon, Oct 21, 2013 at 1:39 PM, Skip Collins <skip.collins@gmail.com>wrote:

> On Sun, Oct 20, 2013 at 12:58 PM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
> >
> > I don't understand what you are trying to do here. you could write a lisp
> > function that you run in the ** project name heading that creates a
> directory
> > by that name. But what would the txt files in that directory be?
>
> I requested something like this functionality some time ago but never
> found an answer. I create new projects in projects.org, via capture or
> direct editing. Each project is a top-level heading that may sometimes
> contain sub-headings, todos, etc. Most often it remains a simple
> top-level heading containing a drawer but no body or subheadings. It
> takes one of the following states: PROJ, DONE, CANCELED, or DORMANT. I
> have several agenda views that track active projects (i.e. not done,
> not canceled, and not dormant), and other tag attributes (personal,
> professional, ...). I use a set of optional tags to track where
> project data is kept: :org:, :computer:, :email:, :file:, :binder:,
> etc. Many projects have the :computer: tag and a corresponding folder
> on my hard drive with various file types stored there including txt,
> docx, org, pdf, jpeg, etc. I would very much like a way to quickly
> create that folder with the unique project name that I assign in the
> top-level heading. It would be super nice if this automagic folder
> creation feature also creates a link to the folder inside my
> projects.org file.
>

[-- Attachment #2: Type: text/html, Size: 2956 bytes --]

  reply	other threads:[~2013-10-22  1:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-19  2:35 Create sub-directories and files from within org Chris Henderson
2013-10-19  9:19 ` Synchronizing folder structure with heading structure (was: Create sub-directories and files from within org) Karl Voit
2013-10-20 16:58 ` Create sub-directories and files from within org John Kitchin
2013-10-21 17:39   ` Skip Collins
2013-10-22  1:10     ` John Kitchin [this message]
2013-10-22 12:11       ` Skip Collins
2013-10-24 23:37         ` John Kitchin

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=CAJ51ETqafp+_Vu3UChZgCMwgXp8tO4OuzJTXQ5O-EWX2Nj-y_A@mail.gmail.com \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=henders254@gmail.com \
    --cc=skip.collins@gmail.com \
    /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).