ol-docview: Throw an error when trying to open non-existing file

* lisp/ol-docview.el (org-docview-open): Throw an error when file does
not exist.  Creating an empty document buffer is not useful here.

Fixes https://orgmode.org/list/87zgklmd0g.fsf@localhost
This commit is contained in:
Ihor Radchenko 2022-05-04 23:13:58 +08:00
parent bc33c0133d
commit c231e93b56
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 3 additions and 1 deletions

View File

@ -75,7 +75,9 @@
(string-to-number (match-string 2 link)))))
;; Let Org mode open the file (in-emacs = 1) to ensure
;; org-link-frame-setup is respected.
(org-open-file path 1)
(if (file-exists-p path)
(org-open-file path 1)
(error "No such file: %s" path))
(when page (doc-view-goto-page page))))
(defun org-docview-store-link ()