From: Ihor Radchenko <email@example.com> To: Alan Wehmann <firstname.lastname@example.org> Cc: email@example.com Subject: Re: link error when file missing Date: Sat, 16 Apr 2022 20:25:03 +0800 [thread overview] Message-ID: <87zgklmd0g.fsf@localhost> (raw) In-Reply-To: <F75F924A-BD3F-4998-A2DE-E1CD1A4A538C@gmail.com> Alan Wehmann <firstname.lastname@example.org> writes: > I have a link in a text file that looks as follows, in fundamental mode: > > 5. Contracts: [[docview:~/Documents/Wheaton_condo/landscaping/from Mark/2019/ALM_landscape_contract_Fall_2018.pdf::1][Landscape]], [[docview:~/Documents/Wheaton_condo/landscaping/from Mark/2018/ALM_snow_management_contract_Fall_2018.pdf::1][Snow]] > > The path is deliberately wrong in the first link--in order to demonstrate the error that results. The year "2019" there should be "2018" and then in that case the link works properly (when the file is set to org-mode); the result of using the proper link is that the document is shown in a docview buffer. > > As is, there is an error thrown & below is the backtrace for it (after appropriate use of "toggle-debug-on-error") > > Debugger entered--Lisp error: (wrong-type-argument listp t) > image-mode-winprops(nil) > image-mode-window-put(page 0 nil) > doc-view-goto-page(1) > org-docview-open("~/Documents/Wheaton_condo/landscaping/from Mark/20..." nil) Confirmed. This is caused by ol-docview's assumption (see org-docview-open) that org-open-file does not open non-existing file, as it is stated in org-open-file docstring: >> If the file does not exist, throw an error. However, the docstring is not quite correct. Below is code in org-open-file that is repronsible for throwing the error: (when (and (not (eq cmd 'emacs)) ; Emacs has no problems with non-ex files (not (file-exists-p file)) (not org-open-non-existing-files)) (user-error "No such file: %s" file)) Clearly, throwing or not throwing error is controlled by org-open-non-existing-files and org-open-file never throws an error with non-nil first optional argument (IN-EMACS). This code has been introduced years ago by Carsten. We have several options to fix the issue: 1. Only fix the reported issue in ol-docview.el and extend org-open-file documention 2. In addition, make org-open-file throw an error when opening non-existing files in emacs (unless org-open-non-existing-files is non-nil) The second option poses a risk of breaking existing configs. WDYT? Best, Ihor
prev parent reply other threads:[~2022-04-16 12:25 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-15 14:49 Alan Wehmann 2022-04-16 12:25 ` Ihor Radchenko [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=87zgklmd0g.fsf@localhost \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: link error when file missing' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).