Skip to content

Commit

Permalink
ol-docview: Throw an error when trying to open non-existing file
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
yantar92 committed Jul 11, 2022
1 parent bc33c01 commit c231e93
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lisp/ol-docview.el
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down

0 comments on commit c231e93

Please sign in to comment.