[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org eaf274909f: Consistently allow null character in bl
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org eaf274909f: Consistently allow null character in block and drawer bodies |
Date: |
Tue, 25 Apr 2023 15:58:42 -0400 (EDT) |
branch: externals/org
commit eaf274909f595ba29b853031e1c5bcdac255fbeb
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
Consistently allow null character in block and drawer bodies
Also, do not use [^\000] as a poor-man's replacement for
(rx (or any newline)).
* lisp/ob-core.el (org-babel-src-block-regexp):
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs):
* lisp/org-compat.el (org-hide-block-toggle-all):
* lisp/org-element.el:
* lisp/org-feed.el (org-feed-read-previous-status):
(org-feed-parse-rss-feed):
(org-feed-parse-rss-entry):
* lisp/ox-org.el (org-org-publish-to-org):
* testing/lisp/test-ob-tangle.el:
* lisp/org.el (org-block-regexp):
(org-clock-drawer-re): Use \(.\|\n\) regexp instead of [^\000].
(org-latex-regexps): Do not try to match \000 inside latex fragments -
we now use parser for this purpose.
Reported-by: Tommy Kelly <tommy.kelly@verilab.com>
Link: https://orgmode.org/list/875yfk9vlv.fsf@localhost
---
lisp/ob-core.el | 2 +-
lisp/ob-haskell.el | 4 ++--
lisp/org-compat.el | 2 +-
lisp/org-element.el | 2 +-
lisp/org-feed.el | 6 +++---
lisp/org.el | 17 ++++++++---------
lisp/ox-org.el | 2 +-
testing/lisp/test-ob-tangle.el | 2 +-
8 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 0ca74ce27c..65fa47ab5a 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -212,7 +212,7 @@ When matching, reference is stored in match group 1."
;; (4) header arguments
"\\([^\n]*\\)\n"
;; (5) body
- "\\([^\000]*?\n\\)??[ \t]*#\\+end_src")
+ "\\(\\(?:.\\|\n\\)*?\n\\)??[ \t]*#\\+end_src")
"Regexp used to identify code blocks.")
(defun org-babel--get-vars (params)
diff --git a/lisp/ob-haskell.el b/lisp/ob-haskell.el
index 3e64c1657a..909de19abb 100644
--- a/lisp/ob-haskell.el
+++ b/lisp/ob-haskell.el
@@ -226,7 +226,7 @@ constructs (header arguments, no-web syntax etc...) are
ignored."
(let* ((contents (buffer-string))
(haskell-regexp
(concat "^\\([ \t]*\\)#\\+begin_src[ \t]haskell*\\(.*\\)[\r\n]"
- "\\([^\000]*?\\)[\r\n][ \t]*#\\+end_src.*"))
+ "\\(\\(?:.\\|\n\\)*?\\)[\r\n][ \t]*#\\+end_src.*"))
(base-name (file-name-sans-extension (buffer-file-name)))
(tmp-file (org-babel-temp-file "haskell-"))
(tmp-org-file (concat tmp-file ".org"))
@@ -270,7 +270,7 @@ constructs (header arguments, no-web syntax etc...) are
ignored."
(goto-char (point-min)) (forward-line 2)
(insert "%include polycode.fmt\n")
;; ensure all \begin/end{code} statements start at the first column
- (while (re-search-forward "^[
\t]+\\\\begin{code}[^\000]+\\\\end{code}" nil t)
+ (while (re-search-forward "^[
\t]+\\\\begin{code}\\(?:.\\|\n\\)+\\\\end{code}" nil t)
(replace-match (save-match-data (org-remove-indentation
(match-string 0)))
t t))
;; save org exported latex to a .lhs file
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 5620f038b1..34b27546d9 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -925,7 +925,7 @@ an error. Return a non-nil value when toggling is
successful."
(goto-char start)
(while (and (< (point) end)
(re-search-forward "^[ \t]*#\\+begin_?\
-\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$" end t))
+\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\(\\(?:.\\|\n\\)+?\\)#\\+end_?\\1[ \t]*$"
end t))
(save-excursion
(save-match-data
(goto-char (match-beginning 0))
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 5f54d11371..643dc394b8 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -3671,7 +3671,7 @@ a plist with `:key', `:args', `:begin', `:end', `:value'
and
Assume point is at the macro."
(save-excursion
- (when (looking-at
"{{{\\([a-zA-Z][-a-zA-Z0-9_]*\\)\\((\\([^\000]*?\\))\\)?}}}")
+ (when (looking-at
"{{{\\([a-zA-Z][-a-zA-Z0-9_]*\\)\\((\\(\\(?:.\\|\n\\)*?\\))\\)?}}}")
(let ((begin (point))
(key (downcase (match-string-no-properties 1)))
(value (match-string-no-properties 0))
diff --git a/lisp/org-feed.el b/lisp/org-feed.el
index f0b294b4a5..320c6106d1 100644
--- a/lisp/org-feed.el
+++ b/lisp/org-feed.el
@@ -475,7 +475,7 @@ This will find DRAWER and extract the alist."
(goto-char pos)
(let ((end (save-excursion (org-end-of-subtree t t))))
(if (re-search-forward
- (concat "^[ \t]*:" drawer ":[ \t]*\n\\([^\000]*?\\)\n[ \t]*:END:")
+ (concat "^[ \t]*:" drawer ":[ \t]*\n\\(\\(?:.\\|\n\\)*?\\)\n[
\t]*:END:")
end t)
(read (match-string 1))
nil))))
@@ -633,7 +633,7 @@ containing the properties `:guid' and `:item-full-text'."
end (and (re-search-forward "</item>" nil t)
(match-beginning 0)))
(setq item (buffer-substring beg end)
- guid (if (string-match "<guid\\>.*?>\\([^\000]*?\\)</guid>" item)
+ guid (if (string-match
"<guid\\>.*?>\\(\\(?:.\\|\n\\)*?\\)</guid>" item)
(xml-substitute-special (match-string-no-properties 1
item))))
(setq entry (list :guid guid :item-full-text item))
(push entry entries)
@@ -647,7 +647,7 @@ containing the properties `:guid' and `:item-full-text'."
(with-temp-buffer
(insert (plist-get entry :item-full-text))
(goto-char (point-min))
- (while (re-search-forward "<\\([a-zA-Z]+\\>\\).*?>\\([^\000]*?\\)</\\1>"
+ (while (re-search-forward
"<\\([a-zA-Z]+\\>\\).*?>\\(\\(?:.\\|\n\\)*?\\)</\\1>"
nil t)
(setq entry (plist-put entry
(intern (concat ":" (match-string 1)))
diff --git a/lisp/org.el b/lisp/org.el
index 33471e8d96..78881b27e3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -405,7 +405,7 @@ FULL is given."
;;;; Block
(defconst org-block-regexp
- "^[ \t]*#\\+begin_?\\([^
\n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$"
+ "^[ \t]*#\\+begin_?\\([^
\n]+\\)\\(\\([^\n]+\\)\\)?\n\\(\\(?:.\\|\n\\)+?\\)#\\+end_?\\1[ \t]*$"
"Regular expression for hiding blocks.")
(defconst org-dblock-start-re
@@ -611,7 +611,7 @@ Group 1 contains drawer's name or \"END\".")
"Matches an entire property drawer.")
(defconst org-clock-drawer-re
- (concat "\\(" org-clock-drawer-start-re "\\)[^\000]*?\\("
+ (concat "\\(" org-clock-drawer-start-re "\\)\\(?:.\\|\n\\)*?\\("
org-clock-drawer-end-re "\\)\n?")
"Matches an entire clock drawer.")
@@ -661,14 +661,13 @@ An entry can be toggled between COMMENT and normal with
;;;; LaTeX Environments and Fragments
(defconst org-latex-regexps
- '(("begin" "^[
\t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t)
+ '(("begin" "^[
\t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)\\(?:.\\|\n\\)+?\\\\end{\\2}\\)" 1 t)
;; ("$" "\\([ \t(]\\|^\\)\\(\\(\\([$]\\)\\([^
\t\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \t\n,.$]\\)\\4\\)\\)\\([ \t.,?;:'\")]\\|$\\)"
2 nil)
- ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p
- ("$1" "\\([^$]\\|^\\)\\(\\$[^
\t\r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2 nil)
- ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^
\t\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^
\t\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2
nil)
- ("\\(" "\\\\([^\000]*?\\\\)" 0 nil)
- ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 nil)
- ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil))
+ ("$1" "\\([^$]\\|^\\)\\(\\$[^
\t\r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)" 2 nil)
+ ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^
\t\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^
\t\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)" 2 nil)
+ ("\\(" "\\\\(\\(?:.\\|\n\\)*?\\\\)" 0 nil)
+ ("\\[" "\\\\\\[\\(?:.\\|\n\\)*?\\\\\\]" 0 nil)
+ ("$$" "\\$\\$\\(?:.\\|\n\\)*?\\$\\$" 0 nil))
"Regular expressions for matching embedded LaTeX.")
;;;; Node Property
diff --git a/lisp/ox-org.el b/lisp/ox-org.el
index f0a71becd4..681b95d682 100644
--- a/lisp/ox-org.el
+++ b/lisp/ox-org.el
@@ -337,7 +337,7 @@ Return output file name."
(when org-org-htmlized-css-url
(goto-char (point-min))
(and (re-search-forward
- "<style type=\"text/css\">[^\000]*?\n[ \t]*</style>.*" nil t)
+ "<style type=\"text/css\">\\(?:.\\|\n\\)*?\n[ \t]*</style>.*"
nil t)
(replace-match
(format
"<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\">"
diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el
index 2a6e4b1dd1..496f01bb76 100644
--- a/testing/lisp/test-ob-tangle.el
+++ b/testing/lisp/test-ob-tangle.el
@@ -45,7 +45,7 @@
;; (flet ((exp-p (arg)
;; (and
;; (string-match
-;; (format "noweb-%s-start\\([^\000]*\\)noweb-%s-end" arg
arg)
+;; (format
"noweb-%s-start\\(\\(?:.\\|\n\\)*\\)noweb-%s-end" arg arg)
;; tang)
;; (string-match "expanded" (match-string 1 tang)))))
;; (should (exp-p "yes"))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org eaf274909f: Consistently allow null character in block and drawer bodies,
ELPA Syncer <=