Fix link extraction error when a file starts with blank lines (#1081)

org-element-at-point doesn't just determine the closest element -- if
it's "within blank lines at the beginning of buffer", it returns nil.

  ;; Within blank lines at the beginning of buffer, return nil.
  ((bobp) nil)

Skip whitespace at beginning of buffer to avoid this.
This commit is contained in:
Kisaragi Hiu
2020-09-03 11:02:10 +09:00
committed by GitHub
parent cb10b16fc0
commit df174bb52b

View File

@@ -586,7 +586,8 @@ it as FILE-PATH."
(lambda (link)
(let* ((type (org-element-property :type link))
(path (org-element-property :path link))
(element (org-element-at-point))
(element (progn (org-skip-whitespace)
(org-element-at-point)))
(begin (or (org-element-property :content-begin element)
(org-element-property :begin element)))
(content (or (org-element-property :raw-value element)