From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.help Subject: Re: Clear trailing whitespace on save, but not at the cursor Date: Mon, 5 Mar 2012 16:07:51 +0100 Message-ID: References: <87aa3vwbsf.fsf@gnuvola.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1330960130 14170 80.91.229.3 (5 Mar 2012 15:08:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 5 Mar 2012 15:08:50 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Thien-Thi Nguyen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 05 16:08:49 2012 Return-path: Envelope-to: geh-help-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 1S4ZWq-0004jN-Om for geh-help-gnu-emacs@m.gmane.org; Mon, 05 Mar 2012 16:08:48 +0100 Original-Received: from localhost ([::1]:33664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4ZWp-0001ZB-Vv for geh-help-gnu-emacs@m.gmane.org; Mon, 05 Mar 2012 10:08:47 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4ZWe-0001Yx-JY for help-gnu-emacs@gnu.org; Mon, 05 Mar 2012 10:08:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4ZWc-0007ED-NT for help-gnu-emacs@gnu.org; Mon, 05 Mar 2012 10:08:36 -0500 Original-Received: from mail-pw0-f41.google.com ([209.85.160.41]:65318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4ZWc-0007Dl-Dz for help-gnu-emacs@gnu.org; Mon, 05 Mar 2012 10:08:34 -0500 Original-Received: by pbcup15 with SMTP id up15so247259pbc.0 for ; Mon, 05 Mar 2012 07:08:31 -0800 (PST) Received-SPF: pass (google.com: domain of lekktu@gmail.com designates 10.68.203.135 as permitted sender) client-ip=10.68.203.135; Authentication-Results: mr.google.com; spf=pass (google.com: domain of lekktu@gmail.com designates 10.68.203.135 as permitted sender) smtp.mail=lekktu@gmail.com; dkim=pass header.i=lekktu@gmail.com Original-Received: from mr.google.com ([10.68.203.135]) by 10.68.203.135 with SMTP id kq7mr50032612pbc.1.1330960111377 (num_hops = 1); Mon, 05 Mar 2012 07:08:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=f//g5w7u6/hFPgqvYjENAn6cCbTKk+ucGfivixJpkBc=; b=zucpzJPOEuBH1Pna/YzB4egj/vCGyMz4zu48bwhvvq3V3x+q8NVBLDyEY43BuIRiGD pgfsbD+udxBw1rojRV1jbmp0XgAzFhUmPHOzdSq4Z6ndPZuzIjb2QbeGKvnzUL2sdvtL bUS8xzNNZZBDsKopyLw4vKsACf/3ABPIaf9Rcjk0U/oNWws9hwv+J5R2BWWfwjEDIvac n6d+f1sqrnsL1RK3nBzlwHNn5AwIQtU+B1DrpA13FbnuHz8brNZc7KXs6IpDAPB7aUu6 uoN623F0KlyLdvqr2Y5mQwv8uPVi6yretxMNxLh+PwU0OhXHYd2U4YlVN5iHurs9DvzO 6zFg== Original-Received: by 10.68.203.135 with SMTP id kq7mr42857694pbc.1.1330960111319; Mon, 05 Mar 2012 07:08:31 -0800 (PST) Original-Received: by 10.142.241.5 with HTTP; Mon, 5 Mar 2012 07:07:51 -0800 (PST) In-Reply-To: <87aa3vwbsf.fsf@gnuvola.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83940 Archived-At: On Mon, Mar 5, 2012 at 12:02, Thien-Thi Nguyen wrote: > (defadvice delete-trailing-whitespace > =C2=A0(around except-for-current-line activate) > =C2=A0"However, leave trailing whitespace before point alone." > =C2=A0(let ((save (when (looking-back "\\s-+" (line-beginning-position) t= ) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(match-string 0)))= ) > =C2=A0 =C2=A0ad-do-it > =C2=A0 =C2=A0(when save (insert save)))) That does not answer to this part of the request: > I'm wondering if it's possible to do it in > such a way that if I save and then quit, it doesn't bug me about > saving because it modified the file again with the new whitespace. =C2=A0 =C2=A0 Juanma