[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csv-mode 388bcb9a77: Fix 'csv-guess-separator' being co
From: |
Philip Kaludercic |
Subject: |
[elpa] externals/csv-mode 388bcb9a77: Fix 'csv-guess-separator' being confused by comments |
Date: |
Sun, 4 Aug 2024 10:35:08 -0400 (EDT) |
branch: externals/csv-mode
commit 388bcb9a77118d7b7d9c42aa8b3f9fa2c892b930
Author: Peder O. Klingenberg <peder@klingenberg.no>
Commit: Philip Kaludercic <philipk@posteo.net>
Fix 'csv-guess-separator' being confused by comments
* csv-mode.el (csv--separator-candidates): Ignore
csv-comment-start when looking for potential separators.
* csv-mode-tests.el (csv-tests-guess-separator-avoid-comment):
Previously failing test case guessing the comment start as
separator char. (Bug#71042)
---
csv-mode-tests.el | 10 ++++++++++
csv-mode.el | 7 ++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/csv-mode-tests.el b/csv-mode-tests.el
index 12e009ecf9..213fd033b2 100644
--- a/csv-mode-tests.el
+++ b/csv-mode-tests.el
@@ -170,5 +170,15 @@
(should (equal (csv--unquote-value "|Hello, World|")
"|Hello, World|")))
+(ert-deftest csv-tests-guess-separator-avoid-comment ()
+ ;; bug#71042
+ (let ((testdata "###
+###
+Foo;Bar;Quux
+123;456;blah, blah
+"))
+ (message "Guessed separator: %c" (csv-guess-separator testdata))
+ (should-not (equal (csv-guess-separator testdata) ?#))))
+
(provide 'csv-mode-tests)
;;; csv-mode-tests.el ends here
diff --git a/csv-mode.el b/csv-mode.el
index 1e0f99ef92..6bdfcafbbb 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.25
+;; Version: 1.26
;; Package-Requires: ((emacs "27.1") (cl-lib "0.5"))
;; Keywords: convenience
@@ -107,6 +107,10 @@
;;; News:
+;; Since 1.26:
+;; - `csv-guess-separator' will no longer guess the comment-start
+;; character as a potential separator character.
+
;; Since 1.25:
;; - The ASCII control character 31 Unit Separator can now be
;; recognized as a CSV separator by `csv-guess-separator'.
@@ -1902,6 +1906,7 @@ When CUTOFF is passed, look only at the first CUTOFF
number of characters."
(or (= c ?\t)
(= c ?\C-_)
(and (not (member c '(?. ?/ ?\" ?')))
+ (not (= c (string-to-char csv-comment-start)))
(not (member (get-char-code-property c
'general-category)
'(Lu Ll Lt Lm Lo Nd Nl No Ps Pe Cc
Co))))))
(puthash c t chars)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/csv-mode 388bcb9a77: Fix 'csv-guess-separator' being confused by comments,
Philip Kaludercic <=