Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-09-12 02:52:28


Rob Stewart wrote:
> 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):
> [snip]

Personally, I wouldn't like to untabify other's files without a warning.
The following elisp will ask you before untabifying a buffer.

(defun has-tabs ()
   (save-excursion
     (beginning-of-buffer)
     (search-forward "\t" nil t nil)
   ))
(defun untabify-buffer () (untabify (point-min) (point-max)))

(defun untabify-with-prompt ()
   (progn
    (if (has-tabs)
       (if (yes-or-no-p (concat "Untabify the buffer?"))
           (untabify-buffer)
       )
    )
   nil))

(defun config-c ()
   ;; snip other settings
   (add-hook 'local-write-file-hooks 'untabify-with-prompt)
)

- Volodya


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