help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Temporarily disable a write hook?


From: Skip Montanaro
Subject: Re: Temporarily disable a write hook?
Date: Fri, 14 Jul 2017 10:43:50 -0500

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 via email to

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