[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csv-mode a16e9d8b09: Handle unclosed quotes in `csv-end
From: |
Simen Heggestøyl |
Subject: |
[elpa] externals/csv-mode a16e9d8b09: Handle unclosed quotes in `csv-end-of-field' |
Date: |
Fri, 9 Aug 2024 03:28:24 -0400 (EDT) |
branch: externals/csv-mode
commit a16e9d8b0952de1badf6da8e652b178a7f6c4498
Author: Simen Heggestøyl <simenheg@runbox.com>
Commit: Simen Heggestøyl <simenheg@runbox.com>
Handle unclosed quotes in `csv-end-of-field'
* csv-mode.el (csv-end-of-field): Handle unclosed quotes better by
treating the end of the line as the end of a CSV field.
* csv-mode-tests.el (csv-tests-end-of-field-unclosed-quotes): New test
case that would previously result in an error.
---
csv-mode-tests.el | 15 +++++++++++++++
csv-mode.el | 8 ++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/csv-mode-tests.el b/csv-mode-tests.el
index 213fd033b2..6aae736999 100644
--- a/csv-mode-tests.el
+++ b/csv-mode-tests.el
@@ -52,6 +52,21 @@
(should (equal (buffer-substring (point-min) (point))
"aaa,\"b,b\""))))
+(ert-deftest csv-tests-end-of-field-unclosed-quotes ()
+ (with-temp-buffer
+ (csv-mode)
+ (insert "a,b,c
+1,2,3
+1,2,\"
+\"1,
+\"")
+ (goto-char (point-min))
+ (while (not (eobp))
+ ;; Should not error
+ (csv-end-of-field)
+ (unless (eobp)
+ (forward-char)))))
+
(ert-deftest csv-tests-beginning-of-field ()
(with-temp-buffer
(csv-mode)
diff --git a/csv-mode.el b/csv-mode.el
index 6bdfcafbbb..b29019f6be 100644
--- a/csv-mode.el
+++ b/csv-mode.el
@@ -4,7 +4,7 @@
;; Author: "Francis J. Wright" <F.J.Wright@qmul.ac.uk>
;; Maintainer: emacs-devel@gnu.org
-;; Version: 1.26
+;; Version: 1.27
;; Package-Requires: ((emacs "27.1") (cl-lib "0.5"))
;; Keywords: convenience
@@ -107,6 +107,10 @@
;;; News:
+;; Since 1.27:
+;; - `csv-end-of-field' no longer errors out in the presence of
+;; unclosed quotes.
+
;; Since 1.26:
;; - `csv-guess-separator' will no longer guess the comment-start
;; character as a potential separator character.
@@ -733,7 +737,7 @@ point or marker arguments, BEG and END, delimiting the
region."
(when (eq (char-syntax (following-char)) ?\")
(forward-char)
(let ((ended nil))
- (while (not ended)
+ (while (and (not ended) (not (eolp)))
(cond ((not (eq (char-syntax (following-char)) ?\"))
(forward-char 1))
;; According to RFC-4180 (sec 2.7), quotes inside quoted strings
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/csv-mode a16e9d8b09: Handle unclosed quotes in `csv-end-of-field',
Simen Heggestøyl <=