From mboxrd@z Thu Jan 1 00:00:00 1970 From: Justin Gordon Subject: Advice on cleaning (DRYing) up my publishing list (revised) Date: Fri, 3 Jan 2014 00:04:23 -1000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01229a060c267d04ef0e0a27 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vz1cU-0007IY-Ss for emacs-orgmode@gnu.org; Fri, 03 Jan 2014 05:04:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vz1cS-0001Zj-Ts for emacs-orgmode@gnu.org; Fri, 03 Jan 2014 05:04:46 -0500 Received: from mail-oa0-x234.google.com ([2607:f8b0:4003:c02::234]:45816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vz1cS-0001Ze-KM for emacs-orgmode@gnu.org; Fri, 03 Jan 2014 05:04:44 -0500 Received: by mail-oa0-f52.google.com with SMTP id h16so15988243oag.11 for ; Fri, 03 Jan 2014 02:04:44 -0800 (PST) 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, Yoshinari Nomura --089e01229a060c267d04ef0e0a27 Content-Type: text/plain; charset=ISO-8859-1 (prior version had error in unwrapping lists) Lisp gurus, here is my feeble attempt at DRYing out my org-publish-project-alist. I'm setting up an octopress publishing system for several blogs, so my list might grow and I'd like to avoid duplication * Please advise on how I may make this cleaner and clearer. Original is at bottom. * And is there a better way than using the publishing settings for things like with-toc? * Does recursive still work for 8.2? * Would this be better done with some sort of macros? Thanks so much in advance! (setq my-common-octopress-settings '(:base-extension "org" :with-toc nil :with-sub-superscript nil :recursive t :publishing-function org-jekyll-publish-to-html :headline-levels 4 :body-only t)) (setq my-static-directories '("about" "meta" "tips")) (setq my-base-directory "~/a/railsonmaui-octopress/source") (defun my-create-octopress-static (prj base-directory) (let* ( (base-dir (concat base-directory "/" prj)) (prj-list (append (list :base-directory base-dir :publishing-directory base-dir) my-common-octopress-settings)) ) (cons prj prj-list))) (setq my-var (mapcar '(lambda (prj) (my-create-octopress-static prj my-base-directory)) my-static-directories)) (setq org-publish-project-alist (append (list ;; blog articles (cons "blog-org" (append '(:base-directory "~/a/railsonmaui-octopress/source/org_posts/" :base-extension "org" :publishing-directory "~/a/railsonmaui-octopress/source/_posts/") my-common-octopress-settings)) (cons "blog-extra" '(:base-directory "~/a/railsonmaui-octopress/source/org_posts/" :publishing-directory "~/a/railsonmaui-octopress/source/" :base-extension "css\\|pdf\\|png\\|jpg\\|gif\\|svg" :publishing-function org-publish-attachment :recursive t :author nil )) ;; all together (cons "blog" '(:components ("blog-org" "blog-extra about meta tips"))) ) (mapcar '(lambda (prj) (my-create-octopress-static prj my-base-directory)) my-static-directories) )) ORIGINAL (setq org-publish-project-alist '( ("blog-org" . (:base-directory "~/a/octopress/source/org_posts/" :base-extension "org" :publishing-directory "~/a/octopress/source/_posts/" :table-of-contents nil :sub-superscript nil :recursive t :publishing-function org-publish-org-to-octopress :headline-levels 4 :html-extension "markdown" :octopress-extension "markdown" :body-only t)) ("blog-extra" . (:base-directory "~/a/octopress/source/org_posts/" :publishing-directory "~/a/octopress/source/" :base-extension "css\\|pdf\\|png\\|jpg\\|gif\\|svg" :publishing-function org-publish-attachment :recursive t :author nil )) ("about" . (:base-directory "~/a/octopress/source/about/" :base-extension "org" :publishing-directory "~/a/octopress/source/about/" :sub-superscript nil :table-of-contents nil :recursive t :publishing-function org-publish-org-to-octopress :headline-levels 4 :html-extension "markdown" :octopress-extension "markdown" :body-only t)) ("meta" . (:base-directory "~/a/octopress/source/meta/" :base-extension "org" :publishing-directory "~/a/octopress/source/meta/" :sub-superscript nil :table-of-contents nil :recursive t :publishing-function org-publish-org-to-octopress :headline-levels 4 :html-extension "markdown" :octopress-extension "markdown" :body-only t)) ("tips" . (:base-directory "~/a/octopress/source/tips/" :base-extension "org" :publishing-directory "~/a/octopress/source/tips/" :sub-superscript nil :table-of-contents nil :recursive t :publishing-function org-publish-org-to-octopress :headline-levels 4 :html-extension "markdown" :octopress-extension "markdown" :body-only t)) ("blog" . (:components ("blog-org" "blog-extra about"))) )) -- Justin Gordon | 808-877-6461 | m: 808-281-7272 www.railsonmaui.com | twitter: @railsonmaui | sugarranchmaui.com | Sugar Ranch Blog --089e01229a060c267d04ef0e0a27 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
(prior version had error in unwrapping lists)

Lisp gurus, here is my feeble attempt at DRYing out = my org-publish-project-alist.=A0

I'm setti= ng up an octopress publishing system for several blogs, so my list might gr= ow and I'd like to avoid duplication

* Please advise on how I may make this cleaner and clea= rer. Original is at bottom.
* And is there a better way than = using the publishing settings for things like with-toc?
* Does recursive still work for 8.2?
* Would this be better done with some sort of macros?

Thanks so much in advance!=A0


(setq my-common-octopress-settings
=A0 =A0 =A0 '= ;(:base-extension "org"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :with-toc nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :with-sub-superscript nil= =A0
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :recursive t<= /div>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :publishing-funct= ion org-jekyll-publish-to-html
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :headline-levels 4
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :body-only t))
=

(setq my-static-directories '("abou= t" "meta" "tips"))
(setq my-base-directory "~/a/railsonmaui-octopress/source")<= /div>

(defun my-create-octopress-static (prj base-direct= ory)
=A0 =A0 =A0 =A0 =A0(let* (
=A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 (base-dir (concat base-directory "/" prj))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (prj-list (append (list :base-director= y base-dir
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :publishing-directory base-dir)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 my-common-oc= topress-settings))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 )
=A0 =A0 =A0 =A0 =A0 =A0(co= ns prj prj-list)))

(setq my-var (mapcar '(lamb= da (prj)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (my-crea= te-octopress-static prj my-base-directory))
=A0 =A0 =A0 =A0 my-static-directories))

= (setq org-publish-project-alist
=A0 =A0 =A0 (append (list
=A0 =A0 =A0 =A0 ;; blog articles
=A0 =A0 =A0 =A0 (cons "b= log-org" =A0(append '(:base-directory "~/a/railsonmaui-octopr= ess/source/org_posts/"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0:base-extension "org"
= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0:publishing-directory "~/a/railsonmaui-octopre= ss/source/_posts/")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0my-comm= on-octopress-settings))
=A0 =A0 =A0 =A0 (cons "blog-extra&qu= ot; '(:base-directory "~/a/railsonmaui-octopress/source/org_posts/= "
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0:publishing-directory "~/a/railsonmaui-octo= press/source/"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0:base-extension "css\\|pdf\\|png\\|jpg\\|gif\\|svg"= ;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0:publishing-function org-publish-attachment
= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0:recursive t
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0:author nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0))
=A0 =A0 =A0 =A0= ;; all together
=A0 =A0 =A0 =A0 (cons "blog" '(:co= mponents ("blog-org" "blog-extra about meta tips")))
=A0 =A0 =A0 =A0 )
=A0 =A0 =A0 =A0 (mapcar '(lambda (prj)=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (my-create-octop= ress-static prj my-base-directory))
=A0 =A0 =A0 =A0 my-static-dir= ectories)
=A0 =A0 =A0 ))





=
ORIGINAL
(setq org-publish-project-alist
=A0 =A0 =A0 '(
=A0 =A0 =A0 =A0 ("blog-org" . =A0(= :base-directory "~/a/octopress/source/org_posts/"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :base-extension "org"
=A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :publishing-dir= ectory "~/a/octopress/source/_posts/"
=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :table-of-c= ontents nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :sub-superscript nil=A0
=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :recursive t
= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 :publishing-function org-publish-org-to-octopress
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :headline-levels 4
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :html-extension "markd= own"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 :octopress-extension "markdown"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :body-only t))
=A0 =A0 =A0 =A0 ("blog-extra"= ; . (:base-directory "~/a/octopress/source/org_posts/"
= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0:publishing-directory "~/a/octopress/source/"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0:base-extension "css\\|pdf\\|png\\|jpg\\|gif\\|svg"= ;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0:publishing-function org-publish-attachment
= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0:recursive t
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0:author nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0))
=A0 =A0 =A0 =A0= ("about" . =A0(:base-directory "~/a/octopress/source/about/= "
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 :base-extension "org"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :publishing-directory "~/a/octopress/source/about/"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 :sub-superscript nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :table-of-contents nil<= /div>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :recursive t
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :publishing-function org-publish-or= g-to-octopress
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :headline-levels 4
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :html-extension "markdown"
=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :octopress-= extension "markdown"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :body-only t))
=A0 =A0 =A0 =A0 ("meta" . =A0(:base-directory "~/a/octo= press/source/meta/"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :base-extension "org"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :publishing-directory "~/a/octopress/source/meta/"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :sub-superscript nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :table-of-contents nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :recursive t
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :publishing-function org-publish-or= g-to-octopress
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :headline-levels 4
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :html-extension "markd= own"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 :octopress-extension "markdown"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :body-only t))
=A0 =A0 =A0 =A0 ("tips" . = =A0(:base-directory "~/a/octopress/source/tips/"
=A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= :base-extension "org"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :publishing-directory "~/a/octopress/source/tips/"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 :sub-superscript nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :table-of-contents nil
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :recursive t
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :publishing-function org-publish-or= g-to-octopress
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :headline-levels 4
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 :html-extension "markdown"
=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :octopress-= extension "markdown"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 :body-only t))

=A0 =A0 =A0 =A0 ("blog" . (:components ("= ;blog-org" "blog-extra about")))
))

--=
Justin Gordon |=A0808-877-6461 |=A0m: 808-281-7272
--089e01229a060c267d04ef0e0a27--