unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* csv-mode can’t guess separator when it’s the unit separator #x1f
@ 2024-05-28 12:53 Titus von der Malsburg
  2024-05-29  6:55 ` Simen Heggestøyl
  0 siblings, 1 reply; 2+ messages in thread
From: Titus von der Malsburg @ 2024-05-28 12:53 UTC (permalink / raw)
  To: emacs-devel


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))))))



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: csv-mode can’t guess separator when it’s the unit separator #x1f
  2024-05-28 12:53 csv-mode can’t guess separator when it’s the unit separator #x1f Titus von der Malsburg
@ 2024-05-29  6:55 ` Simen Heggestøyl
  0 siblings, 0 replies; 2+ messages in thread
From: Simen Heggestøyl @ 2024-05-29  6:55 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: emacs-devel

Titus von der Malsburg <malsburg@posteo.de> writes:

> 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

Thanks Titus, I've applied the patch.

-- Simen



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-29  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-28 12:53 csv-mode can’t guess separator when it’s the unit separator #x1f Titus von der Malsburg
2024-05-29  6:55 ` Simen Heggestøyl

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).