unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Titus von der Malsburg <malsburg@posteo.de>
To: emacs-devel@gnu.org
Subject: csv-mode can’t guess separator when it’s the unit separator #x1f
Date: Tue, 28 May 2024 12:53:32 +0000	[thread overview]
Message-ID: <87bk4qt7l9.fsf@posteo.de> (raw)


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	other threads:[~2024-05-28 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28 12:53 Titus von der Malsburg [this message]
2024-05-29  6:55 ` csv-mode can’t guess separator when it’s the unit separator #x1f Simen Heggestøyl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bk4qt7l9.fsf@posteo.de \
    --to=malsburg@posteo.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).