浏览代码

Don't use `outline-regexp' anymore.

Use `org-outline-regexp' instead or `outline-regexp'.  Also use the
new defconst `org-outline-regexp-bol' to match `org-outline-regexp'
at the beginning of line.

* org.el (org-outline-regexp-bol): New defconst.
(org-outline-level, org-set-font-lock-defaults, org-cycle)
(org-overview, org-content, org-flag-drawer)
(org-first-headline-recenter, org-insert-todo-heading)
(org-map-region, org-move-subtree-down, org-paste-subtree)
(org-kill-is-subtree-p, org-context-p, org-refile)
(org-refile-new-child, org-toggle-comment, org-todo)
(org-add-planning-info, org-add-log-setup, org-scan-tags)
(org-set-tags, org-insert-property-drawer)
(org-prepare-agenda-buffers, org-preview-latex-fragment)
(org-speed-command-default-hook, org-check-for-hidden)
(org-toggle-item, org-toggle-heading)
(org-indent-line-function, org-set-autofill-regexps)
(org-fill-paragraph, org-toggle-fixed-width-section)
(org-yank-generic, org-yank-folding-would-swallow-text)
(org-first-sibling-p, org-goto-sibling)
(org-goto-first-child, org-show-entry): Use
`org-outline-regexp' and `org-outline-regexp-bol'.

* org-remember.el (org-remember-handler): Use
`org-outline-regexp-bol'.

* org-mouse.el (org-mouse-match-todo-keyword, org-mode-hook)
(org-mouse-move-tree, org-mouse-transform-to-outline): Use
`org-outline-regexp' and `org-outline-regexp-bol'.

* org-macs.el (org-with-limited-levels)
(org-get-limited-outline-regexp): Use `org-outline-regexp'.

* org-indent.el (org-indent-outline-re)
(org-indent-refresh-section, org-indent-refresh-to): Use
`org-outline-regexp' and `org-outline-regexp-bol'.

* org-html.el (org-export-as-html): Use
`org-outline-regexp-bol'.

* org-footnote.el (org-footnote-at-definition-p)
(org-footnote-normalize): Use `org-outline-regexp' and
`org-outline-regexp-bol'.

* org-exp.el (org-export-preprocess-string): Don't redefine
`outline-regexp'.

* org-docbook.el (org-export-as-docbook): Use
`org-outline-regexp-bol'.

* org-colview.el (org-columns, org-columns-compute): Use
`org-outline-regexp' and `org-outline-regexp-bol'.

* org-colview-xemacs.el (org-columns, org-columns-compute):
Use `org-outline-regexp-bol'.

* org-clock.el (org-clock-insert-selection-line)
(org-clock-in, org-clock-out, org-dblock-write:clocktable):
Use `org-outline-regexp' and `org-outline-regexp-bol'.

* org-ascii.el (org-export-as-ascii)
(org-export-ascii-push-links): Use `org-outline-regexp' and
`org-outline-regexp-bol'.

* org-archive.el (org-archive-to-archive-sibling)
(org-archive-all-done): Use `org-outline-regexp' and
`org-outline-regexp-bol'.

* org-agenda.el (org-agenda, org-search-view)
(org-agenda-list-stuck-projects, org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-get-blocks): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
Bastien Guerry 14 年之前
父节点
当前提交
c3748fcd80

+ 9 - 7
lisp/org-agenda.el

@@ -2263,7 +2263,7 @@ Pressing `<' twice means to restrict to the current subtree or region
 	       ((eq type 'todo-tree)
 	       ((eq type 'todo-tree)
 		(org-check-for-org-mode)
 		(org-check-for-org-mode)
 		(org-let lprops
 		(org-let lprops
-		  '(org-occur (concat "^" outline-regexp "[ \t]*"
+		  '(org-occur (concat "^" org-outline-regexp "[ \t]*"
 				      (regexp-quote match) "\\>"))))
 				      (regexp-quote match) "\\>"))))
 	       ((eq type 'occur-tree)
 	       ((eq type 'occur-tree)
 		(org-check-for-org-mode)
 		(org-check-for-org-mode)
@@ -3873,7 +3873,7 @@ in `org-agenda-text-search-extra-files'."
 	    regexps+))
 	    regexps+))
     (setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b)))))
     (setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b)))))
     (if (not regexps+)
     (if (not regexps+)
-	(setq regexp (concat "^" org-outline-regexp))
+	(setq regexp org-outline-regexp-bol)
       (setq regexp (pop regexps+))
       (setq regexp (pop regexps+))
       (if hdl-only (setq regexp (concat "^" org-outline-regexp ".*?"
       (if hdl-only (setq regexp (concat "^" org-outline-regexp ".*?"
 					regexp))))
 					regexp))))
@@ -4311,9 +4311,11 @@ of what a project is and how to check if it stuck, customize the variable
 			  "\\)\\>"))
 			  "\\)\\>"))
 	 (tags (nth 2 org-stuck-projects))
 	 (tags (nth 2 org-stuck-projects))
 	 (tags-re (if (member "*" tags)
 	 (tags-re (if (member "*" tags)
-		      (org-re "^\\*+ .*:[[:alnum:]_@#%]+:[ \t]*$")
+		      (org-re (concat org-outline-regexp-bol
+				      ".*:[[:alnum:]_@#%]+:[ \t]*$"))
 		    (if tags
 		    (if tags
-			(concat "^\\*+ .*:\\("
+			(concat org-outline-regexp-bol
+				".*:\\("
 				(mapconcat 'identity tags "\\|")
 				(mapconcat 'identity tags "\\|")
 				(org-re "\\):[[:alnum:]_@#%:]*[ \t]*$")))))
 				(org-re "\\):[[:alnum:]_@#%:]*[ \t]*$")))))
 	 (gen-re (nth 3 org-stuck-projects))
 	 (gen-re (nth 3 org-stuck-projects))
@@ -4766,7 +4768,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
 	(setq marker (org-agenda-new-marker b0)
 	(setq marker (org-agenda-new-marker b0)
 	      category (org-get-category b0))
 	      category (org-get-category b0))
 	(save-excursion
 	(save-excursion
-	  (if (not (re-search-backward "^\\*+ " nil t))
+	  (if (not (re-search-backward org-outline-regexp-bol nil t))
 	      (setq txt org-agenda-no-heading-message)
 	      (setq txt org-agenda-no-heading-message)
 	    (goto-char (match-beginning 0))
 	    (goto-char (match-beginning 0))
 	    (setq hdmarker (org-agenda-new-marker)
 	    (setq hdmarker (org-agenda-new-marker)
@@ -4967,7 +4969,7 @@ please use `org-class' instead."
 		 (clockp
 		 (clockp
 		  (and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ \t]*$")
 		  (and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ \t]*$")
 		       (match-string 1)))))
 		       (match-string 1)))))
-	  (if (not (re-search-backward "^\\*+ " nil t))
+	  (if (not (re-search-backward org-outline-regexp-bol nil t))
 	      (setq txt org-agenda-no-heading-message)
 	      (setq txt org-agenda-no-heading-message)
 	    (goto-char (match-beginning 0))
 	    (goto-char (match-beginning 0))
 	    (setq hdmarker (org-agenda-new-marker)
 	    (setq hdmarker (org-agenda-new-marker)
@@ -5366,7 +5368,7 @@ FRACTION is what fraction of the head-warning time has passed."
 		    (throw :skip t))
 		    (throw :skip t))
 		(setq marker (org-agenda-new-marker (point)))
 		(setq marker (org-agenda-new-marker (point)))
 		(setq category (org-get-category))
 		(setq category (org-get-category))
-		(if (not (re-search-backward "^\\*+ " nil t))
+		(if (not (re-search-backward org-outline-regexp-bol nil t))
 		    (setq txt org-agenda-no-heading-message)
 		    (setq txt org-agenda-no-heading-message)
 		  (goto-char (match-beginning 0))
 		  (goto-char (match-beginning 0))
 		  (setq hdmarker (org-agenda-new-marker (point)))
 		  (setq hdmarker (org-agenda-new-marker (point)))

+ 2 - 2
lisp/org-archive.el

@@ -352,7 +352,7 @@ sibling does not exist, it will be created at the end of the subtree."
     (widen)
     (widen)
     (let (b e pos leader level)
     (let (b e pos leader level)
       (org-back-to-heading t)
       (org-back-to-heading t)
-      (looking-at outline-regexp)
+      (looking-at org-outline-regexp)
       (setq leader (match-string 0)
       (setq leader (match-string 0)
 	    level (funcall outline-level))
 	    level (funcall outline-level))
       (setq pos (point))
       (setq pos (point))
@@ -403,7 +403,7 @@ sibling does not exist, it will be created at the end of the subtree."
 If the cursor is not on a headline, try all level 1 trees.  If
 If the cursor is not on a headline, try all level 1 trees.  If
 it is on a headline, try all direct children.
 it is on a headline, try all direct children.
 When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag."
 When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag."
-  (let ((re (concat "^\\*+ +" org-not-done-regexp)) re1
+  (let ((re (concat org-outline-regexp-bol "+" org-not-done-regexp)) re1
 	(rea (concat ".*:" org-archive-tag ":"))
 	(rea (concat ".*:" org-archive-tag ":"))
 	(begm (make-marker))
 	(begm (make-marker))
 	(endm (make-marker))
 	(endm (make-marker))

+ 4 - 2
lisp/org-ascii.el

@@ -428,7 +428,7 @@ publishing directory."
 
 
     (org-init-section-numbers)
     (org-init-section-numbers)
     (while (setq line (pop lines))
     (while (setq line (pop lines))
-      (when (and link-buffer (string-match "^\\*+ " line))
+      (when (and link-buffer (string-match org-outline-regexp-bol line))
 	(org-export-ascii-push-links (nreverse link-buffer))
 	(org-export-ascii-push-links (nreverse link-buffer))
 	(setq link-buffer nil))
 	(setq link-buffer nil))
       (setq wrap nil)
       (setq wrap nil)
@@ -629,7 +629,9 @@ publishing directory."
       (save-match-data
       (save-match-data
 	(if (save-excursion
 	(if (save-excursion
 	      (re-search-backward
 	      (re-search-backward
-	       "^\\(\\([ \t]*\\)\\|\\(\\*+ \\)\\)[^ \t\n]" nil t))
+	       (concat "^\\(\\([ \t]*\\)\\|\\("
+		       org-outline-regexp
+		       "\\)\\)[^ \t\n]") nil t))
 	    (setq ind (or (match-string 2)
 	    (setq ind (or (match-string 2)
 			  (make-string (length (match-string 3)) ?\ )))))
 			  (make-string (length (match-string 3)) ?\ )))))
       (mapc (lambda (x) (insert ind "[" (car x) "]: " (cdr x) "\n"))
       (mapc (lambda (x) (insert ind "[" (car x) "]: " (cdr x) "\n"))

+ 4 - 4
lisp/org-clock.el

@@ -479,7 +479,7 @@ pointing to it."
 		    heading (org-get-heading 'notags)
 		    heading (org-get-heading 'notags)
 		    prefix (save-excursion
 		    prefix (save-excursion
 			     (org-back-to-heading t)
 			     (org-back-to-heading t)
-			     (looking-at "\\*+ ")
+			     (looking-at org-outline-regexp)
 			     (match-string 0))
 			     (match-string 0))
 		    task (substring
 		    task (substring
 			  (org-fontify-like-in-org-mode
 			  (org-fontify-like-in-org-mode
@@ -1092,7 +1092,7 @@ the clocking selection, associated with the letter `d'."
 					    (match-string 2))))
 					    (match-string 2))))
 		     (if newstate (org-todo newstate))))
 		     (if newstate (org-todo newstate))))
 		  ((and org-clock-in-switch-to-state
 		  ((and org-clock-in-switch-to-state
-			(not (looking-at (concat outline-regexp "[ \t]*"
+			(not (looking-at (concat org-outline-regexp "[ \t]*"
 						 org-clock-in-switch-to-state
 						 org-clock-in-switch-to-state
 						 "\\>"))))
 						 "\\>"))))
 		   (org-todo org-clock-in-switch-to-state)))
 		   (org-todo org-clock-in-switch-to-state)))
@@ -1380,7 +1380,7 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
 					   (match-string 2))))
 					   (match-string 2))))
 		    (if newstate (org-todo newstate))))
 		    (if newstate (org-todo newstate))))
 		 ((and org-clock-out-switch-to-state
 		 ((and org-clock-out-switch-to-state
-		       (not (looking-at (concat outline-regexp "[ \t]*"
+		       (not (looking-at (concat org-outline-regexp "[ \t]*"
 						org-clock-out-switch-to-state
 						org-clock-out-switch-to-state
 						"\\>"))))
 						"\\>"))))
 		  (org-todo org-clock-out-switch-to-state))))))
 		  (org-todo org-clock-out-switch-to-state))))))
@@ -2106,7 +2106,7 @@ the currently selected interval size."
 	    (setq level (string-to-number (match-string 1 (symbol-name scope))))
 	    (setq level (string-to-number (match-string 1 (symbol-name scope))))
 	    (catch 'exit
 	    (catch 'exit
 	      (while (org-up-heading-safe)
 	      (while (org-up-heading-safe)
-		(looking-at outline-regexp)
+		(looking-at org-outline-regexp)
 		(if (<= (org-reduced-level (funcall outline-level)) level)
 		(if (<= (org-reduced-level (funcall outline-level)) level)
 		    (throw 'exit nil))))
 		    (throw 'exit nil))))
 	    (org-narrow-to-subtree)))
 	    (org-narrow-to-subtree)))

+ 2 - 2
lisp/org-colview-xemacs.el

@@ -862,7 +862,7 @@ around it."
 	  (save-restriction
 	  (save-restriction
 	    (narrow-to-region beg end)
 	    (narrow-to-region beg end)
 	    (org-clock-sum))))
 	    (org-clock-sum))))
-      (while (re-search-forward (concat "^" outline-regexp) end t)
+      (while (re-search-forward org-outline-regexp-bol end t)
 	(if (and org-columns-skip-archived-trees
 	(if (and org-columns-skip-archived-trees
 		 (looking-at (concat ".*:" org-archive-tag ":")))
 		 (looking-at (concat ".*:" org-archive-tag ":")))
 	    (org-end-of-subtree t)
 	    (org-end-of-subtree t)
@@ -1097,7 +1097,7 @@ Don't set this, this is meant for dynamic scoping.")
 (defun org-columns-compute (property)
 (defun org-columns-compute (property)
   "Sum the values of property PROPERTY hierarchically, for the entire buffer."
   "Sum the values of property PROPERTY hierarchically, for the entire buffer."
   (interactive)
   (interactive)
-  (let* ((re (concat "^" outline-regexp))
+  (let* ((re org-outline-regexp-bol)
 	 (lmax 30) ; Does anyone use deeper levels???
 	 (lmax 30) ; Does anyone use deeper levels???
 	 (lvals (make-vector lmax nil))
 	 (lvals (make-vector lmax nil))
 	 (lflag (make-vector lmax nil))
 	 (lflag (make-vector lmax nil))

+ 2 - 2
lisp/org-colview.el

@@ -696,7 +696,7 @@ around it."
 	  (save-restriction
 	  (save-restriction
 	    (narrow-to-region beg end)
 	    (narrow-to-region beg end)
 	    (org-clock-sum))))
 	    (org-clock-sum))))
-      (while (re-search-forward (concat "^" outline-regexp) end t)
+      (while (re-search-forward org-outline-regexp-bol end t)
 	(if (and org-columns-skip-archived-trees
 	(if (and org-columns-skip-archived-trees
 		 (looking-at (concat ".*:" org-archive-tag ":")))
 		 (looking-at (concat ".*:" org-archive-tag ":")))
 	    (org-end-of-subtree t)
 	    (org-end-of-subtree t)
@@ -929,7 +929,7 @@ Don't set this, this is meant for dynamic scoping.")
 (defun org-columns-compute (property)
 (defun org-columns-compute (property)
   "Sum the values of property PROPERTY hierarchically, for the entire buffer."
   "Sum the values of property PROPERTY hierarchically, for the entire buffer."
   (interactive)
   (interactive)
-  (let* ((re (concat "^" outline-regexp))
+  (let* ((re org-outline-regexp-bol)
 	 (lmax 30) ; Does anyone use deeper levels???
 	 (lmax 30) ; Does anyone use deeper levels???
 	 (lvals (make-vector lmax nil))
 	 (lvals (make-vector lmax nil))
 	 (lflag (make-vector lmax nil))
 	 (lflag (make-vector lmax nil))

+ 1 - 1
lisp/org-docbook.el

@@ -651,7 +651,7 @@ publishing directory."
 	(catch 'nextline
 	(catch 'nextline
 
 
 	  ;; End of quote section?
 	  ;; End of quote section?
-	  (when (and inquote (string-match "^\\*+ " line))
+	  (when (and inquote (string-match org-outline-regexp-bol line))
 	    (insert "]]></programlisting>\n")
 	    (insert "]]></programlisting>\n")
 	    (org-export-docbook-open-para)
 	    (org-export-docbook-open-para)
 	    (setq inquote nil))
 	    (setq inquote nil))

+ 0 - 1
lisp/org-exp.el

@@ -1083,7 +1083,6 @@ on this string to produce the exported version."
 	 (archived-trees (plist-get parameters :archived-trees))
 	 (archived-trees (plist-get parameters :archived-trees))
 	 (inhibit-read-only t)
 	 (inhibit-read-only t)
 	 (drawers org-drawers)
 	 (drawers org-drawers)
-	 (outline-regexp "\\*+ ")
 	 (source-buffer (current-buffer))
 	 (source-buffer (current-buffer))
 	 target-alist rtn)
 	 target-alist rtn)
 
 

+ 6 - 3
lisp/org-footnote.el

@@ -230,7 +230,9 @@ The return value will be nil if not at a footnote definition, and a list with
 label, start, end and definition of the footnote otherwise."
 label, start, end and definition of the footnote otherwise."
   (save-excursion
   (save-excursion
     (end-of-line)
     (end-of-line)
-    (let ((lim (save-excursion (re-search-backward "^\\*+ \\|^[ \t]*$" nil t))))
+    (let ((lim (save-excursion (re-search-backward
+				(concat org-outline-regexp-bol
+					"\\|^[ \t]*$") nil t))))
       (when (re-search-backward org-footnote-definition-re lim t)
       (when (re-search-backward org-footnote-definition-re lim t)
 	(end-of-line)
 	(end-of-line)
 	(list (match-string 2)
 	(list (match-string 2)
@@ -245,7 +247,8 @@ label, start, end and definition of the footnote otherwise."
 		  (or (and (re-search-forward
 		  (or (and (re-search-forward
 			    (org-re
 			    (org-re
 			     (concat "^[ \t]*$" "\\|"
 			     (concat "^[ \t]*$" "\\|"
-				     "^\\*+ " "\\|"
+				     org-outline-regexp-bol
+				     "\\|"
 				     "^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]"))
 				     "^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]"))
 			    bound 'move)
 			    bound 'move)
 			   (progn (skip-chars-forward " \t\n") (point-at-bol)))
 			   (progn (skip-chars-forward " \t\n") (point-at-bol)))
@@ -569,7 +572,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
 		      (if org-odd-levels-only
 		      (if org-odd-levels-only
 			  (and limit-level (1- (* limit-level 2)))
 			  (and limit-level (1- (* limit-level 2)))
 			limit-level)))
 			limit-level)))
-	 (outline-regexp
+	 (org-outline-regexp
 	  (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ ")))
 	  (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ ")))
 	 ;; Determine the highest marker used so far.
 	 ;; Determine the highest marker used so far.
 	 (ref-table (when export-props org-export-footnotes-seen))
 	 (ref-table (when export-props org-export-footnotes-seen))

+ 1 - 1
lisp/org-html.el

@@ -1439,7 +1439,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	(catch 'nextline
 	(catch 'nextline
 
 
 	  ;; end of quote section?
 	  ;; end of quote section?
-	  (when (and inquote (string-match "^\\*+ " line))
+	  (when (and inquote (string-match org-outline-regexp-bol line))
 	    (insert "</pre>\n")
 	    (insert "</pre>\n")
 	    (org-open-par)
 	    (org-open-par)
 	    (setq inquote nil))
 	    (setq inquote nil))

+ 3 - 3
lisp/org-indent.el

@@ -217,7 +217,7 @@ useful to make it ever so slightly different."
 			  '(line-prefix nil wrap-prefix nil) string)
 			  '(line-prefix nil wrap-prefix nil) string)
   string)
   string)
 
 
-(defvar org-indent-outline-re (concat "^" org-outline-regexp)
+(defvar org-indent-outline-re org-outline-regexp-bol
   "Outline heading regexp.")
   "Outline heading regexp.")
 
 
 (defun org-indent-add-properties (beg end)
 (defun org-indent-add-properties (beg end)
@@ -273,7 +273,7 @@ Point is assumed to be at the beginning of a headline."
   (when org-indent-mode
   (when org-indent-mode
     (let (beg end)
     (let (beg end)
       (save-excursion
       (save-excursion
-	(when (ignore-errors (let ((outline-regexp (format "\\*\\{1,%s\\}[ \t]+"
+	(when (ignore-errors (let ((org-outline-regexp (format "\\*\\{1,%s\\}[ \t]+"
 				(if (featurep 'org-inlinetask)
 				(if (featurep 'org-inlinetask)
 				    (1- org-inlinetask-min-level)
 				    (1- org-inlinetask-min-level)
 				  ""))))
 				  ""))))
@@ -290,7 +290,7 @@ Point is assumed to be at the beginning of a headline."
   (when org-indent-mode
   (when org-indent-mode
     (let ((beg (point)) (end limit))
     (let ((beg (point)) (end limit))
       (save-excursion
       (save-excursion
-	(and (ignore-errors (let ((outline-regexp (format "\\*\\{1,%s\\}[ \t]+"
+	(and (ignore-errors (let ((org-outline-regexp (format "\\*\\{1,%s\\}[ \t]+"
 				(if (featurep 'org-inlinetask)
 				(if (featurep 'org-inlinetask)
 				    (1- org-inlinetask-min-level)
 				    (1- org-inlinetask-min-level)
 				  ""))))
 				  ""))))

+ 2 - 2
lisp/org-macs.el

@@ -347,7 +347,7 @@ point nowhere."
 
 
 (defmacro org-with-limited-levels (&rest body)
 (defmacro org-with-limited-levels (&rest body)
   "Execute BODY with limited number of outline levels."
   "Execute BODY with limited number of outline levels."
-  `(let* ((outline-regexp (org-get-limited-outline-regexp)))
+  `(let* ((org-outline-regexp (org-get-limited-outline-regexp)))
      ,@body))
      ,@body))
 
 
 (defvar org-odd-levels-only) ; defined in org.el
 (defvar org-odd-levels-only) ; defined in org.el
@@ -356,7 +356,7 @@ point nowhere."
   "Return outline-regexp with limited number of levels.
   "Return outline-regexp with limited number of levels.
 The number of levels is controlled by `org-inlinetask-min-level'"
 The number of levels is controlled by `org-inlinetask-min-level'"
   (if (or (not (org-mode-p)) (not (featurep 'org-inlinetask)))
   (if (or (not (org-mode-p)) (not (featurep 'org-inlinetask)))
-      outline-regexp
+      org-outline-regexp
     (let* ((limit-level (1- org-inlinetask-min-level))
     (let* ((limit-level (1- org-inlinetask-min-level))
 	   (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
 	   (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
       (format "\\*\\{1,%d\\} " nstars))))
       (format "\\*\\{1,%d\\} " nstars))))

+ 5 - 5
lisp/org-mouse.el

@@ -635,7 +635,7 @@ This means, between the beginning of line and the point."
 (defun org-mouse-match-todo-keyword ()
 (defun org-mouse-match-todo-keyword ()
   (save-excursion
   (save-excursion
     (org-back-to-heading)
     (org-back-to-heading)
-    (if (looking-at outline-regexp) (goto-char (match-end 0)))
+    (if (looking-at org-outline-regexp) (goto-char (match-end 0)))
     (or (looking-at (concat " +" org-todo-regexp " *"))
     (or (looking-at (concat " +" org-todo-regexp " *"))
 	(looking-at " \\( *\\)"))))
 	(looking-at " \\( *\\)"))))
 
 
@@ -927,7 +927,7 @@ This means, between the beginning of line and the point."
      (when (memq 'activate-stars org-mouse-features)
      (when (memq 'activate-stars org-mouse-features)
        (font-lock-add-keywords
        (font-lock-add-keywords
 	nil
 	nil
-	`((,outline-regexp
+	`((,org-outline-regexp
 	   0 `(face org-link mouse-face highlight keymap ,org-mouse-map)
 	   0 `(face org-link mouse-face highlight keymap ,org-mouse-map)
 	   'prepend))
 	   'prepend))
 	t))
 	t))
@@ -999,7 +999,7 @@ This means, between the beginning of line and the point."
 	(end-of-line)
 	(end-of-line)
 	(if (eobp) (newline) (forward-char)))
 	(if (eobp) (newline) (forward-char)))
 
 
-      (when (looking-at outline-regexp)
+      (when (looking-at org-outline-regexp)
 	(let ((level (- (match-end 0) (match-beginning 0))))
 	(let ((level (- (match-end 0) (match-beginning 0))))
 	  (when (> end (match-end 0))
 	  (when (> end (match-end 0))
 	    (outline-end-of-subtree)
 	    (outline-end-of-subtree)
@@ -1019,11 +1019,11 @@ This means, between the beginning of line and the point."
 	(replace-text (concat (match-string 0) "* ")))
 	(replace-text (concat (match-string 0) "* ")))
     (beginning-of-line 2)
     (beginning-of-line 2)
     (save-excursion
     (save-excursion
-      (while (not (or (eobp) (looking-at outline-regexp)))
+      (while (not (or (eobp) (looking-at org-outline-regexp)))
 	(when (looking-at org-mouse-plain-list-regexp)
 	(when (looking-at org-mouse-plain-list-regexp)
 	  (setq minlevel (min minlevel (- (match-end 1) (match-beginning 1)))))
 	  (setq minlevel (min minlevel (- (match-end 1) (match-beginning 1)))))
 	(forward-line)))
 	(forward-line)))
-    (while (not (or (eobp) (looking-at outline-regexp)))
+    (while (not (or (eobp) (looking-at org-outline-regexp)))
       (when (and (looking-at org-mouse-plain-list-regexp)
       (when (and (looking-at org-mouse-plain-list-regexp)
 		 (eq minlevel (- (match-end 1) (match-beginning 1))))
 		 (eq minlevel (- (match-end 1) (match-beginning 1))))
 	(replace-match replace-text))
 	(replace-match replace-text))

+ 1 - 1
lisp/org-remember.el

@@ -1072,7 +1072,7 @@ See also the variable `org-reverse-note-order'."
 		   (save-restriction
 		   (save-restriction
 		     (widen)
 		     (widen)
 		     (goto-char (point-min))
 		     (goto-char (point-min))
-		     (re-search-forward "^\\*+ " nil t)
+		     (re-search-forward org-outline-regexp-bol nil t)
 		     (beginning-of-line 1)
 		     (beginning-of-line 1)
 		     (org-paste-subtree 1 txt)
 		     (org-paste-subtree 1 txt)
 		     (and org-auto-align-tags (org-set-tags nil t))
 		     (and org-auto-align-tags (org-set-tags nil t))

+ 58 - 57
lisp/org.el

@@ -4696,6 +4696,7 @@ This variable is set by `org-before-change-function'.
 (defvar org-inhibit-blocking nil)       ; Dynamically-scoped param.
 (defvar org-inhibit-blocking nil)       ; Dynamically-scoped param.
 (defvar org-table-buffer-is-an nil)
 (defvar org-table-buffer-is-an nil)
 (defconst org-outline-regexp "\\*+ ")
 (defconst org-outline-regexp "\\*+ ")
+(defconst org-outline-regexp-bol "^\\*+ ")
 
 
 ;;;###autoload
 ;;;###autoload
 (define-derived-mode org-mode outline-mode "Org"
 (define-derived-mode org-mode outline-mode "Org"
@@ -5529,7 +5530,7 @@ by `outline-regexp'.  Otherwise it returns garbage.
 If this is called at a normal headline, the level is the number of stars.
 If this is called at a normal headline, the level is the number of stars.
 Use `org-reduced-level' to remove the effect of `org-odd-levels'."
 Use `org-reduced-level' to remove the effect of `org-odd-levels'."
   (save-excursion
   (save-excursion
-    (looking-at outline-regexp)
+    (looking-at org-outline-regexp)
     (1- (- (match-end 0) (match-beginning 0)))))
     (1- (- (match-end 0) (match-beginning 0)))))
 
 
 (defvar org-font-lock-keywords nil)
 (defvar org-font-lock-keywords nil)
@@ -5622,7 +5623,9 @@ needs to be inserted at a specific position in the font-lock sequence.")
 	   '("^[ \t]*[-+*][ \t]+\\(.*?[ \t]+::\\)\\([ \t]+\\|$\\)"
 	   '("^[ \t]*[-+*][ \t]+\\(.*?[ \t]+::\\)\\([ \t]+\\|$\\)"
 	     1 'bold prepend)
 	     1 'bold prepend)
 	   ;; ARCHIVEd headings
 	   ;; ARCHIVEd headings
-	   (list (concat "^\\*+ \\(.*:" org-archive-tag ":.*\\)")
+	   (list (concat
+		  org-outline-regexp-bol
+		  "\\(.*:" org-archive-tag ":.*\\)")
 		 '(1 'org-archived prepend))
 		 '(1 'org-archived prepend))
 	   ;; Specials
 	   ;; Specials
 	   '(org-do-latex-and-special-faces)
 	   '(org-do-latex-and-special-faces)
@@ -5905,12 +5908,12 @@ in special contexts.
 		      (if org-odd-levels-only
 		      (if org-odd-levels-only
 			  (and limit-level (1- (* limit-level 2)))
 			  (and limit-level (1- (* limit-level 2)))
 			limit-level)))
 			limit-level)))
-	   (outline-regexp
+	   (org-outline-regexp
 	    (if (not (org-mode-p))
 	    (if (not (org-mode-p))
 		outline-regexp
 		outline-regexp
 	      (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ "))))
 	      (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ "))))
 	   (bob-special (and org-cycle-global-at-bob (not arg) (bobp)
 	   (bob-special (and org-cycle-global-at-bob (not arg) (bobp)
-			     (not (looking-at outline-regexp))))
+			     (not (looking-at org-outline-regexp))))
 	   (org-cycle-hook
 	   (org-cycle-hook
 	    (if bob-special
 	    (if bob-special
 		(delq 'org-optimize-window-after-visibility-change
 		(delq 'org-optimize-window-after-visibility-change
@@ -5972,7 +5975,7 @@ in special contexts.
        ;; At an item/headline: delegate to `org-cycle-internal-local'.
        ;; At an item/headline: delegate to `org-cycle-internal-local'.
        ((and (or (and org-cycle-include-plain-lists (org-at-item-p))
        ((and (or (and org-cycle-include-plain-lists (org-at-item-p))
 		 (save-excursion (beginning-of-line 1)
 		 (save-excursion (beginning-of-line 1)
-				 (looking-at outline-regexp)))
+				 (looking-at org-outline-regexp)))
 	     (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
 	     (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
 	(org-cycle-internal-local))
 	(org-cycle-internal-local))
 
 
@@ -5991,7 +5994,7 @@ in special contexts.
 
 
        ((and (eq org-cycle-emulate-tab 'exc-hl-bol)
        ((and (eq org-cycle-emulate-tab 'exc-hl-bol)
 	     (or (not (bolp))
 	     (or (not (bolp))
-		 (not (looking-at outline-regexp))))
+		 (not (looking-at org-outline-regexp))))
 	(call-interactively (global-key-binding "\t")))
 	(call-interactively (global-key-binding "\t")))
 
 
        ((if (and (memq org-cycle-emulate-tab '(white whitestart))
        ((if (and (memq org-cycle-emulate-tab '(white whitestart))
@@ -6213,7 +6216,7 @@ results."
   (interactive)
   (interactive)
   (let ((level (save-excursion
   (let ((level (save-excursion
 		 (goto-char (point-min))
 		 (goto-char (point-min))
-		 (if (re-search-forward (concat "^" outline-regexp) nil t)
+		 (if (re-search-forward org-outline-regexp-bol nil t)
 		     (progn
 		     (progn
 		       (goto-char (match-beginning 0))
 		       (goto-char (match-beginning 0))
 		       (funcall outline-level))))))
 		       (funcall outline-level))))))
@@ -6232,7 +6235,7 @@ With numerical argument N, show content up to level N."
 			     (outline-previous-visible-heading 1)
 			     (outline-previous-visible-heading 1)
 			   (error (goto-char (point-min))))
 			   (error (goto-char (point-min))))
 			 t)
 			 t)
-		  (looking-at outline-regexp))
+		  (looking-at org-outline-regexp))
 	(if (integerp arg)
 	(if (integerp arg)
 	    (show-children (1- arg))
 	    (show-children (1- arg))
 	  (show-branches))
 	  (show-branches))
@@ -6385,8 +6388,7 @@ open and agenda-wise Org files."
   (save-excursion
   (save-excursion
     (beginning-of-line 1)
     (beginning-of-line 1)
     (when (looking-at "^[ \t]*:[a-zA-Z][a-zA-Z0-9]*:")
     (when (looking-at "^[ \t]*:[a-zA-Z][a-zA-Z0-9]*:")
-      (let ((b (match-end 0))
-	    (outline-regexp org-outline-regexp))
+      (let ((b (match-end 0)))
 	(if (re-search-forward
 	(if (re-search-forward
 	     "^[ \t]*:END:"
 	     "^[ \t]*:END:"
 	     (save-excursion (outline-next-heading) (point)) t)
 	     (save-excursion (outline-next-heading) (point)) t)
@@ -6402,7 +6404,7 @@ open and agenda-wise Org files."
   "Move cursor to the first headline and recenter the headline.
   "Move cursor to the first headline and recenter the headline.
 Optional argument N means put the headline into the Nth line of the window."
 Optional argument N means put the headline into the Nth line of the window."
   (goto-char (point-min))
   (goto-char (point-min))
-  (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t)
+  (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t)
     (beginning-of-line)
     (beginning-of-line)
     (recenter (prefix-numeric-value N))))
     (recenter (prefix-numeric-value N))))
 
 
@@ -7027,7 +7029,7 @@ state (TODO by default).  Also with prefix arg, force first state."
 	    'org-todo-get-default-hook new-mark-x nil)
 	    'org-todo-get-default-hook new-mark-x nil)
 	   new-mark-x)))
 	   new-mark-x)))
       (beginning-of-line 1)
       (beginning-of-line 1)
-      (and (looking-at "\\*+ ") (goto-char (match-end 0))
+      (and (looking-at org-outline-regexp) (goto-char (match-end 0))
 	   (if org-treat-insert-todo-heading-as-state-change
 	   (if org-treat-insert-todo-heading-as-state-change
 	       (org-todo new-mark)
 	       (org-todo new-mark)
 	     (insert new-mark " "))))
 	     (insert new-mark " "))))
@@ -7255,7 +7257,7 @@ After top level, it switches back to sibling level."
     (save-excursion
     (save-excursion
       (setq end (copy-marker end))
       (setq end (copy-marker end))
       (goto-char beg)
       (goto-char beg)
-      (if (and (re-search-forward (concat "^" outline-regexp) nil t)
+      (if (and (re-search-forward org-outline-regexp-bol nil t)
 	       (< (point) end))
 	       (< (point) end))
 	  (funcall fun))
 	  (funcall fun))
       (while (and (progn
       (while (and (progn
@@ -7291,8 +7293,7 @@ This will leave level 1 alone, convert level 2 to level 3, level 3 to
 level 5 etc."
 level 5 etc."
   (interactive)
   (interactive)
   (when (yes-or-no-p "Are you sure you want to globally change levels to odd? ")
   (when (yes-or-no-p "Are you sure you want to globally change levels to odd? ")
-    (let ((outline-regexp org-outline-regexp)
-	  (outline-level 'org-outline-level)
+    (let ((outline-level 'org-outline-level)
 	  (org-odd-levels-only nil) n)
 	  (org-odd-levels-only nil) n)
       (save-excursion
       (save-excursion
 	(goto-char (point-min))
 	(goto-char (point-min))
@@ -7369,7 +7370,7 @@ case."
 	(setq beg (point))))
 	(setq beg (point))))
     ;; Find insertion point, with error handling
     ;; Find insertion point, with error handling
     (while (> cnt 0)
     (while (> cnt 0)
-      (or (and (funcall movfunc) (looking-at outline-regexp))
+      (or (and (funcall movfunc) (looking-at org-outline-regexp))
 	  (progn (goto-char beg0)
 	  (progn (goto-char beg0)
 		 (error "Cannot move past superior level or buffer limit")))
 		 (error "Cannot move past superior level or buffer limit")))
       (setq cnt (1- cnt)))
       (setq cnt (1- cnt)))
@@ -7499,8 +7500,8 @@ the inserted text when done."
       "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway")))
       "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway")))
   (let* ((visp (not (outline-invisible-p)))
   (let* ((visp (not (outline-invisible-p)))
 	 (txt tree)
 	 (txt tree)
-	 (^re (concat "^\\(" outline-regexp "\\)"))
-	 (re  (concat "\\(" outline-regexp "\\)"))
+	 (^re (concat "^\\(" org-outline-regexp "\\)"))
+	 (re  (concat "\\(" org-outline-regexp "\\)"))
 	 (^re_ (concat "\\(\\*+\\)[  \t]*"))
 	 (^re_ (concat "\\(\\*+\\)[  \t]*"))
 
 
 	 (old-level (if (string-match ^re txt)
 	 (old-level (if (string-match ^re txt)
@@ -7527,7 +7528,7 @@ the inserted text when done."
 	 (next-level (save-excursion
 	 (next-level (save-excursion
 		       (condition-case nil
 		       (condition-case nil
 			   (progn
 			   (progn
-			     (or (looking-at outline-regexp)
+			     (or (looking-at org-outline-regexp)
 				 (outline-next-visible-heading 1))
 				 (outline-next-visible-heading 1))
 			     (if (looking-at re)
 			     (if (looking-at re)
 				 (- (match-end 0) (match-beginning 0) 1)
 				 (- (match-end 0) (match-beginning 0) 1)
@@ -7593,7 +7594,7 @@ If optional TXT is given, check this string instead of the current kill."
 						 org-outline-regexp "\\)")
 						 org-outline-regexp "\\)")
 					 kill)
 					 kill)
 			   (- (match-end 2) (match-beginning 2) 1)))
 			   (- (match-end 2) (match-beginning 2) 1)))
-	 (re (concat "^" org-outline-regexp))
+	 (re org-outline-regexp-bol)
 	 (start (1+ (or (match-beginning 2) -1))))
 	 (start (1+ (or (match-beginning 2) -1))))
     (if (not start-level)
     (if (not start-level)
 	(progn
 	(progn
@@ -8230,8 +8231,7 @@ Possible values in the list of contexts are `table', `headline', and `item'."
     (prog1 (or (and (memq 'table contexts)
     (prog1 (or (and (memq 'table contexts)
 		    (looking-at "[ \t]*|"))
 		    (looking-at "[ \t]*|"))
 	       (and (memq 'headline contexts)
 	       (and (memq 'headline contexts)
-;;?????????		    (looking-at "\\*+"))
-		    (looking-at outline-regexp))
+		    (looking-at org-outline-regexp))
 	       (and (memq 'item contexts)
 	       (and (memq 'item contexts)
 		    (looking-at "[ \t]*\\([-+*] \\|[0-9]+[.)] \\)"))
 		    (looking-at "[ \t]*\\([-+*] \\|[0-9]+[.)] \\)"))
 	       (and (memq 'item-body contexts)
 	       (and (memq 'item-body contexts)
@@ -10430,7 +10430,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
 		  (if pos
 		  (if pos
 		      (progn
 		      (progn
 			(goto-char pos)
 			(goto-char pos)
-			(looking-at outline-regexp)
+			(looking-at org-outline-regexp)
 			(setq level (org-get-valid-level (funcall outline-level) 1))
 			(setq level (org-get-valid-level (funcall outline-level) 1))
 			(goto-char
 			(goto-char
 			 (if reversed
 			 (if reversed
@@ -10575,7 +10575,7 @@ this function appends the default value from
 	      (goto-char pos)
 	      (goto-char pos)
 	    (goto-char (point-max))
 	    (goto-char (point-max))
 	    (if (not (bolp)) (newline)))
 	    (if (not (bolp)) (newline)))
-	  (when (looking-at outline-regexp)
+	  (when (looking-at org-outline-regexp)
 	    (setq level (funcall outline-level))
 	    (setq level (funcall outline-level))
 	    (org-end-of-subtree t t))
 	    (org-end-of-subtree t t))
 	  (org-back-over-empty-lines)
 	  (org-back-over-empty-lines)
@@ -10873,10 +10873,10 @@ expands them."
   (save-excursion
   (save-excursion
     (org-back-to-heading)
     (org-back-to-heading)
     (let (case-fold-search)
     (let (case-fold-search)
-      (if (looking-at (concat outline-regexp
+      (if (looking-at (concat org-outline-regexp
 			      "\\( *\\<" org-comment-string "\\>[ \t]*\\)"))
 			      "\\( *\\<" org-comment-string "\\>[ \t]*\\)"))
 	  (replace-match "" t t nil 1)
 	  (replace-match "" t t nil 1)
-	(if (looking-at outline-regexp)
+	(if (looking-at org-outline-regexp)
 	    (progn
 	    (progn
 	      (goto-char (match-end 0))
 	      (goto-char (match-end 0))
 	      (insert org-comment-string " ")))))))
 	      (insert org-comment-string " ")))))))
@@ -10941,7 +10941,7 @@ For calling through lisp, arg is also interpreted in the following way:
     (save-excursion
     (save-excursion
       (catch 'exit
       (catch 'exit
 	(org-back-to-heading t)
 	(org-back-to-heading t)
-	(if (looking-at outline-regexp) (goto-char (1- (match-end 0))))
+	(if (looking-at org-outline-regexp) (goto-char (1- (match-end 0))))
 	(or (looking-at (concat " +" org-todo-regexp "\\( +\\|$\\)"))
 	(or (looking-at (concat " +" org-todo-regexp "\\( +\\|$\\)"))
 	    (looking-at " *"))
 	    (looking-at " *"))
 	(let* ((match-data (match-data))
 	(let* ((match-data (match-data))
@@ -11656,7 +11656,7 @@ of `org-todo-keywords-1'."
 				   org-todo-keywords-1)))
 				   org-todo-keywords-1)))
 	       (t (error "Invalid prefix argument: %s" arg)))))
 	       (t (error "Invalid prefix argument: %s" arg)))))
     (message "%d TODO entries found"
     (message "%d TODO entries found"
-	     (org-occur (concat "^" outline-regexp " *" kwd-re )))))
+	     (org-occur (concat "^" org-outline-regexp " *" kwd-re )))))
 
 
 (defun org-deadline (&optional remove time)
 (defun org-deadline (&optional remove time)
   "Insert the \"DEADLINE:\" string with a timestamp to make a deadline.
   "Insert the \"DEADLINE:\" string with a timestamp to make a deadline.
@@ -11812,7 +11812,7 @@ be removed."
 	(save-restriction
 	(save-restriction
 	  (let (col list elt ts buffer-invisibility-spec)
 	  (let (col list elt ts buffer-invisibility-spec)
 	    (org-back-to-heading t)
 	    (org-back-to-heading t)
-	    (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"))
+	    (looking-at (concat org-outline-regexp "\\( *\\)[^\r\n]*"))
 	    (goto-char (match-end 1))
 	    (goto-char (match-end 1))
 	    (setq col (current-column))
 	    (setq col (current-column))
 	    (goto-char (match-end 0))
 	    (goto-char (match-end 0))
@@ -11823,7 +11823,7 @@ be removed."
 				     org-keyword-time-not-clock-regexp))))
 				     org-keyword-time-not-clock-regexp))))
 	      ;; Nothing to add, nothing to remove...... :-)
 	      ;; Nothing to add, nothing to remove...... :-)
 	      (throw 'exit nil))
 	      (throw 'exit nil))
-	    (if (and (not (looking-at outline-regexp))
+	    (if (and (not (looking-at org-outline-regexp))
 		     (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp
 		     (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp
 					 "[^\r\n]*"))
 					 "[^\r\n]*"))
 		     (not (equal (match-string 1) org-clock-string)))
 		     (not (equal (match-string 1) org-clock-string)))
@@ -11909,7 +11909,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
 	  (org-back-to-heading t)
 	  (org-back-to-heading t)
 	  (narrow-to-region (point) (save-excursion
 	  (narrow-to-region (point) (save-excursion
 				      (outline-next-heading) (point)))
 				      (outline-next-heading) (point)))
-	  (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"
+	  (looking-at (concat org-outline-regexp "\\( *\\)[^\r\n]*"
 			      "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
 			      "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
 			      "[^\r\n]*\\)?"))
 			      "[^\r\n]*\\)?"))
 	  (goto-char (match-end 0))
 	  (goto-char (match-end 0))
@@ -12427,7 +12427,7 @@ MATCHER is a Lisp form to be evaluated, testing if a given set of tags
 qualifies a headline for inclusion.  When TODO-ONLY is non-nil,
 qualifies a headline for inclusion.  When TODO-ONLY is non-nil,
 only lines with a TODO keyword are included in the output."
 only lines with a TODO keyword are included in the output."
   (require 'org-agenda)
   (require 'org-agenda)
-  (let* ((re (concat "^" outline-regexp " *\\(\\<\\("
+  (let* ((re (concat "^" org-outline-regexp " *\\(\\<\\("
 		     (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
 		     (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
 		     (org-re
 		     (org-re
 		      "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@#%:]+:\\)?[ \t]*$")))
 		      "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@#%:]+:\\)?[ \t]*$")))
@@ -12988,7 +12988,7 @@ If DATA is nil or the empty string, any tags will be removed."
   "Set the tags for the current headline.
   "Set the tags for the current headline.
 With prefix ARG, realign all tags in headings in the current buffer."
 With prefix ARG, realign all tags in headings in the current buffer."
   (interactive "P")
   (interactive "P")
-  (let* ((re (concat "^" outline-regexp))
+  (let* ((re org-outline-regexp-bol)
 	 (current (org-get-tags-string))
 	 (current (org-get-tags-string))
 	 (col (current-column))
 	 (col (current-column))
 	 (org-setting-tags t)
 	 (org-setting-tags t)
@@ -14033,7 +14033,7 @@ formats in the current buffer."
   "Insert a property drawer into the current entry."
   "Insert a property drawer into the current entry."
   (interactive)
   (interactive)
   (org-back-to-heading t)
   (org-back-to-heading t)
-  (looking-at outline-regexp)
+  (looking-at org-outline-regexp)
   (let ((indent (if org-adapt-indentation
   (let ((indent (if org-adapt-indentation
 		    (- (match-end 0)(match-beginning 0))
 		    (- (match-end 0)(match-beginning 0))
 		  0))
 		  0))
@@ -16096,7 +16096,7 @@ When a buffer is unmodified, it is just killed.  When modified, it is saved
 		  (if (org-on-heading-p t)
 		  (if (org-on-heading-p t)
 		      (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
 		      (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
 	      (goto-char (point-min))
 	      (goto-char (point-min))
-	      (setq re (concat "^\\*+ +" org-comment-string "\\>"))
+	      (setq re (concat org-outline-regexp-bol "+" org-comment-string "\\>"))
 	      (while (re-search-forward re nil t)
 	      (while (re-search-forward re nil t)
 		(add-text-properties
 		(add-text-properties
 		 (match-beginning 0) (org-end-of-subtree t) pc)))
 		 (match-beginning 0) (org-end-of-subtree t) pc)))
@@ -16266,7 +16266,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
 	(cond
 	(cond
 	 ((or (equal subtree '(16))
 	 ((or (equal subtree '(16))
 	      (not (save-excursion
 	      (not (save-excursion
-		     (re-search-backward (concat "^" outline-regexp) nil t))))
+		     (re-search-backward org-outline-regexp-bol nil t))))
 	  (setq beg (point-min) end (point-max)
 	  (setq beg (point-min) end (point-max)
 		msg "Creating images for buffer...%s"))
 		msg "Creating images for buffer...%s"))
 	 ((equal subtree '(4))
 	 ((equal subtree '(4))
@@ -16920,7 +16920,7 @@ If not, return to the original position and throw an error."
   "Hook for activating single-letter speed commands.
   "Hook for activating single-letter speed commands.
 `org-speed-commands-default' specifies a minimal command set. Use
 `org-speed-commands-default' specifies a minimal command set. Use
 `org-speed-commands-user' for further customization."
 `org-speed-commands-user' for further customization."
-  (when (or (and (bolp) (looking-at outline-regexp))
+  (when (or (and (bolp) (looking-at org-outline-regexp))
 	    (and (functionp org-use-speed-commands)
 	    (and (functionp org-use-speed-commands)
 		 (funcall org-use-speed-commands)))
 		 (funcall org-use-speed-commands)))
     (cdr (assoc keys (append org-speed-commands-user
     (cdr (assoc keys (append org-speed-commands-user
@@ -17347,7 +17347,7 @@ WHAT can be either `headlines' or `items'.  If the current line is
 an outline or item heading and it has a folded subtree below it,
 an outline or item heading and it has a folded subtree below it,
 this function returns t, nil otherwise."
 this function returns t, nil otherwise."
   (let ((re (cond
   (let ((re (cond
-	     ((eq what 'headlines) (concat "^" org-outline-regexp))
+	     ((eq what 'headlines) org-outline-regexp-bol)
 	     ((eq what 'items) (org-item-beginning-re))
 	     ((eq what 'items) (org-item-beginning-re))
 	     (t (error "This should not happen"))))
 	     (t (error "This should not happen"))))
 	beg end)
 	beg end)
@@ -17882,7 +17882,7 @@ argument ARG, change each line in region into an item."
 		      (cond
 		      (cond
 		       ;; Skip blank lines and inline tasks.
 		       ;; Skip blank lines and inline tasks.
 		       ((looking-at "^[ \t]*$"))
 		       ((looking-at "^[ \t]*$"))
-		       ((looking-at "^\\*+ "))
+		       ((looking-at org-outline-regexp-bol))
 		       ;; We can't find less than 0 indentation.
 		       ;; We can't find less than 0 indentation.
 		       ((zerop i) (throw 'exit (setq min-i 0)))
 		       ((zerop i) (throw 'exit (setq min-i 0)))
 		       ((< i min-i) (setq min-i i))))
 		       ((< i min-i) (setq min-i i))))
@@ -17893,7 +17893,7 @@ argument ARG, change each line in region into an item."
 	      (let ((delta (- ind min-i)))
 	      (let ((delta (- ind min-i)))
 		(while (< (point) end)
 		(while (< (point) end)
 		  (unless (or (looking-at "^[ \t]*$")
 		  (unless (or (looking-at "^[ \t]*$")
-			      (looking-at "^\\*+ "))
+			      (looking-at org-outline-regexp-bol))
 		    (org-indent-line-to (+ (org-get-indentation) delta)))
 		    (org-indent-line-to (+ (org-get-indentation) delta)))
 		  (forward-line)))))))
 		  (forward-line)))))))
 	(skip-blanks
 	(skip-blanks
@@ -18030,7 +18030,7 @@ stars to add."
 	((org-on-heading-p)
 	((org-on-heading-p)
 	 (while (< (point) end)
 	 (while (< (point) end)
 	   (when (org-on-heading-p t)
 	   (when (org-on-heading-p t)
-	     (looking-at outline-regexp) (replace-match ""))
+	     (looking-at org-outline-regexp) (replace-match ""))
 	   (forward-line)))
 	   (forward-line)))
 	;; Case 2. Started at an item: change items into headlines.
 	;; Case 2. Started at an item: change items into headlines.
 	;;         One star will be added by `org-list-to-subtree'.
 	;;         One star will be added by `org-list-to-subtree'.
@@ -19271,7 +19271,7 @@ If point is in an inline task, mark that task instead."
      ;; Comments
      ;; Comments
      ((looking-at "# ") (setq column 0))
      ((looking-at "# ") (setq column 0))
      ;; Headings
      ;; Headings
-     ((looking-at "\\*+ ") (setq column 0))
+     ((looking-at org-outline-regexp) (setq column 0))
      ;; Included files
      ;; Included files
      ((looking-at "#\\+include:") (setq column 0))
      ((looking-at "#\\+include:") (setq column 0))
      ;; Footnote definition
      ;; Footnote definition
@@ -19380,7 +19380,7 @@ the functionality can be provided as a fall-back.")
    (concat
    (concat
     "\f" "\\|"
     "\f" "\\|"
     "[ 	]*$" "\\|"
     "[ 	]*$" "\\|"
-    "\\*+ " "\\|"
+    org-outline-regexp "\\|"
     "[ \t]*#" "\\|"
     "[ \t]*#" "\\|"
     (org-item-re) "\\|"
     (org-item-re) "\\|"
     "[ \t]*[:|]" "\\|"
     "[ \t]*[:|]" "\\|"
@@ -19390,7 +19390,8 @@ the functionality can be provided as a fall-back.")
   ;; But only if the user has not turned off tables or fixed-width regions
   ;; But only if the user has not turned off tables or fixed-width regions
   (org-set-local
   (org-set-local
    'auto-fill-inhibit-regexp
    'auto-fill-inhibit-regexp
-   (concat "\\*+ \\|#\\+"
+   (concat org-outline-regexp
+	   "\\|#\\+"
 	   "\\|[ \t]*" org-keyword-time-regexp
 	   "\\|[ \t]*" org-keyword-time-regexp
 	   (if (or org-enable-table-editor org-enable-fixed-width-editor)
 	   (if (or org-enable-table-editor org-enable-fixed-width-editor)
 	       (concat
 	       (concat
@@ -19433,7 +19434,7 @@ the functionality can be provided as a fall-back.")
 	(itemp (org-in-item-p)))
 	(itemp (org-in-item-p)))
     (cond ((and (equal (char-after (point-at-bol)) ?*)
     (cond ((and (equal (char-after (point-at-bol)) ?*)
 		(save-excursion (goto-char (point-at-bol))
 		(save-excursion (goto-char (point-at-bol))
-				(looking-at outline-regexp)))
+				(looking-at org-outline-regexp)))
 	   t)				; skip headlines
 	   t)				; skip headlines
 	  (table.el-p t)		; skip table.el tables
 	  (table.el-p t)		; skip table.el tables
 	  (table-p (org-table-align) t)	; align Org tables
 	  (table-p (org-table-align) t)	; align Org tables
@@ -19577,10 +19578,10 @@ this line is also exported in fixed-width font."
 	    (forward-line 1)))
 	    (forward-line 1)))
       (save-excursion
       (save-excursion
 	(org-back-to-heading)
 	(org-back-to-heading)
-	(if (looking-at (concat outline-regexp
+	(if (looking-at (concat org-outline-regexp
 				"\\( *\\<" org-quote-string "\\>[ \t]*\\)"))
 				"\\( *\\<" org-quote-string "\\>[ \t]*\\)"))
 	    (replace-match "" t t nil 1)
 	    (replace-match "" t t nil 1)
-	  (if (looking-at outline-regexp)
+	  (if (looking-at org-outline-regexp)
 	      (progn
 	      (progn
 		(goto-char (match-end 0))
 		(goto-char (match-end 0))
 		(insert org-quote-string " "))))))))
 		(insert org-quote-string " "))))))))
@@ -19807,9 +19808,9 @@ interactive command with similar behavior."
 	  (when (and (bolp) subtreep
 	  (when (and (bolp) subtreep
 		     (not (setq swallowp
 		     (not (setq swallowp
 				(org-yank-folding-would-swallow-text beg end))))
 				(org-yank-folding-would-swallow-text beg end))))
-	    (or (looking-at outline-regexp)
-		(re-search-forward (concat "^" outline-regexp) end t))
-	    (while (and (< (point) end) (looking-at outline-regexp))
+	    (or (looking-at org-outline-regexp)
+		(re-search-forward org-outline-regexp-bol end t))
+	    (while (and (< (point) end) (looking-at org-outline-regexp))
 	      (hide-subtree)
 	      (hide-subtree)
 	      (org-cycle-show-empty-lines 'folded)
 	      (org-cycle-show-empty-lines 'folded)
 	      (condition-case nil
 	      (condition-case nil
@@ -19835,8 +19836,8 @@ interactive command with similar behavior."
   (let (level)
   (let (level)
     (save-excursion
     (save-excursion
       (goto-char beg)
       (goto-char beg)
-      (when (or (looking-at outline-regexp)
-		(re-search-forward (concat "^" outline-regexp) end t))
+      (when (or (looking-at org-outline-regexp)
+		(re-search-forward org-outline-regexp-bol end t))
 	(setq level (org-outline-level)))
 	(setq level (org-outline-level)))
       (goto-char end)
       (goto-char end)
       (skip-chars-forward " \t\r\n\v\f")
       (skip-chars-forward " \t\r\n\v\f")
@@ -19882,7 +19883,7 @@ This version does not only check the character property, but also
   "Before first heading?"
   "Before first heading?"
   (save-excursion
   (save-excursion
     (end-of-line)
     (end-of-line)
-    (null (re-search-backward "^\\*+ " nil t))))
+    (null (re-search-backward org-outline-regexp-bol nil t))))
 
 
 (defun org-on-heading-p (&optional ignored)
 (defun org-on-heading-p (&optional ignored)
   (outline-on-heading-p t))
   (outline-on-heading-p t))
@@ -19934,7 +19935,7 @@ make a significant difference in outlines with very many siblings."
 (defun org-first-sibling-p ()
 (defun org-first-sibling-p ()
   "Is this heading the first child of its parents?"
   "Is this heading the first child of its parents?"
   (interactive)
   (interactive)
-  (let ((re (concat "^" outline-regexp))
+  (let ((re org-outline-regexp-bol)
 	level l)
 	level l)
     (unless (org-at-heading-p t)
     (unless (org-at-heading-p t)
       (error "Not at a heading"))
       (error "Not at a heading"))
@@ -19952,7 +19953,7 @@ when a sibling was found.  When none is found, return nil and don't
 move point."
 move point."
   (let ((fun (if previous 're-search-backward 're-search-forward))
   (let ((fun (if previous 're-search-backward 're-search-forward))
 	(pos (point))
 	(pos (point))
-	(re (concat "^" outline-regexp))
+	(re org-outline-regexp-bol)
 	level l)
 	level l)
     (when (condition-case nil (org-back-to-heading t) (error nil))
     (when (condition-case nil (org-back-to-heading t) (error nil))
       (setq level (funcall outline-level))
       (setq level (funcall outline-level))
@@ -19977,7 +19978,7 @@ move point."
   "Goto the first child, even if it is invisible.
   "Goto the first child, even if it is invisible.
 Return t when a child was found. Otherwise don't move point and
 Return t when a child was found. Otherwise don't move point and
 return nil."
 return nil."
-  (let (level (pos (point)) (re (concat "^" outline-regexp)))
+  (let (level (pos (point)) (re org-outline-regexp-bol))
     (when (condition-case nil (org-back-to-heading t) (error nil))
     (when (condition-case nil (org-back-to-heading t) (error nil))
       (setq level (outline-level))
       (setq level (outline-level))
       (forward-char 1)
       (forward-char 1)
@@ -20153,7 +20154,7 @@ Show the heading too, if it is currently invisible."
 	   (max (point-min) (1- (point)))
 	   (max (point-min) (1- (point)))
 	   (save-excursion
 	   (save-excursion
 	     (if (re-search-forward
 	     (if (re-search-forward
-		  (concat "[\r\n]\\(" outline-regexp "\\)") nil t)
+		  (concat "[\r\n]\\(" org-outline-regexp "\\)") nil t)
 		 (match-beginning 1)
 		 (match-beginning 1)
 	       (point-max)))
 	       (point-max)))
 	   nil)
 	   nil)