From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Riley Subject: Best way to implement project specific captures Date: Wed, 22 Aug 2012 04:00:17 +0100 Message-ID: Reply-To: emacs-orgmode@gnu.org Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T41BH-000702-Bh for emacs-orgmode@gnu.org; Tue, 21 Aug 2012 23:00:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T41BG-0004lC-Aw for emacs-orgmode@gnu.org; Tue, 21 Aug 2012 23:00:31 -0400 Received: from plane.gmane.org ([80.91.229.3]:56391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T41BG-0004jx-3S for emacs-orgmode@gnu.org; Tue, 21 Aug 2012 23:00:30 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1T41BF-0005Bd-Jx for emacs-orgmode@gnu.org; Wed, 22 Aug 2012 05:00:29 +0200 Received: from client-86-31-177-231.oxfd.adsl.virginmedia.com ([86.31.177.231]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Aug 2012 05:00:29 +0200 Received: from rileyrg by client-86-31-177-231.oxfd.adsl.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Aug 2012 05:00:29 +0200 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: emacs-orgmode@gnu.org Currently I maintain a datetree journal capture using a template so ,---- | ("j" "journal" entry (file+datetree "journal.org") | "* %?\n\t:PROPERTIES:\n\t:DateCreated: %T\n\t:Link: %a\n\t:END:\n") `---- I also use j rockways' eproject set up that allows a hook to be run when a file is opened inside a "project". e.g ,---- | (add-hook 'web-project-file-visit-hook '(lambda () | (ignore-errors | (message "Web Project : %s" eproject-root) | ))) `---- where "web-project" is created this:- ,---- | (define-project-type web (generic) | (look-for "plan.org") | :relevant-files ("\\.php$" "\\.js$" "\\.org$" "\\.sql$" "\\.css$" "authinfo" "vhost")) `---- So whenever I open a file in a directory hierarchy which contains a plan.org matching those types then my web-project-file-visit-hook is run. What is the best emacs/elisp approach to setting a capture file destination specific to a particular project? THe main point being that the default capture template above should only be replaced if I am actually in a "project" : any capture done in a file NOT contained within a project should default to the capture template above. Is it someting to do with buffer-locals perhaps or is there a better/alternative way? e.g Perhaps "journal.org" becomes a variable and this is overwritten (or whatever the elisp jargon is) in the project hook as a buffer local? Hope was clear! regards r.