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

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

[elpa] externals/doc-toc 102e14199c 65/84: pdf.tocgen replace original p


From: ELPA Syncer
Subject: [elpa] externals/doc-toc 102e14199c 65/84: pdf.tocgen replace original pdf, and show message on fail
Date: Mon, 26 Sep 2022 13:58:39 -0400 (EDT)

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

    pdf.tocgen replace original pdf, and show message on fail
---
 toc-mode.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/toc-mode.el b/toc-mode.el
index bf8cfa3c4c..c7d9f979d6 100644
--- a/toc-mode.el
+++ b/toc-mode.el
@@ -312,8 +312,15 @@ named output.pdf and opened in a new buffer. Don't forget 
to
 rename this new file."
   (interactive)
   (write-file default-directory)
-  (shell-command (format "pdftocio -o output.pdf '%s' < toc" pdf-filename))
-  (find-file "output.pdf"))
+  (let* ((message (shell-command-to-string (format "pdftocio '%s' < toc" 
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)))))
+
 
 (defvar toc-pdftocgen-mode-map
   (let ((map (make-sparse-keymap)))



reply via email to

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