From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: delete-trailing-whitespace and binary files Date: Sun, 21 May 2006 20:46:11 +0200 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1148237332 5896 80.91.229.2 (21 May 2006 18:48:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 21 May 2006 18:48:52 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 21 20:48:47 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fhsyh-000490-Rj for ged-emacs-devel@m.gmane.org; Sun, 21 May 2006 20:48:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fhsyh-0002xE-B2 for ged-emacs-devel@m.gmane.org; Sun, 21 May 2006 14:48:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FhsyW-0002x1-81 for emacs-devel@gnu.org; Sun, 21 May 2006 14:48:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FhsyU-0002wj-Jd for emacs-devel@gnu.org; Sun, 21 May 2006 14:48:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FhsyU-0002wg-G3 for emacs-devel@gnu.org; Sun, 21 May 2006 14:48:22 -0400 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fht2J-0000gO-GZ for emacs-devel@gnu.org; Sun, 21 May 2006 14:52:19 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 2748AFAC079 for ; Sun, 21 May 2006 20:48:20 +0200 (CEST) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:54964 Archived-At: I have delete-trailing-whitespace in before-save-hook, but that was a real disaster editing etc/spook.lines ... as soon as I saved the file, all the trailing NUL-characters were deleted. What can be done about this? 1) If file is binary (how to check that?), don't delete whitespace when run from a hook (how to check that?). Is there a "file-binary-p" function which tests if a file contains any non-printable characters? 2) Don't consider NUL to be whitespace. 3) ? -- Kim F. Storm http://www.cua.dk