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

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

Re: Spaces rather than tabs by a major mode hook


From: Tassilo Horn
Subject: Re: Spaces rather than tabs by a major mode hook
Date: Thu, 9 Jun 2022 21:54:27 +0200 (GMT+02:00)

The TAB key is usually bound to some indentation command such as 
indent-according-to-mode. So bind that to some other key and TAB to 
self-insert-command.

HTH,
Tassilo

09.06.2022 21:40:26 goncholden <goncholden@protonmail.com>:

> 
> ------- Original Message -------
> On Friday, June 10th, 2022 at 7:24 AM, Tassilo Horn <tsdh@gnu.org> wrote:
> 
> 
>> goncholden goncholden@protonmail.com writes:
>> 
>>>>> ((c++-mode
>>>>> (indent-tabs-mode . t)
>>>>> (c-mode
>>>>> (indent-tabs-mode . t)))
>>> 
>>> Suppose I have a file with tabs, would the change show the tabs as
>>> spaces? I would rather have the file show as it is. If there are
>>> tabs in the file, would (setq-default indent-tabs-mode nil) show them
>>> as spaces?
>> 
>> 
>> It doesn't affect how tabs/spaces are displayed. It just defines if
>> emacs' indentation commands may insert tabs. Even with indent-tabs-mode
>> set to nil, you can still manually insert a TAB using C-q TAB.
>> 
>> If you want to convert a file from/to tabs, you can use the commands
>> tabify and untabify.
>> 
>> Bye,
>> Tassilo
> 
> Makes sense but I find it somewhat complicated.
> 
> It works well if I press return and get indentation with spaces.  But if 
> someone presses the tab key, why does it not accept that tab?
> 
> I would like to be able to introduce a tab with the tab key but indent with 
> spaces.



reply via email to

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