Org-mode mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix `org-lint-link-to-local-file'
@ 2020-09-26  6:34 Ihor Radchenko
  2020-09-26  8:35 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Ihor Radchenko @ 2020-09-26  6:34 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix `org-lint-link-to-local-file'
  2020-09-26  6:34 [PATCH] Fix `org-lint-link-to-local-file' Ihor Radchenko
@ 2020-09-26  8:35 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2020-09-26  8:35 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Hello,

Ihor Radchenko <yantar92@gmail.com> writes:

> Subject: [PATCH] Fix `org-lint-link-to-local-file'.

Applied. Thank you.

Regards,
-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-26  8:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-26  6:34 [PATCH] Fix `org-lint-link-to-local-file' Ihor Radchenko
2020-09-26  8:35 ` Nicolas Goaziou

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git