[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: whitespace-cleanup from /etc/TODO
From: |
Stuart D. Herring |
Subject: |
Re: whitespace-cleanup from /etc/TODO |
Date: |
Mon, 14 Aug 2006 15:53:58 -0700 (PDT) |
User-agent: |
SquirrelMail/1.4.6-7.el3.7lanl |
> + (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.