mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-12 17:40:06 +00:00
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.
This commit is contained in:
parent
2dec9eb473
commit
fb5cab814e
|
@ -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)
|
((not (re-search-backward regexp bound (or noerror t) count)) nil)
|
||||||
;; match is not enclosed: return point.
|
;; match is not enclosed: return point.
|
||||||
((not (save-match-data
|
((not (save-match-data
|
||||||
(or (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_" (match-string 1)))
|
'(concat "^[ \t]*#\\+\\(end\\|END\\)_" (match-string 2)))
|
||||||
(org-in-regexps-block-p "^[ \t]*\\\\begin{\\([a-zA-Z]+\\)}"
|
(org-in-regexps-block-p "^[ \t]*\\\\begin{\\([a-zA-Z0-9_]+\\)}"
|
||||||
'(concat "^[ \t]*\\\\end{" (match-string 1) "}")))))
|
'(concat "^[ \t]*\\\\end{" (match-string 1) "}")))))
|
||||||
(point))
|
(point))
|
||||||
(t
|
(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)
|
((not (re-search-forward regexp bound (or noerror t) count)) nil)
|
||||||
;; match is not enclosed: return point.
|
;; match is not enclosed: return point.
|
||||||
((not (save-match-data
|
((not (save-match-data
|
||||||
(or (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_" (match-string 1)))
|
'(concat "^[ \t]*#\\+\\(end\\|END\\)_" (match-string 2)))
|
||||||
(org-in-regexps-block-p "^[ \t]*\\\\begin{\\([a-zA-Z]+\\)}"
|
(org-in-regexps-block-p "^[ \t]*\\\\begin{\\([a-zA-Z0-9_]+\\)}"
|
||||||
'(concat "^[ \t]*\\\\end{" (match-string 1) "}")))))
|
'(concat "^[ \t]*\\\\end{" (match-string 1) "}")))))
|
||||||
(point))
|
(point))
|
||||||
;; else: we start again, searching one more occurrence away.
|
;; else: we start again, searching one more occurrence away.
|
||||||
|
|
|
@ -18245,7 +18245,7 @@ defaults to previous heading or `point-min'."
|
||||||
;; we're on a block when point is on start-re...
|
;; we're on a block when point is on start-re...
|
||||||
(or (org-at-regexp-p start-re)
|
(or (org-at-regexp-p start-re)
|
||||||
;; ... or start-re can be found above...
|
;; ... 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.
|
;; ... but no end-re between start-re and point.
|
||||||
(not (re-search-forward (eval end-re) pos t)))))))
|
(not (re-search-forward (eval end-re) pos t)))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue