From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Rose Subject: Re: Org-jekyll - org-publish-initialize-files-alist Date: Wed, 30 Jun 2010 21:04:28 +0200 Message-ID: <8763105olf.fsf@gmx.de> References: <87bpas7ngq.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=43975 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OU2ao-0006kA-Nf for emacs-orgmode@gnu.org; Wed, 30 Jun 2010 15:05:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OU2a8-0002ZA-16 for emacs-orgmode@gnu.org; Wed, 30 Jun 2010 15:04:25 -0400 Received: from mail.gmx.net ([213.165.64.20]:33133) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OU2a7-0002Yn-Il for emacs-orgmode@gnu.org; Wed, 30 Jun 2010 15:04:23 -0400 In-Reply-To: (Nathan Neff's message of "Wed, 30 Jun 2010 09:27:41 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nathan Neff Cc: emacs-orgmode Nathan Neff writes: > ... > Below is the code where org-publish-initialize-files-alist is called > in org-jekyll. > It looks like in both cases, the code is trying to figure out what > project the current > file belongs to. Can anyone suggest a fix? I don't mean to push this > on anyone, but I really don't know lisp that well. > ... > (defun org-jekyll-export-current-entry () > (interactive) > (save-excursion > (org-publish-initialize-files-alist) ; <----------------here > (let ((project-name (cdr (assoc (expand-file-name (buffer-file-name)) > org-publish-files-alist)))) > (org-back-to-heading t) > (org-jekyll-export-entry project-name)))) I suppose `project-name' shall be the name of the project, i.e. a string? ;; Evtl. needed to keep compiler happy: (declare-function org-publish-get-project-from-filename "org-publish" (filename &optional up)) (defun org-jekyll-export-current-entry () (interactive) (save-excursion (let ((project-name (org-publish-get-project-from-filename buffer-file-name))) (org-back-to-heading t) (org-jekyll-export-entry project-name)))) > (defun org-jekyll-export-blog () > "Export all entries in project files that have a :blog: keyword > and an :on: datestamp. Property drawers are exported as > front-matters, outline entry title is the exported document > title. " > (interactive) > (save-excursion > (org-publish-initialize-files-alist) ;; < -------------- here > (setq org-jekyll-new-buffers nil) > (mapc > (lambda (jfile-project) > (let ((jfile (car jfile-project)) > (project (cdr jfile-project))) > (if (string= (file-name-extension jfile) "org") > (with-current-buffer (org-get-jekyll-file-buffer jfile) > (org-map-entries (lambda () (org-jekyll-export-entry project)) > "blog|BLOG"))))) > (org-publish-get-files (org-publish-expand-projects > (list (org-publish-get-project-from-filename > (buffer-file-name) 'up))))) > (org-release-buffers org-jekyll-new-buffers))) (defun org-jekyll-export-blog () "Export all entries in project files that have a :blog: keyword and an :on: datestamp. Property drawers are exported as front-matters, outline entry title is the exported document title. " (interactive) (save-excursion (setq org-jekyll-new-buffers nil) (mapc (lambda (jfile-project) (let ((jfile (car jfile-project)) (project (cdr jfile-project))) (if (string= (file-name-extension jfile) "org") (with-current-buffer (org-get-jekyll-file-buffer jfile) (org-map-entries (lambda () (org-jekyll-export-entry project)) "blog|BLOG"))))) ;; NOT SURE IF THIS WILL WORK HERE: (org-publish-get-base-files (list (org-publish-get-project-from-filename (buffer-file-name) 'up)))) (org-release-buffers org-jekyll-new-buffers))) HTH Sebastian