unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Skip Montanaro <skip.montanaro@gmail.com>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Temporarily disable a write hook?
Date: Fri, 14 Jul 2017 10:43:50 -0500	[thread overview]
Message-ID: <CANc-5UwwJAF6iRQ7b_Hw3F8Ko7cA_HgFrv+zuNPeegw5KNpx8w@mail.gmail.com> (raw)
In-Reply-To: <CAP_d_8XvPBA7QLOB_yoDAny+=-4XZt3U6f2MTABpv1d+vNQPzQ@mail.gmail.com>

Yeah, I am in complete control. As it turns out, I'm one of the
authors of Python's csv module, so I'm very familiar with quoting
fields. :-/ When I generated this particular file I explicitly
disabled quoting because it would have complicated some of my
searches, and I knew none of the patterns contained commas.

I solved this particular case by moving the column containing the
regular expressions left, leaving a column which should never contain
spaces as the rightmost column.

I'd still be curious to see if there is an elegant solution to this in Emacs.

Skip

On Fri, Jul 14, 2017 at 10:11 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> On Fri, Jul 14, 2017 at 10:03 PM, Skip Montanaro
> <skip.montanaro@gmail.com> wrote:
>
>> (add-hook 'before-save-hook 'delete-trailing-whitespace)
>>
>> Well, I got burned by this. I was editing a CSV file in which one cell
>> in the last column of a row ended with a space. It was, unfortunately,
>> a regular expression, so the space was significant.
>
> Are you in full control of how this CSV file is edited?
>
> If you are, you could double-quote the cell that has the significant
> trailing space. (Of course this assumes a specification-compliant
> parser.)
>
> On the other hand, if that CSV file is intermediate data subject to
> import/export, that won’t help.



  reply	other threads:[~2017-07-14 15:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-14 15:03 Temporarily disable a write hook? Skip Montanaro
2017-07-14 15:11 ` Yuri Khan
2017-07-14 15:43   ` Skip Montanaro [this message]
2017-07-14 16:13     ` Lele Gaifax
2017-07-14 17:29       ` Skip Montanaro

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=CANc-5UwwJAF6iRQ7b_Hw3F8Ko7cA_HgFrv+zuNPeegw5KNpx8w@mail.gmail.com \
    --to=skip.montanaro@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=yuri.v.khan@gmail.com \
    /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.
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).