From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Skip Montanaro Newsgroups: gmane.emacs.help Subject: Re: Temporarily disable a write hook? Date: Fri, 14 Jul 2017 10:43:50 -0500 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1500047094 8384 195.159.176.226 (14 Jul 2017 15:44:54 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 14 Jul 2017 15:44:54 +0000 (UTC) Cc: Help GNU Emacs To: Yuri Khan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 14 17:44:50 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dW2lu-0001wN-35 for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Jul 2017 17:44:50 +0200 Original-Received: from localhost ([::1]:38617 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dW2lz-0000sc-G2 for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Jul 2017 11:44:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dW2ky-0000qu-S9 for help-gnu-emacs@gnu.org; Fri, 14 Jul 2017 11:43:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dW2ky-0007Ee-1S for help-gnu-emacs@gnu.org; Fri, 14 Jul 2017 11:43:52 -0400 Original-Received: from mail-io0-x232.google.com ([2607:f8b0:4001:c06::232]:34068) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dW2kx-0007ET-Ss for help-gnu-emacs@gnu.org; Fri, 14 Jul 2017 11:43:51 -0400 Original-Received: by mail-io0-x232.google.com with SMTP id r36so16412132ioi.1 for ; Fri, 14 Jul 2017 08:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=x5874sruTNg8p0nnbB3fDQEyZuuYEcYsm7BClK7jSjU=; b=DqBEKvTwBQ1Z1O6kWCwrtxRIEP9Sq2ZeOigkK4cwk7K5aCKT/+jbXTx+ABS7GdVHib 5OW1ZworUMFUe4JBvM9YxQFVvfsnSSkhi0OPQOv38XCx8E8lDHLXMPTBmAn0KJKgla+4 rtyNXjGbKOEahhnkFwte1VXquR2t3K8kSXPLZgBlbC73cmEJBtH5kZN3na0Tm+lxuf5q Xjcs7fXs1zlLRgy2BN9JX1zzgg8wFn14NmvDMvHBt65ddwhqdx9xvmkITcfGiB18hi57 6CHOCd0usw4QQHzTsNP7SB17HApYAyGuUzpjvvEZiKgGItfD83+J7UwsN/IV+S0yrzey qxQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=x5874sruTNg8p0nnbB3fDQEyZuuYEcYsm7BClK7jSjU=; b=OuLKpT38HqtojtGj9DZENySBXRkush5rM1bZM62aH11K/4eEwSjEFNcqsnsj/GIYrO WNeQXJLxbKutbrq2S7J+M6grkth4kOswug0svvPyQp9OyzumOzjLpZTPTLEDvIwbkIn0 PCClVqovrP0qWASqd7Yb7uXnbqr3w6/BY86b4dX6VFBYCGQSB9jVWBMi+tOvcl58wPNF JifATG7gfXRHexZ6GkQYczlldsY9MFBEsY/HfamERSgvhjrObW+OsyTHZ6aVVtp1pDr3 tWccJoZwNXLXVgJSV2czbo/tTL0xRY0WL4vd7mgOeRAZlrdAlFAHadiYmx0ZHvDLtYAO JbdQ== X-Gm-Message-State: AIVw111tPH06COtfAHH8qSxFJIg48eMTBpHXZLKIM5WZuRi1OAlKlc16 TOLpEQkfyCuvTIGfa8V7GpnWz1LHeEd0 X-Received: by 10.107.205.136 with SMTP id d130mr8785586iog.109.1500047030929; Fri, 14 Jul 2017 08:43:50 -0700 (PDT) Original-Received: by 10.107.32.144 with HTTP; Fri, 14 Jul 2017 08:43:50 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113767 Archived-At: 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 Emac= s. Skip On Fri, Jul 14, 2017 at 10:11 AM, Yuri Khan wrote: > On Fri, Jul 14, 2017 at 10:03 PM, Skip Montanaro > 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=E2=80=99t help.