emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

csv-mode can’t guess separator when it’s the unit separator #x1f


From: Titus von der Malsburg
Subject: csv-mode can’t guess separator when it’s the unit separator #x1f
Date: Tue, 28 May 2024 12:53:32 +0000

Hi,

I’m using the unit separator ASCII #x1f in “csv” files, because that’s more 
robust than using comma or tab (which may both be used as part of the data, 
which creates ambiguity).  The unit separator was created precisely for this 
purpose.

Since various characters are conventionally used as separators, csv-mode has a 
convenient function for guessing the separator.  (It’s typically, the one 
character which has the same number of appearances on all lines of the file.)  
Unfortunately, csv-mode currently does not consider the unit separator as a 
candidate when guessing.  Below is a patch that fixes that.  Could someone 
please apply this patch?  This list is specified as the maintainer in the 
source file.

Thank you.

  Titus


diff --git a/csv-mode.el b/csv-mode.el
index f639dcf..18fe8ce 100644
--- a/csv-mode.el
+++ b/csv-mode.el
@@ -1866,6 +1866,7 @@ When CUTOFF is passed, look only at the first CUTOFF 
number of characters."
                   text)))
       (when (and (not (gethash c chars))
                  (or (= c ?\t)
+                     (= c ?\C-_)
                      (and (not (member c '(?. ?/ ?\" ?')))
                           (not (member (get-char-code-property c 
'general-category)
                                        '(Lu Ll Lt Lm Lo Nd Nl No Ps Pe Cc 
Co))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]