emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Francesco Pizzolante <fpz@missioncriticalit.com>
Cc: mailing-list-org-mode <emacs-orgmode@gnu.org>
Subject: Re: Blorgit > Adding PDF export
Date: Mon, 23 Nov 2009 08:38:33 -0700	[thread overview]
Message-ID: <m2vdh1gsjq.fsf@gmail.com> (raw)
In-Reply-To: <87y6lxxo2y.fsf@missioncriticalit.com> (Francesco Pizzolante's message of "Mon, 23 Nov 2009 16:23:01 +0100")

Thanks Francesco,

These changes should now all be applied to the git repository.

-- Eric

Francesco Pizzolante <fpz@missioncriticalit.com> writes:

> Eric,
>
>> First off this looks great.
>
> Thanks.
>
>> Rather than explicitly using the "/tmp" directory i would recommend
>> using the `make-temp-file' function, which should work across a wider
>> range of systems.  Additionally if you need to get the directory from a
>> path, or combine a file-name and a directory name into a path I'd
>> recommend the `expand-file-name' and `file-name-directory' functions
>> respectively.
>>
>> With those change I would love to include this new feature into the main
>> blorgit repository.
>
> I tried to take your remarks into account as much as possible.
>
> I only changed "org-interaction.el". Here's the diff:
>
> diff --git a/elisp/org-interaction.el b/elisp/org-interaction.el
> index 2311156..9b785e2 100644
> --- a/elisp/org-interaction.el
> +++ b/elisp/org-interaction.el
> @@ -65,6 +65,31 @@ latex as a string."
>          (write-file latex-path)
>          (kill-buffer (current-buffer)))))))
>
> +(defun org-file-to-pdf (file-path)
> +  "Open up an org file and export it as pdf."
> +  (let* ((file-name (file-name-nondirectory file-path))
> +        (file-dir (file-name-directory file-path))
> +        (org-tmp-path (make-temp-file "org-file-to-pdf-"))
> +        (pdf-tmp-path (concat org-tmp-path ".pdf"))
> +        (tex-tmp-path (concat org-tmp-path ".tex"))
> +        (pdf-path (expand-file-name (concat org-interaction-prefix file-name ".pdf") file-dir)))
> +    (if (and (file-exists-p pdf-path)
> +            (< 0 (time-to-seconds
> +                  (time-subtract
> +                   (nth 5 (file-attributes pdf-path))
> +                   (nth 5 (file-attributes file-path))))))
> +       pdf-path
> +      (with-temp-filebuffer
> +       file-path
> +       (write-file org-tmp-path)
> +       (org-mode)
> +       (save-window-excursion
> +        (org-export-as-pdf nil)
> +        (rename-file pdf-tmp-path pdf-path t)
> +        (delete-file org-tmp-path)
> +        (delete-file tex-tmp-path)
> +        (kill-buffer (current-buffer)))))))
> +
>  ;; customization
>  (setq org-export-blocks-witheld '(hidden comment))
>
> Is this better?
>
> Francesco

  reply	other threads:[~2009-11-23 15:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13 15:47 Blorgit > SVN integration Francesco Pizzolante
2009-11-13 17:45 ` Eric Schulte
     [not found]   ` <m2r5s2gvyc.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-11-19 10:06     ` Francesco Pizzolante
2009-11-19 15:17       ` Eric Schulte
     [not found]         ` <m2skcazgr6.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-11-20 12:36           ` Francesco Pizzolante
2009-11-20 17:15             ` Eric Schulte
2009-11-23 12:58           ` Blorgit > Adding PDF export Francesco Pizzolante
2009-11-23 14:43             ` Eric Schulte
     [not found]               ` <m2ljhxi9oi.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-11-23 15:23                 ` Francesco Pizzolante
2009-11-23 15:38                   ` Eric Schulte [this message]
2009-12-03 15:59           ` Blorgit > SVN integration Francesco Pizzolante
2009-12-05  3:54             ` Eric Schulte
     [not found]               ` <m27ht23wj2.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-12-07 12:33                 ` Francesco Pizzolante

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2vdh1gsjq.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=fpz@missioncriticalit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).