all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* c indentation - replace spaces with tabs
@ 2003-12-07 13:57 Micha Feigin
  2003-12-07 15:19 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Micha Feigin @ 2003-12-07 13:57 UTC (permalink / raw)


Is it possible to make emacs automatically replace every 8 consecutive
spaces with a tab? (this can actually be done in indentation time
instead of write time if I menage to get the indentations right).
I am looking to get the same functionality gotten in vim for:
set ts=8
set sw=4
For example, when a line is indented 12 spaces it would be replaced with
[tab]4*[space]

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

* Re: c indentation - replace spaces with tabs
  2003-12-07 13:57 c indentation - replace spaces with tabs Micha Feigin
@ 2003-12-07 15:19 ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2003-12-07 15:19 UTC (permalink / raw)


> Date: Sun, 7 Dec 2003 15:57:31 +0200
> From: Micha Feigin <michf@post.tau.ac.il>
> 
> Is it possible to make emacs automatically replace every 8 consecutive
> spaces with a tab?

You want "M-x tabify-region RET" (mark the region before that).

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

* Re: c indentation - replace spaces with tabs
       [not found] <mailman.1301.1070809217.399.help-gnu-emacs@gnu.org>
@ 2003-12-08 21:21 ` Alan Mackenzie
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2003-12-08 21:21 UTC (permalink / raw)


Micha Feigin <michf@post.tau.ac.il> wrote on Sun, 7 Dec 2003 15:57:31 +0200:
> Is it possible ....

_Anything_ is possible in Emacs.  Almost.  :-)

> .... to make emacs automatically replace every 8 consecutive
> spaces with a tab? (this can actually be done in indentation time
> instead of write time if I menage to get the indentations right).

If you're happy about tabs being used in any mode, put the following in
your emacs:

(setq indent-tabs-mode t)

.  If you just want it in C Mode, use the C Mode hook:

(defun mf-enable-indent-tabs ()
  (setq indent-tabs-mode t))
(add-hook 'c-mode-hook 'mf-enable-indent-tabs)

.  All the best!

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

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

end of thread, other threads:[~2003-12-08 21:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-07 13:57 c indentation - replace spaces with tabs Micha Feigin
2003-12-07 15:19 ` Eli Zaretskii
     [not found] <mailman.1301.1070809217.399.help-gnu-emacs@gnu.org>
2003-12-08 21:21 ` Alan Mackenzie

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.