help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tabs for Indent and Spaces for Align


From: Luke Hoersten
Subject: Re: Tabs for Indent and Spaces for Align
Date: Wed, 22 Oct 2008 13:27:17 -0500

I couldn't figure out a way to force it. Since it seems align just uses the same indent-tabs-mode as indent does, I wrote a little function to turn it off before align then restore it:

;; use only spaces for alignment
(defun align-with-spaces (beg end)
"Align selected using only spaces for whitespace."
(interactive "r")
(let (tabs-mode (indent-tabs-mode))
(setq indent-tabs-mode nil)
(align beg end)
(setq indent-tabs-mode tabs-mode)))

I'd love if an elisp expert could do something better though =)

Luke Hoersten
http://Luke.Hoersten.org


On Wed, Oct 22, 2008 at 9:49 AM, Luke Hoersten <luke@hoersten.org> wrote:
I use only tabs for indenting while programming with 'indent-tabs-mode'.
Also while programming I use 'align' to line up variables etc. Align uses tabs and spaces to align to tab-stops and I just want it to use spaces.
"align lines up text in selected region, using whitespaces (or tabs) as the column delimiter"
-- http://www.emacswiki.org/emacs/AlignCommands

I'm looking for a way to use only tabs for indentation while using only spaces for alignment.
On Wed, Oct 22, 2008 at 8:40 AM, Nikolaj Schumacher <me@nschum.de> wrote:
"Luke Hoersten" <luke@hoersten.org> wrote:

> I've been Googling around for quite some time and have been unable to find a
> way to use tabs for indentation and spaces for alignment ('M-x align'). I
> know how to set emacs to use either spaces or tabs. I've got tabs only right
> now for indentation (for work standards) but I don't want to use the mix tab
> + spaces for alignment.

I don't quite understand when you want to use either.  Do you want to
use tabs when programming and spaces when writing text?

regards,
Nikolaj Schumacher



reply via email to

[Prev in Thread] Current Thread [Next in Thread]