소스 검색

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
Ihor Radchenko 3 년 전
부모
커밋
c231e93b56
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      lisp/ol-docview.el

+ 3 - 1
lisp/ol-docview.el

@@ -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 ()