浏览代码

ol: Fix type error in org-link-search corner case

* lisp/ol.el (org-link-search): Account for orphan #+name keyword.

If #+name is followed by a blank line (making it an invalid affiliated
keyword), :name is nil.

Reported-by: Dima Kogan <dima@secretsauce.net>
Ref: https://orgmode.org/list/875z5xf7f7.fsf@secretsauce.net
Kyle Meyer 4 年之前
父节点
当前提交
3bb073b638
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      lisp/ol.el

+ 3 - 4
lisp/ol.el

@@ -1173,10 +1173,9 @@ of matched result, which is either `dedicated' or `fuzzy'."
 	     (catch :name-match
 	       (goto-char (point-min))
 	       (while (re-search-forward name nil t)
-		 (let ((element (org-element-at-point)))
-		   (when (equal words
-				(split-string
-				 (org-element-property :name element)))
+		 (let* ((element (org-element-at-point))
+			(name (org-element-property :name element)))
+		   (when (and name (equal words (split-string name)))
 		     (setq type 'dedicated)
 		     (beginning-of-line)
 		     (throw :name-match t))))