From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stuart D. Herring" Newsgroups: gmane.emacs.devel Subject: Re: whitespace-cleanup from /etc/TODO Date: Mon, 14 Aug 2006 15:53:58 -0700 (PDT) Message-ID: <39934.128.165.123.18.1155596038.squirrel@webmail.lanl.gov> References: <87zme8tqxx.fsf@actcom.com> Reply-To: herring@lanl.gov NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1155596068 19541 80.91.229.2 (14 Aug 2006 22:54:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 14 Aug 2006 22:54:28 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 15 00:54:25 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 1GClK7-0007A5-Gp for ged-emacs-devel@m.gmane.org; Tue, 15 Aug 2006 00:54:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GClK7-00061K-09 for ged-emacs-devel@m.gmane.org; Mon, 14 Aug 2006 18:54:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GClJu-00060t-EI for emacs-devel@gnu.org; Mon, 14 Aug 2006 18:54:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GClJs-00060e-I2 for emacs-devel@gnu.org; Mon, 14 Aug 2006 18:54:05 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GClJs-00060a-Dr for emacs-devel@gnu.org; Mon, 14 Aug 2006 18:54:04 -0400 Original-Received: from [192.65.95.54] (helo=mailwasher-b.lanl.gov) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GClPm-0004QT-8G for emacs-devel@gnu.org; Mon, 14 Aug 2006 19:00:10 -0400 Original-Received: from mailrelay2.lanl.gov (mailrelay2.lanl.gov [128.165.4.103]) by mailwasher-b.lanl.gov (8.13.6/8.13.6/(ccn-5)) with ESMTP id k7EMs1ta014010 for ; Mon, 14 Aug 2006 16:54:01 -0600 Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay2.lanl.gov (8.13.6/8.13.6/(ccn-5)) with ESMTP id k7EMrx9I016733; Mon, 14 Aug 2006 16:53:59 -0600 Original-Received: from webmail1.lanl.gov (localhost.localdomain [127.0.0.1]) by webmail1.lanl.gov (8.12.11.20060308/8.12.11) with ESMTP id k7EMrxTC005778; Mon, 14 Aug 2006 16:53:59 -0600 Original-Received: (from apache@localhost) by webmail1.lanl.gov (8.12.11.20060308/8.12.11/Submit) id k7EMrwQI005775; Mon, 14 Aug 2006 15:53:58 -0700 X-Authentication-Warning: webmail1.lanl.gov: apache set sender to herring@lanl.gov using -f Original-Received: from 128.165.123.18 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Mon, 14 Aug 2006 15:53:58 -0700 (PDT) In-Reply-To: <87zme8tqxx.fsf@actcom.com> Original-To: "Yoni Rabkin Katzenell" User-Agent: SquirrelMail/1.4.6-7.el3.7lanl X-Priority: 3 (Normal) Importance: Normal X-PMX-Version: 4.7.1.128075 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:58396 Archived-At: > + (defvar whitespace-region-only nil > + "Keep track of whether whitespace has been run on a region or > buffer.") > + (make-variable-buffer-local 'whitespace-region-only) > + > ;; For flavors of Emacs which don't define `defgroup' and `defcustom'. > (eval-when-compile > (if (not (fboundp 'defgroup)) > *************** > *** 522,528 **** > (interactive) > (if (and transient-mark-mode mark-active) > (whitespace-cleanup-region (region-beginning) (region-end)) > ! (whitespace-cleanup-internal))) > > (defun whitespace-cleanup-internal () > ;; If this buffer really contains a file, then run, else quit. > --- 526,534 ---- > (interactive) > (if (and transient-mark-mode mark-active) > (whitespace-cleanup-region (region-beginning) (region-end)) > ! (progn > ! (setq whitespace-region-only nil) > ! (whitespace-cleanup-internal)))) This presumably works, but it's the long way around. Just add an argument REGION to `whitespace-cleanup-internal' instead of defining a new top-level symbol. Then invoke it from `whitespace-cleanup-region' with that argument non-nil. If there's some reason that doesn't work, at least `let'-bind the variable rather than just setting it. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.