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'.
This commit is contained in:
Bastien Guerry 2011-07-17 21:17:08 +02:00
parent d243679491
commit c3748fcd80
15 changed files with 100 additions and 93 deletions

View File

@ -2263,7 +2263,7 @@ Pressing `<' twice means to restrict to the current subtree or region
((eq type 'todo-tree)
(org-check-for-org-mode)
(org-let lprops
'(org-occur (concat "^" outline-regexp "[ \t]*"
'(org-occur (concat "^" org-outline-regexp "[ \t]*"
(regexp-quote match) "\\>"))))
((eq type 'occur-tree)
(org-check-for-org-mode)
@ -3873,7 +3873,7 @@ in `org-agenda-text-search-extra-files'."
regexps+))
(setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b)))))
(if (not regexps+)
(setq regexp (concat "^" org-outline-regexp))
(setq regexp org-outline-regexp-bol)
(setq regexp (pop regexps+))
(if hdl-only (setq regexp (concat "^" org-outline-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-re (if (member "*" tags)
(org-re "^\\*+ .*:[[:alnum:]_@#%]+:[ \t]*$")
(org-re (concat org-outline-regexp-bol
".*:[[:alnum:]_@#%]+:[ \t]*$"))
(if tags
(concat "^\\*+ .*:\\("
(concat org-outline-regexp-bol
".*:\\("
(mapconcat 'identity tags "\\|")
(org-re "\\):[[:alnum:]_@#%:]*[ \t]*$")))))
(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)
category (org-get-category b0))
(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)
(goto-char (match-beginning 0))
(setq hdmarker (org-agenda-new-marker)
@ -4967,7 +4969,7 @@ please use `org-class' instead."
(clockp
(and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ \t]*$")
(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)
(goto-char (match-beginning 0))
(setq hdmarker (org-agenda-new-marker)
@ -5366,7 +5368,7 @@ FRACTION is what fraction of the head-warning time has passed."
(throw :skip t))
(setq marker (org-agenda-new-marker (point)))
(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)
(goto-char (match-beginning 0))
(setq hdmarker (org-agenda-new-marker (point)))

View File

@ -352,7 +352,7 @@ sibling does not exist, it will be created at the end of the subtree."
(widen)
(let (b e pos leader level)
(org-back-to-heading t)
(looking-at outline-regexp)
(looking-at org-outline-regexp)
(setq leader (match-string 0)
level (funcall outline-level))
(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
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."
(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 ":"))
(begm (make-marker))
(endm (make-marker))

View File

@ -428,7 +428,7 @@ publishing directory."
(org-init-section-numbers)
(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))
(setq link-buffer nil))
(setq wrap nil)
@ -629,7 +629,9 @@ publishing directory."
(save-match-data
(if (save-excursion
(re-search-backward
"^\\(\\([ \t]*\\)\\|\\(\\*+ \\)\\)[^ \t\n]" nil t))
(concat "^\\(\\([ \t]*\\)\\|\\("
org-outline-regexp
"\\)\\)[^ \t\n]") nil t))
(setq ind (or (match-string 2)
(make-string (length (match-string 3)) ?\ )))))
(mapc (lambda (x) (insert ind "[" (car x) "]: " (cdr x) "\n"))

View File

@ -479,7 +479,7 @@ pointing to it."
heading (org-get-heading 'notags)
prefix (save-excursion
(org-back-to-heading t)
(looking-at "\\*+ ")
(looking-at org-outline-regexp)
(match-string 0))
task (substring
(org-fontify-like-in-org-mode
@ -1092,7 +1092,7 @@ the clocking selection, associated with the letter `d'."
(match-string 2))))
(if newstate (org-todo newstate))))
((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-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))))
(if newstate (org-todo newstate))))
((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-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))))
(catch 'exit
(while (org-up-heading-safe)
(looking-at outline-regexp)
(looking-at org-outline-regexp)
(if (<= (org-reduced-level (funcall outline-level)) level)
(throw 'exit nil))))
(org-narrow-to-subtree)))

View File

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

View File

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

View File

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

View File

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

View File

@ -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."
(save-excursion
(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)
(end-of-line)
(list (match-string 2)
@ -245,7 +247,8 @@ label, start, end and definition of the footnote otherwise."
(or (and (re-search-forward
(org-re
(concat "^[ \t]*$" "\\|"
"^\\*+ " "\\|"
org-outline-regexp-bol
"\\|"
"^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]"))
bound 'move)
(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
(and limit-level (1- (* limit-level 2)))
limit-level)))
(outline-regexp
(org-outline-regexp
(concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ ")))
;; Determine the highest marker used so far.
(ref-table (when export-props org-export-footnotes-seen))

View File

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

View File

@ -217,7 +217,7 @@ useful to make it ever so slightly different."
'(line-prefix nil wrap-prefix nil) string)
string)
(defvar org-indent-outline-re (concat "^" org-outline-regexp)
(defvar org-indent-outline-re org-outline-regexp-bol
"Outline heading regexp.")
(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
(let (beg end)
(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)
(1- org-inlinetask-min-level)
""))))
@ -290,7 +290,7 @@ Point is assumed to be at the beginning of a headline."
(when org-indent-mode
(let ((beg (point)) (end limit))
(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)
(1- org-inlinetask-min-level)
""))))

View File

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

View File

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

View File

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

View File

@ -4696,6 +4696,7 @@ This variable is set by `org-before-change-function'.
(defvar org-inhibit-blocking nil) ; Dynamically-scoped param.
(defvar org-table-buffer-is-an nil)
(defconst org-outline-regexp "\\*+ ")
(defconst org-outline-regexp-bol "^\\*+ ")
;;;###autoload
(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.
Use `org-reduced-level' to remove the effect of `org-odd-levels'."
(save-excursion
(looking-at outline-regexp)
(looking-at org-outline-regexp)
(1- (- (match-end 0) (match-beginning 0)))))
(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]+\\|$\\)"
1 'bold prepend)
;; ARCHIVEd headings
(list (concat "^\\*+ \\(.*:" org-archive-tag ":.*\\)")
(list (concat
org-outline-regexp-bol
"\\(.*:" org-archive-tag ":.*\\)")
'(1 'org-archived prepend))
;; Specials
'(org-do-latex-and-special-faces)
@ -5905,12 +5908,12 @@ in special contexts.
(if org-odd-levels-only
(and limit-level (1- (* limit-level 2)))
limit-level)))
(outline-regexp
(org-outline-regexp
(if (not (org-mode-p))
outline-regexp
(concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ "))))
(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
(if bob-special
(delq 'org-optimize-window-after-visibility-change
@ -5972,7 +5975,7 @@ in special contexts.
;; At an item/headline: delegate to `org-cycle-internal-local'.
((and (or (and org-cycle-include-plain-lists (org-at-item-p))
(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))))
(org-cycle-internal-local))
@ -5991,7 +5994,7 @@ in special contexts.
((and (eq org-cycle-emulate-tab 'exc-hl-bol)
(or (not (bolp))
(not (looking-at outline-regexp))))
(not (looking-at org-outline-regexp))))
(call-interactively (global-key-binding "\t")))
((if (and (memq org-cycle-emulate-tab '(white whitestart))
@ -6213,7 +6216,7 @@ results."
(interactive)
(let ((level (save-excursion
(goto-char (point-min))
(if (re-search-forward (concat "^" outline-regexp) nil t)
(if (re-search-forward org-outline-regexp-bol nil t)
(progn
(goto-char (match-beginning 0))
(funcall outline-level))))))
@ -6232,7 +6235,7 @@ With numerical argument N, show content up to level N."
(outline-previous-visible-heading 1)
(error (goto-char (point-min))))
t)
(looking-at outline-regexp))
(looking-at org-outline-regexp))
(if (integerp arg)
(show-children (1- arg))
(show-branches))
@ -6385,8 +6388,7 @@ open and agenda-wise Org files."
(save-excursion
(beginning-of-line 1)
(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
"^[ \t]*:END:"
(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.
Optional argument N means put the headline into the Nth line of the window."
(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)
(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)
new-mark-x)))
(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
(org-todo new-mark)
(insert new-mark " "))))
@ -7255,7 +7257,7 @@ After top level, it switches back to sibling level."
(save-excursion
(setq end (copy-marker end))
(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))
(funcall fun))
(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."
(interactive)
(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)
(save-excursion
(goto-char (point-min))
@ -7369,7 +7370,7 @@ case."
(setq beg (point))))
;; Find insertion point, with error handling
(while (> cnt 0)
(or (and (funcall movfunc) (looking-at outline-regexp))
(or (and (funcall movfunc) (looking-at org-outline-regexp))
(progn (goto-char beg0)
(error "Cannot move past superior level or buffer limit")))
(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")))
(let* ((visp (not (outline-invisible-p)))
(txt tree)
(^re (concat "^\\(" outline-regexp "\\)"))
(re (concat "\\(" outline-regexp "\\)"))
(^re (concat "^\\(" org-outline-regexp "\\)"))
(re (concat "\\(" org-outline-regexp "\\)"))
(^re_ (concat "\\(\\*+\\)[ \t]*"))
(old-level (if (string-match ^re txt)
@ -7527,7 +7528,7 @@ the inserted text when done."
(next-level (save-excursion
(condition-case nil
(progn
(or (looking-at outline-regexp)
(or (looking-at org-outline-regexp)
(outline-next-visible-heading 1))
(if (looking-at re)
(- (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 "\\)")
kill)
(- (match-end 2) (match-beginning 2) 1)))
(re (concat "^" org-outline-regexp))
(re org-outline-regexp-bol)
(start (1+ (or (match-beginning 2) -1))))
(if (not start-level)
(progn
@ -8230,8 +8231,7 @@ Possible values in the list of contexts are `table', `headline', and `item'."
(prog1 (or (and (memq 'table contexts)
(looking-at "[ \t]*|"))
(and (memq 'headline contexts)
;;????????? (looking-at "\\*+"))
(looking-at outline-regexp))
(looking-at org-outline-regexp))
(and (memq 'item contexts)
(looking-at "[ \t]*\\([-+*] \\|[0-9]+[.)] \\)"))
(and (memq 'item-body contexts)
@ -10430,7 +10430,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(if pos
(progn
(goto-char pos)
(looking-at outline-regexp)
(looking-at org-outline-regexp)
(setq level (org-get-valid-level (funcall outline-level) 1))
(goto-char
(if reversed
@ -10575,7 +10575,7 @@ this function appends the default value from
(goto-char pos)
(goto-char (point-max))
(if (not (bolp)) (newline)))
(when (looking-at outline-regexp)
(when (looking-at org-outline-regexp)
(setq level (funcall outline-level))
(org-end-of-subtree t t))
(org-back-over-empty-lines)
@ -10873,10 +10873,10 @@ expands them."
(save-excursion
(org-back-to-heading)
(let (case-fold-search)
(if (looking-at (concat outline-regexp
(if (looking-at (concat org-outline-regexp
"\\( *\\<" org-comment-string "\\>[ \t]*\\)"))
(replace-match "" t t nil 1)
(if (looking-at outline-regexp)
(if (looking-at org-outline-regexp)
(progn
(goto-char (match-end 0))
(insert org-comment-string " ")))))))
@ -10941,7 +10941,7 @@ For calling through lisp, arg is also interpreted in the following way:
(save-excursion
(catch 'exit
(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 "\\( +\\|$\\)"))
(looking-at " *"))
(let* ((match-data (match-data))
@ -11656,7 +11656,7 @@ of `org-todo-keywords-1'."
org-todo-keywords-1)))
(t (error "Invalid prefix argument: %s" arg)))))
(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)
"Insert the \"DEADLINE:\" string with a timestamp to make a deadline.
@ -11812,7 +11812,7 @@ be removed."
(save-restriction
(let (col list elt ts buffer-invisibility-spec)
(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))
(setq col (current-column))
(goto-char (match-end 0))
@ -11823,7 +11823,7 @@ be removed."
org-keyword-time-not-clock-regexp))))
;; Nothing to add, nothing to remove...... :-)
(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
"[^\r\n]*"))
(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)
(narrow-to-region (point) (save-excursion
(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
"[^\r\n]*\\)?"))
(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,
only lines with a TODO keyword are included in the output."
(require 'org-agenda)
(let* ((re (concat "^" outline-regexp " *\\(\\<\\("
(let* ((re (concat "^" org-outline-regexp " *\\(\\<\\("
(mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
(org-re
"\\>\\)\\)? *\\(.*?\\)\\(:[[: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.
With prefix ARG, realign all tags in headings in the current buffer."
(interactive "P")
(let* ((re (concat "^" outline-regexp))
(let* ((re org-outline-regexp-bol)
(current (org-get-tags-string))
(col (current-column))
(org-setting-tags t)
@ -14033,7 +14033,7 @@ formats in the current buffer."
"Insert a property drawer into the current entry."
(interactive)
(org-back-to-heading t)
(looking-at outline-regexp)
(looking-at org-outline-regexp)
(let ((indent (if org-adapt-indentation
(- (match-end 0)(match-beginning 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)
(add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
(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)
(add-text-properties
(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
((or (equal subtree '(16))
(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)
msg "Creating images for buffer...%s"))
((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.
`org-speed-commands-default' specifies a minimal command set. Use
`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)
(funcall org-use-speed-commands)))
(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,
this function returns t, nil otherwise."
(let ((re (cond
((eq what 'headlines) (concat "^" org-outline-regexp))
((eq what 'headlines) org-outline-regexp-bol)
((eq what 'items) (org-item-beginning-re))
(t (error "This should not happen"))))
beg end)
@ -17882,7 +17882,7 @@ argument ARG, change each line in region into an item."
(cond
;; Skip blank lines and inline tasks.
((looking-at "^[ \t]*$"))
((looking-at "^\\*+ "))
((looking-at org-outline-regexp-bol))
;; We can't find less than 0 indentation.
((zerop i) (throw 'exit (setq min-i 0)))
((< 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)))
(while (< (point) end)
(unless (or (looking-at "^[ \t]*$")
(looking-at "^\\*+ "))
(looking-at org-outline-regexp-bol))
(org-indent-line-to (+ (org-get-indentation) delta)))
(forward-line)))))))
(skip-blanks
@ -18030,7 +18030,7 @@ stars to add."
((org-on-heading-p)
(while (< (point) end)
(when (org-on-heading-p t)
(looking-at outline-regexp) (replace-match ""))
(looking-at org-outline-regexp) (replace-match ""))
(forward-line)))
;; Case 2. Started at an item: change items into headlines.
;; 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
((looking-at "# ") (setq column 0))
;; Headings
((looking-at "\\*+ ") (setq column 0))
((looking-at org-outline-regexp) (setq column 0))
;; Included files
((looking-at "#\\+include:") (setq column 0))
;; Footnote definition
@ -19380,7 +19380,7 @@ the functionality can be provided as a fall-back.")
(concat
"\f" "\\|"
"[ ]*$" "\\|"
"\\*+ " "\\|"
org-outline-regexp "\\|"
"[ \t]*#" "\\|"
(org-item-re) "\\|"
"[ \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
(org-set-local
'auto-fill-inhibit-regexp
(concat "\\*+ \\|#\\+"
(concat org-outline-regexp
"\\|#\\+"
"\\|[ \t]*" org-keyword-time-regexp
(if (or org-enable-table-editor org-enable-fixed-width-editor)
(concat
@ -19433,7 +19434,7 @@ the functionality can be provided as a fall-back.")
(itemp (org-in-item-p)))
(cond ((and (equal (char-after (point-at-bol)) ?*)
(save-excursion (goto-char (point-at-bol))
(looking-at outline-regexp)))
(looking-at org-outline-regexp)))
t) ; skip headlines
(table.el-p t) ; skip table.el 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)))
(save-excursion
(org-back-to-heading)
(if (looking-at (concat outline-regexp
(if (looking-at (concat org-outline-regexp
"\\( *\\<" org-quote-string "\\>[ \t]*\\)"))
(replace-match "" t t nil 1)
(if (looking-at outline-regexp)
(if (looking-at org-outline-regexp)
(progn
(goto-char (match-end 0))
(insert org-quote-string " "))))))))
@ -19807,9 +19808,9 @@ interactive command with similar behavior."
(when (and (bolp) subtreep
(not (setq swallowp
(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)
(org-cycle-show-empty-lines 'folded)
(condition-case nil
@ -19835,8 +19836,8 @@ interactive command with similar behavior."
(let (level)
(save-excursion
(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)))
(goto-char end)
(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?"
(save-excursion
(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)
(outline-on-heading-p t))
@ -19934,7 +19935,7 @@ make a significant difference in outlines with very many siblings."
(defun org-first-sibling-p ()
"Is this heading the first child of its parents?"
(interactive)
(let ((re (concat "^" outline-regexp))
(let ((re org-outline-regexp-bol)
level l)
(unless (org-at-heading-p t)
(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."
(let ((fun (if previous 're-search-backward 're-search-forward))
(pos (point))
(re (concat "^" outline-regexp))
(re org-outline-regexp-bol)
level l)
(when (condition-case nil (org-back-to-heading t) (error nil))
(setq level (funcall outline-level))
@ -19977,7 +19978,7 @@ move point."
"Goto the first child, even if it is invisible.
Return t when a child was found. Otherwise don't move point and
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))
(setq level (outline-level))
(forward-char 1)
@ -20153,7 +20154,7 @@ Show the heading too, if it is currently invisible."
(max (point-min) (1- (point)))
(save-excursion
(if (re-search-forward
(concat "[\r\n]\\(" outline-regexp "\\)") nil t)
(concat "[\r\n]\\(" org-outline-regexp "\\)") nil t)
(match-beginning 1)
(point-max)))
nil)