From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: how to change the headline starter * Date: Sun, 17 Jul 2011 21:19:11 +0200 Message-ID: <87zkkcu34g.fsf@gnu.org> References: <1240511841.2591431310664738370.JavaMail.root@zimbra29-e5.priv.proxad.net> <874o2optjt.fsf@praet.org> <87hb6netf6.fsf@nzebook.haselwarter.org> <87hb6ml6ta.fsf@praet.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:32874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QiWrh-0006F6-Nx for emacs-orgmode@gnu.org; Sun, 17 Jul 2011 15:19:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QiWrc-0008LD-WB for emacs-orgmode@gnu.org; Sun, 17 Jul 2011 15:18:57 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:41827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QiWrb-0008L9-VJ for emacs-orgmode@gnu.org; Sun, 17 Jul 2011 15:18:52 -0400 Received: by wyg36 with SMTP id 36so1996709wyg.0 for ; Sun, 17 Jul 2011 12:18:50 -0700 (PDT) In-Reply-To: (Marcus Klemm's message of "Sun, 17 Jul 2011 14:53:50 +0000 (UTC)") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Marcus Klemm Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Attached is a patch that replaces instances of outline-regexp by org-outline-regexp. It also introduces more harmonization. I'd be interesed in hearing about feedback. Thanks! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Don-t-use-outline-regexp-anymore.patch >From 942c0ffbc04cef5a8158c274397b51284d944c43 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 17 Jul 2011 21:17:08 +0200 Subject: [PATCH] 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'. --- lisp/org-agenda.el | 16 ++++--- lisp/org-archive.el | 4 +- lisp/org-ascii.el | 6 ++- lisp/org-clock.el | 8 ++-- lisp/org-colview-xemacs.el | 4 +- lisp/org-colview.el | 4 +- lisp/org-docbook.el | 2 +- lisp/org-exp.el | 1 - lisp/org-footnote.el | 9 ++- lisp/org-html.el | 2 +- lisp/org-indent.el | 6 +- lisp/org-macs.el | 4 +- lisp/org-mouse.el | 10 ++-- lisp/org-remember.el | 2 +- lisp/org.el | 115 ++++++++++++++++++++++---------------------- 15 files changed, 100 insertions(+), 93 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 4209b45..8583193 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -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))) diff --git a/lisp/org-archive.el b/lisp/org-archive.el index f6736c4..3549328 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -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)) diff --git a/lisp/org-ascii.el b/lisp/org-ascii.el index b58d644..4c922f3 100644 --- a/lisp/org-ascii.el +++ b/lisp/org-ascii.el @@ -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")) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index a9c2cf6..980a035 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -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))) diff --git a/lisp/org-colview-xemacs.el b/lisp/org-colview-xemacs.el index a69af28..00a878f 100644 --- a/lisp/org-colview-xemacs.el +++ b/lisp/org-colview-xemacs.el @@ -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)) diff --git a/lisp/org-colview.el b/lisp/org-colview.el index d0ac1c1..be2830f 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -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)) diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index a28394a..8e48e77 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -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 "]]>\n") (org-export-docbook-open-para) (setq inquote nil)) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 85a3346..b60e3d4 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -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) diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index e80a90a..5fb83ad 100644 --- a/lisp/org-footnote.el +++ b/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." (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)) diff --git a/lisp/org-html.el b/lisp/org-html.el index ee84746..17f6b4f 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -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 "\n") (org-open-par) (setq inquote nil)) diff --git a/lisp/org-indent.el b/lisp/org-indent.el index a08f494..a1c690d 100644 --- a/lisp/org-indent.el +++ b/lisp/org-indent.el @@ -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) "")))) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index f212cad..40741a9 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -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)))) diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el index 4779c6c..5658bd5 100644 --- a/lisp/org-mouse.el +++ b/lisp/org-mouse.el @@ -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)) diff --git a/lisp/org-remember.el b/lisp/org-remember.el index fcbcae1..ac5cb61 100644 --- a/lisp/org-remember.el +++ b/lisp/org-remember.el @@ -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)) diff --git a/lisp/org.el b/lisp/org.el index 8c10534..5824a68 100644 --- a/lisp/org.el +++ b/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-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)) @@ -11664,7 +11664,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. @@ -11820,7 +11820,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)) @@ -11831,7 +11831,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))) @@ -11917,7 +11917,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)) @@ -12435,7 +12435,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]*$"))) @@ -12996,7 +12996,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) @@ -14041,7 +14041,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)) @@ -16104,7 +16104,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))) @@ -16274,7 +16274,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)) @@ -16928,7 +16928,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 @@ -17355,7 +17355,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) @@ -17890,7 +17890,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)))) @@ -17901,7 +17901,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 @@ -18038,7 +18038,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'. @@ -19279,7 +19279,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 @@ -19388,7 +19388,7 @@ the functionality can be provided as a fall-back.") (concat "\f" "\\|" "[ ]*$" "\\|" - "\\*+ " "\\|" + org-outline-regexp "\\|" "[ \t]*#" "\\|" (org-item-re) "\\|" "[ \t]*[:|]" "\\|" @@ -19398,7 +19398,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 @@ -19441,7 +19442,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 @@ -19585,10 +19586,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 " ")))))))) @@ -19815,9 +19816,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 @@ -19843,8 +19844,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") @@ -19890,7 +19891,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)) @@ -19942,7 +19943,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")) @@ -19960,7 +19961,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)) @@ -19985,7 +19986,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) @@ -20161,7 +20162,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) -- 1.7.5.2 --=-=-= Content-Type: text/plain -- Bastien --=-=-=--