0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 22:37:47 +00:00

Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-05-08 11:26:33 +02:00
commit 93b5e5087f
2 changed files with 17 additions and 11 deletions

View file

@ -1495,19 +1495,17 @@ balanced instances of \"[ \t]:\", set ALTS to ((32 9) . 58)."
(push after partial) (push after partial)
(goto-char (1+ origin))))) (goto-char (1+ origin)))))
((and (eq ?\" (char-after)) (not (eq ?\\ (char-before)))) ((and (eq ?\" (char-after)) (not (eq ?\\ (char-before))))
;; Include everything between non-escaped double quotes. ;; Include everything from current double quote to next
(push ?\" partial) ;; non-escaped double quote.
(let ((origin (point))) (let ((origin (point)))
(condition-case nil (if (re-search-forward "[^\\]\"" nil t)
;; Use `read' since it is fast and takes care of
;; escaped quotes already.
(setq partial (setq partial
(nconc (cons ?\" (nconc (nreverse (string-to-list
(nreverse (string-to-list (buffer-substring origin (point))))
(read (current-buffer)))))
partial)) partial))
;; No closing double quote found. Backtrack. ;; No closing double quote. Backtrack.
(end-of-file (goto-char (1+ origin)))))) (push ?\" partial)
(forward-char))))
(t (push (char-after) partial) (t (push (char-after) partial)
(forward-char)))) (forward-char))))
;; Add pending parsing and return result. ;; Add pending parsing and return result.

View file

@ -717,7 +717,15 @@ x
;; Handle un-balanced quotes. ;; Handle un-balanced quotes.
(should (should
(equal '(":foo \"1" "bar 3") (equal '(":foo \"1" "bar 3")
(org-babel-balanced-split ":foo \"1 :bar 3" '((32 9) . 58))))) (org-babel-balanced-split ":foo \"1 :bar 3" '((32 9) . 58))))
;; Handle empty string.
(should
(equal '(":foo \"\"")
(org-babel-balanced-split ":foo \"\"" '((32 9) . 58))))
;; Handle control characters within double quotes.
(should
(equal '(":foo \"\\n\"")
(org-babel-balanced-split ":foo \"\\n\"" '((32 9) . 58)))))
(ert-deftest test-ob/commented-last-block-line-no-var () (ert-deftest test-ob/commented-last-block-line-no-var ()
(org-test-with-temp-text-in-file " (org-test-with-temp-text-in-file "