From: Ihor Radchenko <yantar92@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fix `org-lint-link-to-local-file'
Date: Sat, 26 Sep 2020 14:34:22 +0800 [thread overview]
Message-ID: <87wo0ht5ap.fsf@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 124 bytes --]
I have been trying to run org-lint on my files recently. Ended up fixing org-lint itself...
See the attached.
Best,
Ihor
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-org-lint-link-to-local-file.patch --]
[-- Type: text/x-diff, Size: 1391 bytes --]
From feacb6fd2898b5788e6d70b3139cf83359b96ca6 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sat, 26 Sep 2020 14:24:44 +0800
Subject: [PATCH] Fix `org-lint-link-to-local-file'.
* lisp/org-lint.el (org-lint-link-to-local-file): 1. Fix call to
`org-attach-expand' being called with point not at the attachment:
link. 2. Fix typo in call to `format'. File argument had to be
outside the if.
---
lisp/org-lint.el | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index 79ad640e4..e4e0ef751 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -574,15 +574,16 @@ Use :header-args: instead"
(let* ((path (org-element-property :path l))
(file (if (string= type "file")
path
- (org-attach-expand path))))
+ (org-with-point-at (org-element-property :begin l)
+ (org-attach-expand path)))))
(and (not (file-remote-p file))
(not (file-exists-p file))
(list (org-element-property :begin l)
(format (if (org-element-lineage l '(link))
"Link to non-existent image file %S \
in description"
- "Link to non-existent local file %S"
- file))))))
+ "Link to non-existent local file %S")
+ file)))))
(_ nil))))))
(defun org-lint-non-existent-setupfile-parameter (ast)
--
2.26.2
next reply other threads:[~2020-09-26 6:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-26 6:34 Ihor Radchenko [this message]
2020-09-26 8:35 ` [PATCH] Fix `org-lint-link-to-local-file' Nicolas Goaziou
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=87wo0ht5ap.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).