From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: HTML/images zipped? Date: Fri, 26 Jun 2015 17:51:50 -0400 Message-ID: <87si9e6suh.fsf@alphaville.usersys.redhat.com> References: <6sw6c7bng2haym.fsf@pfdstudio.com> <871tgy1ugo.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8bXd-0004gO-3w for emacs-orgmode@gnu.org; Fri, 26 Jun 2015 17:52:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8bXY-0002nK-1p for emacs-orgmode@gnu.org; Fri, 26 Jun 2015 17:52:09 -0400 Received: from plane.gmane.org ([80.91.229.3]:51916) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8bXX-0002mq-Mf for emacs-orgmode@gnu.org; Fri, 26 Jun 2015 17:52:03 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Z8bXS-0003V3-Sb for emacs-orgmode@gnu.org; Fri, 26 Jun 2015 23:51:59 +0200 Received: from nat-pool-bos-t.redhat.com ([66.187.233.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Jun 2015 23:51:58 +0200 Received: from ndokos by nat-pool-bos-t.redhat.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Jun 2015 23:51:58 +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 John Kitchin writes: > I did something like this for org-files: > https://github.com/jkitchin/jmax/blob/master/ox-archive.el > I tried this on some arbitrary org file (not containing any references) and= I got an error: Debugger entered--Lisp error: (wrong-type-argument stringp nil) file-name-directory(nil) (let* ((temporary-file-directory (file-name-directory (buffer-file-name))= ) (tempname (make-temp-file "extract-bib")) (contents (buffer-string)) (cb = (current-buffer)) basename texfile bibfile results) (find-file tempname) (i= nsert contents) (setq basename (file-name-sans-extension (file-name-nondire= ctory buffer-file-name)) texfile (concat tempname ".tex") bibfile (concat t= empname ".bib")) (save-excursion (goto-char (point-min)) (if (re-search-for= ward "^bibliography:" (point-max) (quote end)) nil (insert (format "\nbibli= ography:%s" (mapconcat (quote identity) reftex-default-bibliography ","))))= ) (save-buffer) (org-latex-export-to-latex) (find-file texfile) (reftex-par= se-all) (reftex-create-bibtex-file bibfile) (save-buffer) (setq results (bu= ffer-string)) (kill-buffer (concat basename ".bib")) (kill-buffer (concat b= asename ".tex")) (kill-buffer basename) (delete-file bibfile) (delete-file = texfile) (delete-file tempname) (switch-to-buffer cb) (if (not (string=3D "= " results)) (progn (save-excursion (goto-char (point-max)) (insert "\n\n") = (org-insert-heading) (insert (format " Bibtex entries\n\n#+BEGIN_SRC text := tangle %s\n%s\n#+END_SRC" (concat (file-name-sans-extension ...) ".bib") re= sults)))))) org-ref-extract-bibtex-entries() (let* ((org-file (buffer-name)) (org-file-abs-path (buffer-file-name)) (b= ase-name (file-name-sans-extension org-file)) (org-archive (if (string=3D z= ip-base-name "") (concat base-name "-" (format-time-string "%Y-%m-%d" (curr= ent-time))) zip-base-name)) (org-archive-zip (concat org-archive ".zip")) l= ink-list) (if (file-exists-p org-archive-zip) (progn (delete-file org-archi= ve-zip))) (if (file-exists-p org-archive) (progn (delete-directory org-arch= ive t))) (make-directory org-archive t) (setq link-list (let ((parsetree (o= rg-element-parse-buffer)) (counter 0)) (org-element-map parsetree (quote li= nk) (function (lambda (link) (let* (... ... ... ... ... ... ... ...) (messa= ge ...) (cond ... ... ...))))))) (message (format "\n\nlink-list: %s\n\n" l= ink-list)) (let ((counter 0)) (defalias (quote ox-mrkup-filter-link) (funct= ion (lambda (text back-end info) (message "handing link %s: %s\n" counter t= ext) (let ((link ...)) (message " %s replacement is %s\n" counter link) (i= f (not ...) (progn ... ...) (setq output ...)) (setq counter (+ counter 1))= output)))) (let ((org-export-filter-link-functions (quote (ox-mrkup-filter= -link)))) (org-org-export-as-org))) (switch-to-buffer "*Org ORG Export*") (= insert (format "# archived from %s on %s\n" org-file-abs-path (format-time-= string "%Y-%m-%d" (current-time)))) (org-ref-extract-bibtex-entries) (write= -file (expand-file-name org-file org-archive)) (shell-command (concat "zip = -v -r " org-archive-zip " *")) (rename-file org-archive-zip (concat "../" o= rg-archive ".zip")) (switch-to-buffer org-file) (delete-directory org-archi= ve t) org-archive-zip) ox-archive-create-zip("foo") ... I think there is a bug in ox-archive-create-zip: --8<---------------cut here---------------start------------->8--- ... (switch-to-buffer "*Org ORG Export*") (insert (format "# archived from %s on %s\n" org-file-abs-path (format-time-string "%Y-%m-%d" (current-time)))) ;; add bibliography references if they exist.=20 (org-ref-extract-bibtex-entries) ... --8<---------------cut here---------------end--------------->8--- because the first thing that org-ref-extract-bibtex-entries does is --8<---------------cut here---------------start------------->8--- (let* ((temporary-file-directory (file-name-directory (buffer-file-name))) --8<---------------cut here---------------end--------------->8--- and (buffer-file-name) returns nil on the *Org ORG Export* buffer. But since you obviously use this code successfully, I wonder why you don't hit this. Thanks for any help, Nick