From fb5cab814e5700280b093181741f593a113473a3 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 12 Jul 2010 15:41:27 +0200 Subject: [PATCH] Better regexps in searches unenclosed. * lisp/org.el (org-in-regexps-block-p): minor fix: limit wasn't correctly used. * lisp/org-list.el (org-search-forward-unenclosed): Better regexp used. * lisp/org-list.el (org-search-backward-unenclosed): Better regexp used. --- lisp/org-list.el | 12 ++++++------ lisp/org.el | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 721f68148..61a21f918 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -268,9 +268,9 @@ valid or not, then makes sure the last one is valid." ((not (re-search-backward regexp bound (or noerror t) count)) nil) ;; match is not enclosed: return point. ((not (save-match-data - (or (org-in-regexps-block-p "^[ \t]*#\\+begin_\\([a-zA-Z]+\\)" - '(concat "^[ \t]*#\\+end_" (match-string 1))) - (org-in-regexps-block-p "^[ \t]*\\\\begin{\\([a-zA-Z]+\\)}" + (or (org-in-regexps-block-p "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\([a-zA-Z0-9_]+\\)" + '(concat "^[ \t]*#\\+\\(end\\|END\\)_" (match-string 2))) + (org-in-regexps-block-p "^[ \t]*\\\\begin{\\([a-zA-Z0-9_]+\\)}" '(concat "^[ \t]*\\\\end{" (match-string 1) "}"))))) (point)) (t @@ -289,9 +289,9 @@ valid or not, then makes sure the last one is valid." ((not (re-search-forward regexp bound (or noerror t) count)) nil) ;; match is not enclosed: return point. ((not (save-match-data - (or (org-in-regexps-block-p "^[ \t]*#\\+begin_\\([a-zA-Z]+\\)" - '(concat "^[ \t]*#\\+end_" (match-string 1))) - (org-in-regexps-block-p "^[ \t]*\\\\begin{\\([a-zA-Z]+\\)}" + (or (org-in-regexps-block-p "^[ \t]*#\\+\\(begin\\|BEGIN\\)_\\([a-zA-Z0-9_]+\\)" + '(concat "^[ \t]*#\\+\\(end\\|END\\)_" (match-string 2))) + (org-in-regexps-block-p "^[ \t]*\\\\begin{\\([a-zA-Z0-9_]+\\)}" '(concat "^[ \t]*\\\\end{" (match-string 1) "}"))))) (point)) ;; else: we start again, searching one more occurrence away. diff --git a/lisp/org.el b/lisp/org.el index f3c3dd6e7..f66677570 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18245,7 +18245,7 @@ defaults to previous heading or `point-min'." ;; we're on a block when point is on start-re... (or (org-at-regexp-p start-re) ;; ... or start-re can be found above... - (and (re-search-backward start-re bound t) + (and (re-search-backward start-re limit t) ;; ... but no end-re between start-re and point. (not (re-search-forward (eval end-re) pos t)))))))