all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Tabs for Indent and Spaces for Align
@ 2008-10-21 20:15 Luke Hoersten
  2008-10-22 13:40 ` Nikolaj Schumacher
  0 siblings, 1 reply; 5+ messages in thread
From: Luke Hoersten @ 2008-10-21 20:15 UTC (permalink / raw
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

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.

Any ideas?

Thanks,
Luke Hoersten
http://Luke.Hoersten.org

[-- Attachment #2: Type: text/html, Size: 505 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tabs for Indent and Spaces for Align
  2008-10-21 20:15 Tabs for Indent and Spaces for Align Luke Hoersten
@ 2008-10-22 13:40 ` Nikolaj Schumacher
  2008-10-22 14:49   ` Luke Hoersten
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolaj Schumacher @ 2008-10-22 13:40 UTC (permalink / raw
  To: Luke Hoersten; +Cc: help-gnu-emacs

"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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tabs for Indent and Spaces for Align
  2008-10-22 13:40 ` Nikolaj Schumacher
@ 2008-10-22 14:49   ` Luke Hoersten
  2008-10-22 18:27     ` Luke Hoersten
  0 siblings, 1 reply; 5+ messages in thread
From: Luke Hoersten @ 2008-10-22 14:49 UTC (permalink / raw
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]

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.

Luke Hoersten
http://Luke.Hoersten.org


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
>

[-- Attachment #2: Type: text/html, Size: 1751 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tabs for Indent and Spaces for Align
  2008-10-22 14:49   ` Luke Hoersten
@ 2008-10-22 18:27     ` Luke Hoersten
  2008-10-22 20:13       ` Nikolaj Schumacher
  0 siblings, 1 reply; 5+ messages in thread
From: Luke Hoersten @ 2008-10-22 18:27 UTC (permalink / raw
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]

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.
>
> Luke Hoersten
> http://Luke.Hoersten.org
>
>
> 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
>>
>
>

[-- Attachment #2: Type: text/html, Size: 2905 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tabs for Indent and Spaces for Align
  2008-10-22 18:27     ` Luke Hoersten
@ 2008-10-22 20:13       ` Nikolaj Schumacher
  0 siblings, 0 replies; 5+ messages in thread
From: Nikolaj Schumacher @ 2008-10-22 20:13 UTC (permalink / raw
  To: Luke Hoersten; +Cc: help-gnu-emacs

"Luke Hoersten" <luke@hoersten.org> wrote:

> ;; 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 =)

You can shorten that to:

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


regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-22 20:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-21 20:15 Tabs for Indent and Spaces for Align Luke Hoersten
2008-10-22 13:40 ` Nikolaj Schumacher
2008-10-22 14:49   ` Luke Hoersten
2008-10-22 18:27     ` Luke Hoersten
2008-10-22 20:13       ` Nikolaj Schumacher

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.