0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-22 10:10:42 +00:00

Globalize some variables to make them available in buffers not in Org mode

* lisp/org.el (org-heading-regexp, org-heading-keyword-regexp-format,
  org-heading-keyword-maybe-regexp-format): Globalize variables so
  they are accessible even in buffers not in Org mode.
This commit is contained in:
Nicolas Goaziou 2011-11-01 11:40:11 +01:00
parent a9559dc08a
commit e31e89430a

View file

@ -4246,10 +4246,6 @@ collapsed state."
;;; Variables for pre-computed regular expressions, all buffer local ;;; Variables for pre-computed regular expressions, all buffer local
(defvar org-heading-regexp nil
"Matches an headline.
Stars are put in group 1 and the trimmed body in group 2.")
(make-variable-buffer-local 'org-heading-regexp)
(defvar org-drawer-regexp nil (defvar org-drawer-regexp nil
"Matches first line of a hidden block.") "Matches first line of a hidden block.")
(make-variable-buffer-local 'org-drawer-regexp) (make-variable-buffer-local 'org-drawer-regexp)
@ -4273,18 +4269,6 @@ group 3: Priority cookie
group 4: True headline group 4: True headline
group 5: Tags") group 5: Tags")
(make-variable-buffer-local 'org-complex-heading-regexp) (make-variable-buffer-local 'org-complex-heading-regexp)
(defvar org-heading-keyword-regexp-format nil
"Printf format to make regexp to match an headline with some keyword.
This regexp will match the headline of any node which has the
exact keyword that is put into the format. The keyword isn't in
any group by default, but the stars and the body are.")
(make-variable-buffer-local 'org-heading-keyword-regexp-format)
(defvar org-heading-keyword-maybe-regexp-format nil
"Printf format to make regexp to match an headline with some keyword.
This regexp can match any headline with the specified keyword, or
a without a keyword. The keyword isn't in any group by default,
but the stars and the body are.")
(make-variable-buffer-local 'org-heading-keyword-maybe-regexp-format)
(defvar org-complex-heading-regexp-format nil (defvar org-complex-heading-regexp-format nil
"Printf format to make regexp to match an exact headline. "Printf format to make regexp to match an exact headline.
This regexp will match the headline of any node which has the This regexp will match the headline of any node which has the
@ -4661,12 +4645,6 @@ means to push this value onto the list in the variable.")
(concat "\\(" (concat "\\("
(mapconcat 'regexp-quote org-not-done-keywords "\\|") (mapconcat 'regexp-quote org-not-done-keywords "\\|")
"\\)") "\\)")
org-heading-regexp
"^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
org-heading-keyword-regexp-format
"^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
org-heading-keyword-maybe-regexp-format
"^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$"
org-not-done-heading-regexp org-not-done-heading-regexp
(format org-heading-keyword-regexp-format org-not-done-regexp) (format org-heading-keyword-regexp-format org-not-done-regexp)
org-todo-line-regexp org-todo-line-regexp
@ -4854,6 +4832,22 @@ This variable is set by `org-before-change-function'.
This is similar to `org-outline-regexp' but additionally makes This is similar to `org-outline-regexp' but additionally makes
sure that we are at the beginning of the line.") sure that we are at the beginning of the line.")
(defconst org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
"Matches an headline, putting stars and text into groups.
Stars are put in group 1 and the trimmed body in group 2.")
(defconst org-heading-keyword-regexp-format
"^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
"Printf format for a regexp matching an headline with some keyword.
This regexp will match the headline of any node which has the
exact keyword that is put into the format. The keyword isn't in
any group by default, but the stars and the body are.")
(defconst org-heading-keyword-maybe-regexp-format
"^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$"
"Printf format for a regexp matching an headline, possibly with some keyword.
This regexp can match any headline with the specified keyword, or
without a keyword. The keyword isn't in any group by default,
but the stars and the body are.")
;;;###autoload ;;;###autoload
(define-derived-mode org-mode outline-mode "Org" (define-derived-mode org-mode outline-mode "Org"
"Outline-based notes management and organizer, alias "Outline-based notes management and organizer, alias