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)
(goto-char (1+ origin)))))
((and (eq ?\" (char-after)) (not (eq ?\\ (char-before))))
;; Include everything between non-escaped double quotes.
(push ?\" partial)
;; Include everything from current double quote to next
;; non-escaped double quote.
(let ((origin (point)))
(condition-case nil
;; Use `read' since it is fast and takes care of
;; escaped quotes already.
(if (re-search-forward "[^\\]\"" nil t)
(setq partial
(nconc (cons ?\"
(nreverse (string-to-list
(read (current-buffer)))))
(nconc (nreverse (string-to-list
(buffer-substring origin (point))))
partial))
;; No closing double quote found. Backtrack.
(end-of-file (goto-char (1+ origin))))))
;; No closing double quote. Backtrack.
(push ?\" partial)
(forward-char))))
(t (push (char-after) partial)
(forward-char))))
;; Add pending parsing and return result.

View File

@ -717,7 +717,15 @@ x
;; Handle un-balanced quotes.
(should
(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 ()
(org-test-with-temp-text-in-file "