2

When exporting an org document to pdf via LaTeX, C-c C-e l o, if the pdf to be generated has already been visited in an existing buffer, neither of the variables auto-revert-mode nor global-auto-revert-mode are respected.

During the export process, org-export-dispatch calls org-open-file which in turn calls find-file-other-window, which in turn causes part of the problem by calling find-file-noselect with its nowarn argument set to nil.

I'm not sure of the best way to go about this, but I believe the solution would be to modify the yes-or-no-p statement, lines 2040 - 2055 of .../emacs/26.0.50/lisp/files.el.gz:

...

        ((yes-or-no-p
          (if (string= (file-name-nondirectory filename)
                   (buffer-name buf))
              (format
               (if (buffer-modified-p buf)
               "File %s changed on disk.  Discard your edits? "
             "File %s changed on disk.  Reread from disk? ")
               (file-name-nondirectory filename))
            (format
             (if (buffer-modified-p buf)
             "File %s changed on disk.  Discard your edits in %s? "
               "File %s changed on disk.  Reread from disk into %s? ")
             (file-name-nondirectory filename)
             (buffer-name buf))))
         (with-current-buffer buf
           (revert-buffer t t)))))

...

such that when the buffer is not modified and (global-)auto-revert-mode is set, then automatically return yes without prompt.

Not sure if this should be filed as a bug?

When I compile the corresponding tex file that is generated as part of the org-export process, (global-)auto-revert-mode is respected, and the pdf buffer is automatically reverted.

Edit

This issue does not manifest itself when I start a standalone Emacs session, and manually open the compiled pdf with C-x C-f.

It does however, when I am working within a daemon, through emacsclient -c -a "". Emacsclient is my default application for opening pdfs. I.e. in my init file, I have (setq org-file-apps '(("\\.pdf\\'" . "emacsclient \"%s\"")))

nyameko
  • 545
  • 2
  • 15
  • I think it might be more appropriate to modify `org-export-dispatch` or `org-open-file` to check if the file is already being visited in a buffer and respond accordingly. If you don't get a response here, this would be worth raising on the org-mode mailing list. – Tyler Mar 17 '17 at 13:31

0 Answers0