From 9bf3e8ae2009958364e098733a8cced1ce3e2b45 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sat, 26 May 2007 03:21:11 +0000 Subject: [PATCH] Work around a truly abominable tilde-in-path edge case in TeX 2007-05-25 Michael Olson * lisp/muse-latex.el (muse-latex-pdf-program): New option that specifies the program to call in order to generate PDF content from LaTeX content. (muse-latex-pdf-cruft): New option that specifies the extensions of files to remove after generating PDF output successfully. (muse-latex-pdf-generate): Use these new options. Work around the annoying edge case where a tilde character exists in the filename or directory path -- now this can only error out when the relative path from the output file to the source file contains a tilde, which is far less likely. * lisp/muse-texinfo.el (muse-texinfo-pdf-generate): Rewrite to call `muse-latex-pdf-generate' with pdftex as the generating binary, because texi2pdf suffers irredeemably from the tilde edge case mentioned above. git-archimport-id: mwolson@gnu.org--2006/muse--rel--3.03--patch-6 --- ChangeLog | 15 +++++++++++++++ lisp/muse-latex.el | 27 ++++++++++++++++++++------- lisp/muse-texinfo.el | 10 ++++------ 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86c9667..577e8fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,17 @@ * examples/Makefile (clean): Remove QuickStart.texi, in case something went wrong during the build. + * lisp/muse-latex.el (muse-latex-pdf-program): New option that + specifies the program to call in order to generate PDF content + from LaTeX content. + (muse-latex-pdf-cruft): New option that specifies the extensions + of files to remove after generating PDF output successfully. + (muse-latex-pdf-generate): Use these new options. Work around the + annoying edge case where a tilde character exists in the filename + or directory path -- now this can only error out when the relative + path from the output file to the source file contains a tilde, + which is far less likely. + * lisp/muse-publish.el (muse-publish-markup-attribute): Don't use muse-publish-ensure-block here after all, because et al may occur inline as part of other things. @@ -18,6 +29,10 @@ * lisp/muse-texinfo.el ("texi"): Make muse-texinfo-munge-buffer occur after full-document escaping, rather than before. This prevents automatically-inserted Texinfo code from being escaped. + (muse-texinfo-pdf-generate): Rewrite to call + `muse-latex-pdf-generate' with pdftex as the generating binary, + because texi2pdf suffers irredeemably from the tilde edge case + mentioned above. 2007-05-24 Michael Olson diff --git a/lisp/muse-latex.el b/lisp/muse-latex.el index 372b805..54c1933 100644 --- a/lisp/muse-latex.el +++ b/lisp/muse-latex.el @@ -1,6 +1,6 @@ ;;; muse-latex.el --- publish entries in LaTex or PDF format -;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +;; Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. @@ -58,6 +58,16 @@ :type 'string :group 'muse-latex) +(defcustom muse-latex-pdf-program "pdflatex" + "The program that is called to generate PDF content from LaTeX content." + :type 'string + :group 'muse-latex) + +(defcustom muse-latex-pdf-cruft '(".aux" ".toc" ".out" ".log") + "Extensions of files to remove after generating PDF output successfully." + :type 'string + :group 'muse-latex) + (defcustom muse-latex-header "\\documentclass{article} @@ -407,14 +417,17 @@ and it will do what you expect." (shell-command (concat "open " file))) (defun muse-latex-pdf-generate (file output-path final-target) - (muse-publish-transform-output + (apply + #'muse-publish-transform-output file output-path final-target "PDF" (function (lambda (file output-path) - (let ((command (format "cd \"%s\"; pdflatex \"%s\"" - (file-name-directory output-path) file)) - (times 0) - result) + (let* ((fnd (file-name-directory output-path)) + (command (format "cd \"%s\"; %s \"%s\"" + fnd muse-latex-pdf-program + (file-relative-name file fnd))) + (times 0) + result) ;; XEmacs can sometimes return a non-number result. We'll err ;; on the side of caution by continuing to attempt to generate ;; the PDF if this happens and treat the final result as @@ -432,7 +445,7 @@ and it will do what you expect." (eq result 0)) t nil)))) - ".aux" ".toc" ".out" ".log")) + muse-latex-pdf-cruft)) ;;; Register the Muse LATEX Publishers diff --git a/lisp/muse-texinfo.el b/lisp/muse-texinfo.el index 8f50d16..bc31b71 100644 --- a/lisp/muse-texinfo.el +++ b/lisp/muse-texinfo.el @@ -293,12 +293,10 @@ If no description exists for the link, use the link itself." output-path " " file)))))))) (defun muse-texinfo-pdf-generate (file output-path final-target) - (muse-publish-transform-output - file output-path final-target "PDF" - (function - (lambda (file output-path) - (= 0 (shell-command (concat "texi2pdf -q --clean --output=" - output-path " " file))))))) + (let ((muse-latex-pdf-program "pdftex") + (muse-latex-pdf-cruft '(".aux" ".cp" ".fn" ".ky" ".log" ".pg" ".toc" + ".tp" ".vr"))) + (muse-latex-pdf-generate file output-path final-target))) ;;; Register the Muse TEXINFO Publishers -- 2.11.4.GIT