* Re: TAB
@ 2003-11-17 20:42 Joe Corneli
0 siblings, 0 replies; 11+ messages in thread
From: Joe Corneli @ 2003-11-17 20:42 UTC (permalink / raw)
Cc: help-gnu-emacs
I think the following explains how to do what you want. BTW I don't
write java code, but I was thinking that a similar feature for lisp
might be nice. It seems to be harder to find that information (at
least on this computer...).
C-x C-f sample.java RET
C-h k C-i
*snip snip*
The amount and kind of whitespace inserted is controlled by the
variable `c-insert-tab-function', which is called to do the actual
insertion of whitespace. Normally the function in this variable
just inserts a tab character, or the equivalent number of spaces,
depending on the variable `indent-tabs-mode'.
================
C-h v indent-tabs-mode RET
*snip snip*
indent-tabs-mode's value is t
Documentation:
*Indentation can insert tabs if this is non-nil.
Setting this variable automatically makes it local to the current buffer.
^ permalink raw reply [flat|nested] 11+ messages in thread
* TAB
@ 2003-11-17 14:32 David Rasmussen
2003-11-17 17:31 ` TAB Kevin Rodgers
2003-11-18 0:45 ` TAB Dan Anderson
0 siblings, 2 replies; 11+ messages in thread
From: David Rasmussen @ 2003-11-17 14:32 UTC (permalink / raw)
When I edit java-files, most of the times emacs inserts spaces when I
press TAB to indent something. But sometimes I've found it inserts a TAB
character instead. Why? How can I turn it off? I never want TAB
characters when editing Java or C++ source code files.
/David
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: TAB
2003-11-17 14:32 TAB David Rasmussen
@ 2003-11-17 17:31 ` Kevin Rodgers
2003-11-17 18:16 ` TAB Dan Anderson
` (2 more replies)
2003-11-18 0:45 ` TAB Dan Anderson
1 sibling, 3 replies; 11+ messages in thread
From: Kevin Rodgers @ 2003-11-17 17:31 UTC (permalink / raw)
David Rasmussen wrote:
> When I edit java-files, most of the times emacs inserts spaces when I
> press TAB to indent something. But sometimes I've found it inserts a TAB
> character instead. Why?
C-h v indent-tabs-mode
> How can I turn it off? I never want TAB
> characters when editing Java or C++ source code files.
(setq-default indent-tabs-mode nil) ; for all modes, or
(add-hook 'java-mode-hook ; for just java mode
(lambda () (setq indent-tabs-mode nil)))
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: TAB
2003-11-17 17:31 ` TAB Kevin Rodgers
@ 2003-11-17 18:16 ` Dan Anderson
2003-11-18 19:23 ` TAB jan
[not found] ` <mailman.170.1069096910.399.help-gnu-emacs@gnu.org>
2003-11-19 9:42 ` TAB David Rasmussen
2 siblings, 1 reply; 11+ messages in thread
From: Dan Anderson @ 2003-11-17 18:16 UTC (permalink / raw)
Cc: help-gnu-emacs
On Mon, 2003-11-17 at 12:31, Kevin Rodgers wrote:
> David Rasmussen wrote:
>
> > When I edit java-files, most of the times emacs inserts spaces when I
> > press TAB to indent something. But sometimes I've found it inserts a TAB
> > character instead. Why?
>
>
> C-h v indent-tabs-mode
>
> > How can I turn it off? I never want TAB
> > characters when editing Java or C++ source code files.
>
> (setq-default indent-tabs-mode nil) ; for all modes, or
>
> (add-hook 'java-mode-hook ; for just java mode
> (lambda () (setq indent-tabs-mode nil)))
That tells him how to turn of tabs. Is there any way to change tabs to
spaces? i.e. when tabbing insert 4 spaces instead of a tab (if tabs
default to 4 spaces long)?
-Dan
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <mailman.170.1069096910.399.help-gnu-emacs@gnu.org>]
* Re: TAB
[not found] ` <mailman.170.1069096910.399.help-gnu-emacs@gnu.org>
@ 2003-11-17 19:42 ` Kevin Rodgers
2003-11-17 19:49 ` TAB Sean Richards
1 sibling, 0 replies; 11+ messages in thread
From: Kevin Rodgers @ 2003-11-17 19:42 UTC (permalink / raw)
Dan Anderson wrote:
> On Mon, 2003-11-17 at 12:31, Kevin Rodgers wrote:
>>David Rasmussen wrote:
>>
>>>When I edit java-files, most of the times emacs inserts spaces when I
>>>press TAB to indent something. But sometimes I've found it inserts a TAB
>>>character instead. Why?
>>
>>C-h v indent-tabs-mode
>>
>>>How can I turn it off? I never want TAB
>>>characters when editing Java or C++ source code files.
>>>
>>(setq-default indent-tabs-mode nil) ; for all modes, or
>>
>>(add-hook 'java-mode-hook ; for just java mode
>> (lambda () (setq indent-tabs-mode nil)))
>
> That tells him how to turn of tabs. Is there any way to change tabs to
> spaces? i.e. when tabbing insert 4 spaces instead of a tab (if tabs
> default to 4 spaces long)?
I don't even know what you mean by "turn off tabs". Setting indent-tabs-mode
to nil does exactly what its doc string says: the TAB key, which is bound to
c-indent-command, will always insert spaces and never insert tab characters:
| TAB runs the command c-indent-command
| which is an interactive compiled Lisp function in `cc-cmds'.
| (c-indent-command &optional ARG)
|
| Indent current line as C code, and/or insert some whitespace.
...
| [*] The amount and kind of whitespace inserted is controlled by the
| variable `c-insert-tab-function', which is called to do the actual
| insertion of whitespace. Normally the function in this variable
| just inserts a tab character, or the equivalent number of spaces,
| depending on the variable `indent-tabs-mode'.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: TAB
[not found] ` <mailman.170.1069096910.399.help-gnu-emacs@gnu.org>
2003-11-17 19:42 ` TAB Kevin Rodgers
@ 2003-11-17 19:49 ` Sean Richards
1 sibling, 0 replies; 11+ messages in thread
From: Sean Richards @ 2003-11-17 19:49 UTC (permalink / raw)
Dan Anderson <dan@mathjunkies.com> writes:
> On Mon, 2003-11-17 at 12:31, Kevin Rodgers wrote:
>> David Rasmussen wrote:
>>
>> > When I edit java-files, most of the times emacs inserts spaces when I
>> > press TAB to indent something. But sometimes I've found it inserts a TAB
>> > character instead. Why?
>>
>>
>> C-h v indent-tabs-mode
>>
>> > How can I turn it off? I never want TAB
>> > characters when editing Java or C++ source code files.
>>
>> (setq-default indent-tabs-mode nil) ; for all modes, or
>>
>> (add-hook 'java-mode-hook ; for just java mode
>> (lambda () (setq indent-tabs-mode nil)))
>
> That tells him how to turn of tabs. Is there any way to change tabs to
> spaces? i.e. when tabbing insert 4 spaces instead of a tab (if tabs
> default to 4 spaces long)?
I use in my ~/.emacs
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
That makes Emacs insert 4 spaces instead of a tab.
>From the Emacs manual ....
Tabs vs. Spaces
===============
Emacs normally uses both tabs and spaces to indent lines. If you
prefer, all indentation can be made from spaces only. To request this,
set `indent-tabs-mode' to `nil'. This is a per-buffer variable, so
altering the variable affects only the current buffer, but there is a
default value which you can change as well. *Note Locals::.
Sean
--
"Hver sin smak", sa vintapperen, han drakk mens de andre sloss.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: TAB
2003-11-17 17:31 ` TAB Kevin Rodgers
2003-11-17 18:16 ` TAB Dan Anderson
[not found] ` <mailman.170.1069096910.399.help-gnu-emacs@gnu.org>
@ 2003-11-19 9:42 ` David Rasmussen
2003-11-19 14:17 ` TAB Eli Zaretskii
2 siblings, 1 reply; 11+ messages in thread
From: David Rasmussen @ 2003-11-19 9:42 UTC (permalink / raw)
Kevin Rodgers wrote:
>
> C-h v indent-tabs-mode
>
Thanks.
>
> (setq-default indent-tabs-mode nil) ; for all modes, or
>
> (add-hook 'java-mode-hook ; for just java mode
> (lambda () (setq indent-tabs-mode nil)))
>
Hmm. OK. Is there a place I can read about the .emacs configuration
file? I realize that it is elisp (which I don't know much about, let
alone Lisp), but where can I read about the most important idioms of the
.emacs configuration file, and just enough for this purpose about elisp?
/David
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: TAB
2003-11-17 14:32 TAB David Rasmussen
2003-11-17 17:31 ` TAB Kevin Rodgers
@ 2003-11-18 0:45 ` Dan Anderson
1 sibling, 0 replies; 11+ messages in thread
From: Dan Anderson @ 2003-11-18 0:45 UTC (permalink / raw)
Cc: help-gnu-emacs
While looking for something completely unrelated in the Emacs manual I
found:
Tabs vs. Spaces
===============
Emacs normally uses both tabs and spaces to indent lines. If you
prefer, all indentation can be made from spaces only. To request this,
set `indent-tabs-mode' to `nil'. This is a per-buffer variable, so
altering the variable affects only the current buffer, but there is a
default value which you can change as well. *Note Locals::.
There are also commands to convert tabs to spaces or vice versa,
always preserving the columns of all nonblank text. `M-x tabify' scans
the region for sequences of spaces, and converts sequences of at least
three spaces to tabs if that can be done without changing indentation.
`M-x untabify' changes all tabs in the region to appropriate numbers of
spaces.
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20020319140511.A2178@sasken.com>]
end of thread, other threads:[~2003-11-19 14:17 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-17 20:42 TAB Joe Corneli
-- strict thread matches above, loose matches on Subject: below --
2003-11-17 14:32 TAB David Rasmussen
2003-11-17 17:31 ` TAB Kevin Rodgers
2003-11-17 18:16 ` TAB Dan Anderson
2003-11-18 19:23 ` TAB jan
[not found] ` <mailman.170.1069096910.399.help-gnu-emacs@gnu.org>
2003-11-17 19:42 ` TAB Kevin Rodgers
2003-11-17 19:49 ` TAB Sean Richards
2003-11-19 9:42 ` TAB David Rasmussen
2003-11-19 14:17 ` TAB Eli Zaretskii
2003-11-18 0:45 ` TAB Dan Anderson
[not found] <20020319140511.A2178@sasken.com>
[not found] ` <20020319092050.960E9CD2B9@smtp.bcn.isoco.net>
2002-03-26 12:59 ` Tab Alexander Koptelov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).