浏览代码

Allow multi-line properties to be specified in property blocks

  #+begin_property
    var foo=1,
        bar=2,
        baz=3,
        qux=4
  #+end_property
  #+begin_src emacs-lisp
    (+ foo bar baz qux)
  #+end_src

  #+results:
  : 10

* lisp/org.el (org-set-regexps-and-options): Use property blocks for
  multi-line properties.
Eric Schulte 13 年之前
父节点
当前提交
8354fd9e0f
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      lisp/org.el

+ 10 - 2
lisp/org.el

@@ -4537,8 +4537,16 @@ means to push this value onto the list in the variable.")
 		(setq ext-setup-or-nil
 		(setq ext-setup-or-nil
 		      (concat (substring ext-setup-or-nil 0 start)
 		      (concat (substring ext-setup-or-nil 0 start)
 			      "\n" setup-contents "\n"
 			      "\n" setup-contents "\n"
-			      (substring ext-setup-or-nil start)))))
-	     ))))
+			      (substring ext-setup-or-nil start)))))))
+	  ;; search for property blocks
+	  (goto-char (point-min))
+	  (while (re-search-forward org-block-regexp nil t)
+	    (when (equal "PROPERTY" (upcase (match-string 1)))
+	      (setq value (replace-regexp-in-string
+			   "[\n\r]" " " (match-string 4)))
+	      (when (string-match "\\(\\S-+\\)\\s-+\\(.*\\)" value)
+		(push (cons (match-string 1 value) (match-string 2 value))
+		      props))))))
       (org-set-local 'org-use-sub-superscripts scripts)
       (org-set-local 'org-use-sub-superscripts scripts)
       (when cat
       (when cat
 	(org-set-local 'org-category (intern cat))
 	(org-set-local 'org-category (intern cat))