在osx上的emacs中的第一个模式 - 无法创建pdf

时间:2012-09-26 13:09:04

标签: emacs elisp

Emacs:Gnu Emacs 23.4
操作系统:OS X 10.6
rst.el:不确定版本,但从sourceforge

下载最新版本

我在.emacs中设置了正确的路径,以便它看到rst2pdf。我试图让rst-compile-pdf-preview()在我的rst模式下工作。当我做C-c C-c C-p时,我不知道发生了什么 - 它无声地失败了。当我运行此按键时,我希望emacs执行

rst2pdf "1 file with space.txt" -o "1 file with space.pdf"

请注意,我需要使用引号来处理带空格和-o。

的文件

以下是正在调用的代码:

(defvar rst-pdf-program "/Applications/Preview.app/Contents/MacOS/Preview"
"Program used to preview PDF files.")

(defun rst-compile-pdf-preview ()
"Convert the document to a PDF file and launch a preview program."
(interactive)
(let* ((tmp-filename (make-temp-file "rst_el" nil ".pdf"))
 (command (format "%s %s %s && %s -o %s ; rm %s"
          (cadr (assq 'pdf rst-compile-toolsets))
          buffer-file-name tmp-filename
          rst-pdf-program tmp-filename tmp-filename)))
  (start-process-shell-command "rst-pdf-preview" nil command)
  ;; Note: you could also use (compile command) to view the compilation
  ;; output.
   ))

(抱歉,我似乎可以使用正确的格式粘贴代码,而且我不想单独格式化每一行。)

现在,当我做C-c C-c C-c,并手动发出rst2pdf 1.txt时 - 它可以正常工作。

2 个答案:

答案 0 :(得分:1)

我检查了问题,发现外部rst2pdf不符合reStructuredText调用标准。 rst.el在这方面是正确的,并与Docutils沙箱中的rst2pdf一起使用。恕我直言,应修复外部rst2pdf以符合reStructuredText标准。

除了在预览功能中添加“-o”一般不能解决生成PDF时的问题。

的Stefan

rst.el的维护者和主要开发者

答案 1 :(得分:0)

看起来rst.el的这一部分确实存在一个错误。需要引用buffer-file-name,因此请将buffer-file-name替换为(shell-quote-argument buffer-file-name)。我的rst2pdf也需要一个-o,而rst.el代码似乎没有提供任何代码,但上面的示例代码添加了-o太“迟”了:它应该放在第二个和第三个%s