org-export: Allow in-buffer keywords at any column

* contrib/lisp/org-export.el (org-export--get-inbuffer-options): Allow
  in-buffer keywords at any column.

`org-make-options-regexp' enforces keywords at column 0. This is an
unnecessary restriction, as we can imagine the following Org buffer:

* Export Setup              :noexport:

  #+AUTHOR: Me
  #+DATE: 29/03/2012

* Headline 1

  ...
This commit is contained in:
Nicolas Goaziou 2012-09-01 13:04:14 +02:00
parent 61ad50d758
commit 57da184a5c
1 changed files with 7 additions and 6 deletions

View File

@ -973,8 +973,7 @@ structure of the values."
;; just before export, by `org-export-collect-tree-properties'.
;;
;; Here is the full list of properties available during transcode
;; process, with their category (option, tree or local) and their
;; value type.
;; process, with their category and their value type.
;;
;; + `:author' :: Author's name.
;; - category :: option
@ -1373,7 +1372,8 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
(goto-char (point-min))
(let ((case-fold-search t) plist)
;; 1. Special keywords, as in `org-export-special-keywords'.
(let ((special-re (org-make-options-regexp org-export-special-keywords)))
(let ((special-re
(format "^[ \t]*#\\+%s:" (regexp-opt org-export-special-keywords))))
(while (re-search-forward special-re nil t)
(let ((element (org-element-at-point)))
(when (eq (org-element-type element) 'keyword)
@ -1404,15 +1404,16 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
(intern
(format "org-%s-options-alist" backend))))
(and (boundp var) (eval var))))))
;; Build alist between keyword name and property name.
;; Build ALIST between keyword name and property name.
(alist
(delq nil (mapcar
(lambda (e) (when (nth 1 e) (cons (nth 1 e) (car e))))
all)))
;; Build regexp matching all keywords associated to export
;; options. Note: the search is case insensitive.
(opt-re (org-make-options-regexp
(delq nil (mapcar (lambda (e) (nth 1 e)) all)))))
(opt-re (format "^[ \t]*#\\+%s:"
(regexp-opt
(delq nil (mapcar (lambda (e) (nth 1 e)) all))))))
(goto-char (point-min))
(while (re-search-forward opt-re nil t)
(let ((element (org-element-at-point)))