GNU bug report logs - #12673
24.2; makefile-mode whitespace-cleanup

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Arthur Azevedo de Amorim <arthur.aa@HIDDEN>; dated Thu, 18 Oct 2012 15:48:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Oct 2012 15:47:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 18 11:47:29 2012
Received: from localhost ([127.0.0.1]:50095 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TOsJi-00030f-Fg
	for submit <at> debbugs.gnu.org; Thu, 18 Oct 2012 11:47:28 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55771)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <arthur.aa@HIDDEN>) id 1TOsBq-0002pC-VG
	for submit <at> debbugs.gnu.org; Thu, 18 Oct 2012 11:39:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arthur.aa@HIDDEN>) id 1TOsAK-0006dd-9s
	for submit <at> debbugs.gnu.org; Thu, 18 Oct 2012 11:37:49 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:44402)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arthur.aa@HIDDEN>) id 1TOsAK-0006dN-6F
	for submit <at> debbugs.gnu.org; Thu, 18 Oct 2012 11:37:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33879)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arthur.aa@HIDDEN>) id 1TOsAJ-0007SG-0P
	for bug-gnu-emacs@HIDDEN; Thu, 18 Oct 2012 11:37:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arthur.aa@HIDDEN>) id 1TOsAB-0006a6-W7
	for bug-gnu-emacs@HIDDEN; Thu, 18 Oct 2012 11:37:42 -0400
Received: from mail-vc0-f169.google.com ([209.85.220.169]:59435)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arthur.aa@HIDDEN>) id 1TOsAB-0006Zr-SW
	for bug-gnu-emacs@HIDDEN; Thu, 18 Oct 2012 11:37:35 -0400
Received: by mail-vc0-f169.google.com with SMTP id fl17so11257713vcb.0
	for <bug-gnu-emacs@HIDDEN>; Thu, 18 Oct 2012 08:37:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:date:message-id:subject:from:to:content-type;
	bh=u1xMhnyB3tbeVZGXvD2p91q8NZllONSC2QQ9WZDelRY=;
	b=tYcGFC3K/EKXRJrieEXHs6eTWsUe7A+qK90vsc4qap7c7hkh0saVFChLp2H+ynI4Mj
	o9bb5X3y3ep4rQZIUT+Fe+CkC4p+YX3WrCEJ/1nWFZkiV7Q6HNDBQgHwU4Q3w+20ueyE
	a7h58TvoV3kDQwEsvF6cp2/rUOWUiyLJi4laJZbLiU3lBK51vWy21a1KXTA0BUnkLzyR
	xyc8scx5+iwuRZrJIXUO5ZJ2u2Hi2O0VkppaaJSApawEnoa8H9iTjGuvK30zXBhtfqr1
	dfBCoKv31bfa44IKgx//W5XdseZojeS7vMiFqdUzX0bodHaGytXaO4WaxQjVuxzcujrm
	U8kw==
MIME-Version: 1.0
Received: by 10.58.132.239 with SMTP id ox15mr16058497veb.59.1350574655166;
	Thu, 18 Oct 2012 08:37:35 -0700 (PDT)
Received: by 10.221.11.10 with HTTP; Thu, 18 Oct 2012 08:37:35 -0700 (PDT)
Date: Thu, 18 Oct 2012 11:37:35 -0400
Message-ID: <CAHAb9XhdsKLmUiMe22nvQso-rCR6tDgLmG9jj+_Mxu980i4y3w@HIDDEN>
Subject: 24.2; makefile-mode whitespace-cleanup
From: Arthur Azevedo de Amorim <arthur.aa@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -3.4 (---)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 18 Oct 2012 11:47:25 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.4 (---)

Hello,

I found a subtle bug while editing Makefiles using whitespace-cleanup
in my after-save-hook. I'm using emacs-24.2.

Suppose that I have the following in .emacs:

(setq-default indent-tabs-mode nil)
(add-hook 'after-save-hook 'whitespace-cleanup)

I open up emacs, visit a text file, and then save it.
whitespace-cleanup gets triggered. After that, I visit a Makefile.
Now, if I save the file, whitespace-cleanup converts tabs to 8 spaces.
Conversely, if I open first the Makefile, and then any other file,
whitespace-cleanup will convert 8 spaces in the text file to tabs.

I think I know where the problem is. whitespace.el has the following line

(defvar whitespace-indent-tabs-mode indent-tabs-mode)

When whitespace-cleanup is called for the first time on the text file,
the value of indent-tabs-mode is nil, because that is the default
value and text mode doesn't override it. When the Makefile is visited,
whitespace-indent-tabs-mode has already been defined, and so will
still be nil.

A way to fix the problem (I think) would be to remove
whitespace-indent-tabs-mode and simply use indent-tabs-mode instead.

I believe that functionality related to other buffer-local variables
would suffer from the same problem. For instance, the line below
defines whitespace-tab-width similarly.

-- 
Arthur Azevedo de Amorim




Acknowledgement sent to Arthur Azevedo de Amorim <arthur.aa@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#12673; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.