Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2002-09-09 10:01:11


From: Douglas Gregor <gregod_at_[hidden]>
> On Monday 09 September 2002 10:16 am, David Abrahams wrote:
> > Emacs can do anything.
>
> Actually, would anyone have a bit 'o' elisp to untabify a file when it's
> saved? That would make it rather impossible for Emacs users to add tabs to
> Boost sources :)

Try this (inherited; I'm no elisper):

;; To make sure that TAB file-characters are stripped out of files before
;; writing to disk
(defun c++-mode-untabify ()
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "[ \t]+$" nil t)
      (delete-region (match-beginning 0) (match-end 0)))
    (goto-char (point-min))
    (if (search-forward "\t" nil t)
        (untabify (1- (point)) (point-max))))
  nil)

(add-hook 'c++-mode-hook
          '(lambda ()
             (make-local-variable 'write-contents-hooks)
             (add-hook 'write-contents-hooks 'c++-mode-untabify)))

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk