[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org ae168d5c8c 2/2: org-lint: don't complain about #+in
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org ae168d5c8c 2/2: org-lint: don't complain about #+include URL |
Date: |
Sun, 12 Jun 2022 06:57:48 -0400 (EDT) |
branch: externals/org
commit ae168d5c8c26023643af97ea25f9947c85324da1
Author: TEC <tec@tecosaur.com>
Commit: TEC <tec@tecosaur.com>
org-lint: don't complain about #+include URL
* lisp/org-lint.el (org-lint-wrong-include-link-parameter): When the
included file is a URL, skip the usual file checks.
---
lisp/org-lint.el | 67 ++++++++++++++++++++++++++++----------------------------
1 file changed, 34 insertions(+), 33 deletions(-)
diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index 62a245330f..e00bdaa7f5 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -649,39 +649,40 @@ in description"
(org-element-map ast 'keyword
(lambda (k)
(when (equal (org-element-property :key k) "INCLUDE")
- (let* ((value (org-element-property :value k))
- (path
- (and (string-match "^\\(\".+\"\\|\\S-+\\)[ \t]*" value)
- (save-match-data
- (org-strip-quotes (match-string 1 value))))))
- (if (not path)
- (list (org-element-property :post-affiliated k)
- "Missing location argument in INCLUDE keyword")
- (let* ((file (org-string-nw-p
- (if (string-match "::\\(.*\\)\\'" path)
- (substring path 0 (match-beginning 0))
- path)))
- (search (and (not (equal file path))
- (org-string-nw-p (match-string 1 path)))))
- (if (and file
- (not (file-remote-p file))
- (not (file-exists-p file)))
- (list (org-element-property :post-affiliated k)
- "Non-existent file argument in INCLUDE keyword")
- (let* ((visiting (if file (find-buffer-visiting file)
- (current-buffer)))
- (buffer (or visiting (find-file-noselect file)))
- (org-link-search-must-match-exact-headline t))
- (unwind-protect
- (with-current-buffer buffer
- (when (and search
- (not (ignore-errors
- (org-link-search search nil t))))
- (list (org-element-property :post-affiliated k)
- (format
- "Invalid search part \"%s\" in INCLUDE keyword"
- search))))
- (unless visiting (kill-buffer buffer))))))))))))
+ (let* ((value (org-element-property :value k))
+ (path
+ (and (string-match "^\\(\".+\"\\|\\S-+\\)[ \t]*" value)
+ (save-match-data
+ (org-strip-quotes (match-string 1 value))))))
+ (if (not path)
+ (list (org-element-property :post-affiliated k)
+ "Missing location argument in INCLUDE keyword")
+ (let* ((file (org-string-nw-p
+ (if (string-match "::\\(.*\\)\\'" path)
+ (substring path 0 (match-beginning 0))
+ path)))
+ (search (and (not (equal file path))
+ (org-string-nw-p (match-string 1 path)))))
+ (unless (org-url-p file)
+ (if (and file
+ (not (file-remote-p file))
+ (not (file-exists-p file)))
+ (list (org-element-property :post-affiliated k)
+ "Non-existent file argument in INCLUDE keyword")
+ (let* ((visiting (if file (find-buffer-visiting file)
+ (current-buffer)))
+ (buffer (or visiting (find-file-noselect file)))
+ (org-link-search-must-match-exact-headline t))
+ (unwind-protect
+ (with-current-buffer buffer
+ (when (and search
+ (not (ignore-errors
+ (org-link-search search nil t))))
+ (list (org-element-property :post-affiliated k)
+ (format
+ "Invalid search part \"%s\" in INCLUDE
keyword"
+ search))))
+ (unless visiting (kill-buffer buffer)))))))))))))
(defun org-lint-obsolete-include-markup (ast)
(let ((regexp (format "\\`\\(?:\".+\"\\|\\S-+\\)[ \t]+%s"