From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Create sub-directories and files from within org Date: Mon, 21 Oct 2013 21:10:31 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bd90ede27c4d104e94a1137 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYQUV-00074z-FQ for emacs-orgmode@gnu.org; Mon, 21 Oct 2013 21:10:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VYQUT-0001t5-14 for emacs-orgmode@gnu.org; Mon, 21 Oct 2013 21:10:35 -0400 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:63370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYQUS-0001sx-Ka for emacs-orgmode@gnu.org; Mon, 21 Oct 2013 21:10:32 -0400 Received: by mail-pa0-f52.google.com with SMTP id kl14so8917724pab.11 for ; Mon, 21 Oct 2013 18:10:31 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Skip Collins Cc: "emacs-orgmode@gnu.org" , Chris Henderson --047d7bd90ede27c4d104e94a1137 Content-Type: text/plain; charset=ISO-8859-1 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 wrote: > On Sun, Oct 20, 2013 at 12:58 PM, John Kitchin > 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. > --047d7bd90ede27c4d104e94a1137 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
You can do something like this:

#+BEGIN_= SRC emacs-lisp
(defun make-project-dir-from-heading ()
=A0 (interacti= ve)
=A0 (save-restriction
=A0=A0=A0 (org-narrow-to-subtree)
=A0=A0= =A0 (let ((heading-title (nth 4 (org-heading-components))))
=A0=A0=A0=A0=A0 (make-directory heading-title t)
=A0=A0=A0=A0=A0 (goto-c= har (point-max))
=A0=A0=A0=A0=A0 (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

<= /div>

On Mon, Oct 21, 2013 at 1:39 PM, Skip Co= llins <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 di= rectory
> 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.

--047d7bd90ede27c4d104e94a1137--