ソースを参照

Warn users of malformed property drawers

* org.el (org-buffer-property-keys): When scanning the buffer for
valid property keys, give users a chance to repair any malformed
property drawers.
Eric Abrahamsen 10 年 前
コミット
c23d9ee8c5
1 ファイル変更11 行追加6 行削除
  1. 11 6
      lisp/org.el

+ 11 - 6
lisp/org.el

@@ -15712,12 +15712,17 @@ formats in the current buffer."
 	(widen)
 	(goto-char (point-min))
 	(while (re-search-forward org-property-start-re nil t)
-	  (setq range (org-get-property-block))
-	  (goto-char (car range))
-	  (while (re-search-forward org-property-re
-		  (cdr range) t)
-	    (add-to-list 'rtn (org-match-string-no-properties 2)))
-	  (outline-next-heading))))
+	  (catch 'cont
+	    (setq range (or (org-get-property-block)
+			    (if (y-or-n-p
+				 (format "Malformed drawer at %d, repair?" (point)))
+				(org-get-property-block nil nil t)
+				(throw 'cont nil))))
+	    (goto-char (car range))
+	    (while (re-search-forward org-property-re
+				      (cdr range) t)
+	      (add-to-list 'rtn (org-match-string-no-properties 2)))
+	    (outline-next-heading)))))
 
     (when include-specials
       (setq rtn (append org-special-properties rtn)))