unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
To: "dsevilla@gmail.com" <dsevilla@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: whitespace-cleanup + untabify?
Date: Sat, 14 Jun 2008 14:02:17 +0200	[thread overview]
Message-ID: <f7ccd24b0806140502o4051b6e9saad5176fb4f0dde1@mail.gmail.com> (raw)
In-Reply-To: <fe97aa6c-f6db-4d58-9468-41b4e0677821@j22g2000hsf.googlegroups.com>

On Sat, Jun 14, 2008 at 12:56, dsevilla@gmail.com <dsevilla@gmail.com> wrote:

> I haven't found any
> option that connects untabify and whitespace-cleanup. I'm using:

That really depends on how do you want to do the untabify.

For example, you can defadvice `whitespace-cleanup' like so

(defadvice whitespace-cleanup (after whitespace-untabify activate compile)
  (save-restriction
    (widen)
    (untabify (point-min) (point-max))))

so when you do M-x whitespace cleanup, it first cleans up and then
untabifies. Take into account that untabify removes tabs anywhere in
the line; if you prefer only to untabify at the beginning of line, you
could use this instead:

(defadvice whitespace-cleanup (after whitespace-untabify activate compile)
  (save-restriction
    (widen)
    (let ((tabify-regexp "^\t* [ \t]+"))
      (untabify (point-min) (point-max)))))

Both examples untabify the whole buffer (that's what the
`save-restriction' and `widen' calls are for), so if you in fact only
want to untabify the region, it's even simpler:

(defadvice whitespace-cleanup (after whitespace-untabify activate compile)
  (untabify (point-min) (point-max)))

Does this help?

  Juanma




  reply	other threads:[~2008-06-14 12:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-14 10:56 whitespace-cleanup + untabify? dsevilla
2008-06-14 12:02 ` Juanma Barranquero [this message]
2008-06-14 12:03 ` Nikolaj Schumacher
2008-06-14 12:37 ` Kevin Rodgers
2008-06-14 16:49   ` Nikolaj Schumacher
2008-06-14 13:43 ` Juanma
2008-06-14 15:02 ` Rupert Swarbrick
2008-06-14 15:10   ` dsevilla
2008-06-14 16:24 ` Lennart Borgman (gmail)
     [not found] ` <mailman.13261.1213458961.18990.help-gnu-emacs@gnu.org>
2008-06-15 20:05   ` dsevilla
     [not found] ` <mailman.13267.1213460678.18990.help-gnu-emacs@gnu.org>
2008-06-15 20:07   ` dsevilla
2008-06-15 20:53     ` Lennart Borgman (gmail)
2008-06-15 21:23       ` Nikolaj Schumacher
2008-06-15 21:32         ` Lennart Borgman (gmail)
2008-06-16  6:28           ` Thierry Volpiatto

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=f7ccd24b0806140502o4051b6e9saad5176fb4f0dde1@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=dsevilla@gmail.com \
    --cc=help-gnu-emacs@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.
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).