emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elp


From: Jean Louis
Subject: Re: Bug: org-latex-export-to-pdf does not remove .tex file [9.4 (9.4-elpa @ /home/bruno/.emacs.d/elpa/org-9.4/)]
Date: Fri, 17 Feb 2023 17:39:30 +0300
User-agent: Mutt/2.2.9+54 (af2080d) (2022-11-21)

* Ihor Radchenko <yantar92@posteo.net> [2023-02-17 16:32]:
> Bruno BEAUFILS <bruno@boulgour.com> writes:
> 
> > On Fri, Feb 17, 2023 at 10:55:34AM +0000, Ihor Radchenko wrote:
> >> > How so?
> >> 
> >> latexmk -interaction=nonstopmode
> >
> > Still do not get the problem. I though that the exit code of the
> > underlying process was used but after having try to understand some of
> > the ox-latel.el I discover that it seems to be done another way
> > (analysing the output if I am right).
> 
> Even if we used exit code, what would it achieve?

- user wants PDF file

- with exit code other but zero there will be no PDF file

- display error or move user straight to LaTeX file to try it out
  manually or find what is wrong.

Personally I use exit code from LaTeX processing.

- I like to be careful with existing PDF files, as sometimes PDF file
  is exported in different way, and maybe I am making mistake. So I
  like to be cautious about it.

- Here below `latex-function' must return zero and `pdf-file' must
  exist for system to update it's Hyperlink correctly, and to launch
  Evince PDF viewer.

- But if error status is not zero, I want to find myself in LaTeX file
  straight, then I can try C-c C-a to understand why it did not work.

(defun hyperscope-latex-to-pdf (id)
  (let* ((default-directory (hyperscope-expand-directory-for-id id))
         (latex-file (hyperscope-hyperdocument-file-name-full id "tex"))
         (text (hyperscope-text id))
         (pdf-file (hyperscope-hyperdocument-file-name-full id "pdf"))
         (latex-function (lambda () (call-process "pdflatex" nil "*pdflatex*" 
nil latex-file))))
    (string-to-file-force text latex-file)
    (when (and (file-exists-p pdf-file)
               (y-or-n-p "Delete existing PDF? "))
      (delete-file pdf-file))
    (cond ((and (zerop (funcall latex-function))
                (file-exists-p pdf-file))
           (rcd-db-update-entry "hyobjects" "hyobjects_link" id pdf-file hs-db)
           (hyperscope-evince pdf-file))
          (t (rcd-warning-message "Could not create PDF")
             (find-file latex-file)))))

If I would just assume that `latex' command "just worked", that means
I am blindly continuing with some other functions thereafter, but that
would mean I am creating some errors.

--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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