From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Arthur Azevedo de Amorim Newsgroups: gmane.emacs.bugs Subject: bug#12673: 24.2; makefile-mode whitespace-cleanup Date: Thu, 18 Oct 2012 11:37:35 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1350575213 7348 80.91.229.3 (18 Oct 2012 15:46:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Oct 2012 15:46:53 +0000 (UTC) To: 12673@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 18 17:47:00 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TOsJH-0000Uf-O1 for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Oct 2012 17:46:59 +0200 Original-Received: from localhost ([::1]:40432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOsJA-0003BV-KO for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Oct 2012 11:46:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOsJ4-00039h-C1 for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2012 11:46:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOsIw-000193-0b for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2012 11:46:46 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39844) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOsIv-00018w-TU for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2012 11:46:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TOsKI-00031c-2w for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2012 11:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Arthur Azevedo de Amorim Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Oct 2012 15:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12673 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135057524911582 (code B ref -1); Thu, 18 Oct 2012 15:48:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Oct 2012 15:47:29 +0000 Original-Received: from localhost ([127.0.0.1]:50095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TOsJi-00030f-Fg for submit@debbugs.gnu.org; Thu, 18 Oct 2012 11:47:28 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55771) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TOsBq-0002pC-VG for submit@debbugs.gnu.org; Thu, 18 Oct 2012 11:39:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOsAK-0006dd-9s for submit@debbugs.gnu.org; Thu, 18 Oct 2012 11:37:49 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:44402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOsAK-0006dN-6F for submit@debbugs.gnu.org; Thu, 18 Oct 2012 11:37:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOsAJ-0007SG-0P for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2012 11:37:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOsAB-0006a6-W7 for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2012 11:37:42 -0400 Original-Received: from mail-vc0-f169.google.com ([209.85.220.169]:59435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOsAB-0006Zr-SW for bug-gnu-emacs@gnu.org; Thu, 18 Oct 2012 11:37:35 -0400 Original-Received: by mail-vc0-f169.google.com with SMTP id fl17so11257713vcb.0 for ; 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== Original-Received: by 10.58.132.239 with SMTP id ox15mr16058497veb.59.1350574655166; Thu, 18 Oct 2012 08:37:35 -0700 (PDT) Original-Received: by 10.221.11.10 with HTTP; Thu, 18 Oct 2012 08:37:35 -0700 (PDT) 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-Mailman-Approved-At: Thu, 18 Oct 2012 11:47:25 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65697 Archived-At: 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