unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: [PATCH] delete-trailing-whitespace on active region
Date: Thu, 10 Feb 2011 21:10:56 -0500	[thread overview]
Message-ID: <jwvoc6js4me.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87pqqza86f.fsf@gnu.org> ("Johan Bockgård"'s message of "Thu, 10 Feb 2011 22:31:04 +0100")

>> +      (while (re-search-forward "\\s-$" end t)
>> +        (skip-syntax-backward "-" (save-excursion (forward-line 0) (point)))
>> +        ;; Don't delete formfeeds, even if they are considered whitespace.
>> +        (save-match-data
>> +          (if (looking-at ".*\f")
>> +              (goto-char (match-end 0))))
>> +        (delete-region (point) (match-end 0))))))

> You can't use the value of `end' to limit the search like that, since
> the deletion changes the size of the region. (Use narrowing or a
> marker.)

Good point, thanks.  ...or do it from the end.


        Stefan



  reply	other threads:[~2011-02-11  2:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09 18:28 [PATCH] delete-trailing-whitespace on active region Deniz Dogan
2011-02-10  2:35 ` Stefan Monnier
2011-02-10 15:31   ` Deniz Dogan
2011-02-10 19:05     ` Stefan Monnier
2011-02-10 21:31     ` Johan Bockgård
2011-02-11  2:10       ` Stefan Monnier [this message]
2011-02-11  6:33         ` Deniz Dogan
2011-02-11 14:30           ` Stefan Monnier
2011-02-11 18:27             ` Deniz Dogan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvoc6js4me.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).