emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/doc-toc cf6b12ca35 79/84: Fix #10: prevent pdf-filename


From: ELPA Syncer
Subject: [elpa] externals/doc-toc cf6b12ca35 79/84: Fix #10: prevent pdf-filename become nil
Date: Mon, 26 Sep 2022 13:58:40 -0400 (EDT)

branch: externals/doc-toc
commit cf6b12ca356d119e68935737e3340155d8fda3f3
Author: Daniel Nicolai <dalanicolai@gmail.com>
Commit: Daniel Nicolai <dalanicolai@gmail.com>

    Fix #10: prevent pdf-filename become nil
---
 toc-mode.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/toc-mode.el b/toc-mode.el
index e8b43e61ac..11a70566fd 100644
--- a/toc-mode.el
+++ b/toc-mode.el
@@ -325,16 +325,17 @@ The newly created PDF that includes the TOC is written to 
a file
 named output.pdf and opened in a new buffer. Don't forget to
 rename this new file."
   (interactive)
-  (write-file default-directory)
-  (let* ((message (shell-command-to-string (format "pdftocio '%s' < toc" 
pdf-filename))))
+  (let* ((output-buf (get-buffer-create "*pdftocio-output*")))
+    (call-process-region (point-min) (point-max) "pdftocio"
+                         nil output-buf nil pdf-filename)
     (kill-buffer-if-not-modified (find-file pdf-filename))
     (when (file-exists-p (concat (file-name-base pdf-filename) "_out.pdf"))
       (delete-file pdf-filename)
       (rename-file (concat (file-name-base pdf-filename) "_out.pdf") 
pdf-filename))
     (find-file pdf-filename)
-    (unless (string= message "")
-      (message (concat "The pdftocio command returned the following message: 
\n\n" message)))))
-
+    (if (> (buffer-size output-buf) 0)
+        (pop-to-buffer output-buf)
+      (kill-buffer output-buf))))
 
 (defvar toc-pdftocgen-mode-map
   (let ((map (make-sparse-keymap)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]