unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* TAB key to insert tab character
@ 2008-02-08 23:36 Blake McBride
  2008-02-09  4:34 ` Drew Adams
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Blake McBride @ 2008-02-08 23:36 UTC (permalink / raw)
  To: help-gnu-emacs


Greetings,

I have the TAB key doing exactly what I want when editing C or Lisp 
programs but I can't get it to do what I want in TEXT or FUNDAMENTAL 
modes.  I did try to get rid of my .gnu-emacs-custom file temporarily to 
verify that none of my other customizations were causing the problem.

What is happening is that when I hit the TAB key it inserts a number of 
spaces to line the cursor up with the second word of the previous 
sentence.  What I want (in TEXT & FUNDAMENTAL modes) is for the TAB key 
to just add a TAB.  Not an equivalent number of spaces for a TAB or to 
line it up with the previous line's second word - just add a single TAB 
character.

Thanks.

Blake McBride


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

* RE: TAB key to insert tab character
  2008-02-08 23:36 TAB key to insert tab character Blake McBride
@ 2008-02-09  4:34 ` Drew Adams
       [not found] ` <mailman.7193.1202531707.18990.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2008-02-09  4:34 UTC (permalink / raw)
  To: 'Blake McBride', help-gnu-emacs

> I have the TAB key doing exactly what I want when editing C or Lisp 
> programs but I can't get it to do what I want in TEXT or FUNDAMENTAL 
> modes.  I did try to get rid of my .gnu-emacs-custom file 
> temporarily to 
> verify that none of my other customizations were causing the problem.
> 
> What is happening is that when I hit the TAB key it inserts a 
> number of 
> spaces to line the cursor up with the second word of the previous 
> sentence.  What I want (in TEXT & FUNDAMENTAL modes) is for 
> the TAB key 
> to just add a TAB.  Not an equivalent number of spaces for a 
> TAB or to 
> line it up with the previous line's second word - just add a 
> single TAB 
> character.

See option `indent-tabs-mode'.





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

* Re: TAB key to insert tab character
       [not found] ` <mailman.7193.1202531707.18990.help-gnu-emacs@gnu.org>
@ 2008-02-09  5:16   ` Blake McBride
  2008-02-09 13:13     ` Steve Taylor
  0 siblings, 1 reply; 13+ messages in thread
From: Blake McBride @ 2008-02-09  5:16 UTC (permalink / raw)
  To: help-gnu-emacs


Didn't help.  I tried nil and non-nil and created a new buffer each time 
(t.txt) and it didn't change anything.  And, yes, I did save it for the 
current session first.

Thanks.

Blake McBride


Drew Adams wrote:
>> I have the TAB key doing exactly what I want when editing C or Lisp 
>> programs but I can't get it to do what I want in TEXT or FUNDAMENTAL 
>> modes.  I did try to get rid of my .gnu-emacs-custom file 
>> temporarily to 
>> verify that none of my other customizations were causing the problem.
>>
>> What is happening is that when I hit the TAB key it inserts a 
>> number of 
>> spaces to line the cursor up with the second word of the previous 
>> sentence.  What I want (in TEXT & FUNDAMENTAL modes) is for 
>> the TAB key 
>> to just add a TAB.  Not an equivalent number of spaces for a 
>> TAB or to 
>> line it up with the previous line's second word - just add a 
>> single TAB 
>> character.
> 
> See option `indent-tabs-mode'.
> 
> 
> 


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

* Re: TAB key to insert tab character
  2008-02-08 23:36 TAB key to insert tab character Blake McBride
  2008-02-09  4:34 ` Drew Adams
       [not found] ` <mailman.7193.1202531707.18990.help-gnu-emacs@gnu.org>
@ 2008-02-09 10:03 ` Peter Dyballa
       [not found] ` <mailman.7204.1202551399.18990.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 13+ messages in thread
From: Peter Dyballa @ 2008-02-09 10:03 UTC (permalink / raw)
  To: Blake McBride; +Cc: help-gnu-emacs


Am 09.02.2008 um 00:36 schrieb Blake McBride:

> What I want (in TEXT & FUNDAMENTAL modes) is for the TAB key to  
> just add a TAB.

C-q TAB – is this a choice?

--
Greetings

   Pete

It isn't pollution that's harming the environment. It's the  
impurities in our air and water that are doing it.







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

* Re: TAB key to insert tab character
  2008-02-09  5:16   ` Blake McBride
@ 2008-02-09 13:13     ` Steve Taylor
  0 siblings, 0 replies; 13+ messages in thread
From: Steve Taylor @ 2008-02-09 13:13 UTC (permalink / raw)
  To: help-gnu-emacs

Blake McBride <blake@mcbride.name> writes:

> Didn't help.  I tried nil and non-nil and created a new buffer each time
> (t.txt) and it didn't change anything.  And, yes, I did save it for the
> current session first.
>
> Thanks.
>
> Blake McBride
>
>
> Drew Adams wrote:
>>> I have the TAB key doing exactly what I want when editing C or Lisp
>>> programs but I can't get it to do what I want in TEXT or FUNDAMENTAL
>>> modes.  I did try to get rid of my .gnu-emacs-custom file
>>> temporarily to
>>> verify that none of my other customizations were causing the problem.

<your emacs-binary> -q --no-site-file

>>>
>>> What is happening is that when I hit the TAB key it inserts a
>>> number of
>>> spaces to line the cursor up with the second word of the previous
>>> sentence.  What I want (in TEXT & FUNDAMENTAL modes) is for
>>> the TAB key
>>> to just add a TAB.  Not an equivalent number of spaces for a
>>> TAB or to
>>> line it up with the previous line's second word - just add a
>>> single TAB
>>> character.
>>
>> See option `indent-tabs-mode'.
>>
>>
>>

I'm getting tabs in text-mode, with and without customizations in
debian emacs 21.4.1 and emacs-snapshot (22.1.50.1). Have
you set:

(setq tab-always-indent t)

-- 




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

* Re: TAB key to insert tab character
       [not found] ` <mailman.7204.1202551399.18990.help-gnu-emacs@gnu.org>
@ 2008-02-09 17:54   ` Blake McBride
  2008-02-09 17:58     ` Will Parsons
  0 siblings, 1 reply; 13+ messages in thread
From: Blake McBride @ 2008-02-09 17:54 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa wrote:
> 
> Am 09.02.2008 um 00:36 schrieb Blake McBride:
> 
>> What I want (in TEXT & FUNDAMENTAL modes) is for the TAB key to just 
>> add a TAB.
> 
> C-q TAB – is this a choice?
> 

Of course not.  It does work, but I'm not going to type C-q TAB every 
time I want a TAB any more than I'm willing to type C-q R every time I 
want an "R".

Thanks though.

Blake McBride


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

* Re: TAB key to insert tab character
  2008-02-09 17:54   ` Blake McBride
@ 2008-02-09 17:58     ` Will Parsons
  2008-02-09 19:46       ` Eli Zaretskii
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Will Parsons @ 2008-02-09 17:58 UTC (permalink / raw)
  To: help-gnu-emacs

Blake McBride wrote:
> Peter Dyballa wrote:
>> 
>> Am 09.02.2008 um 00:36 schrieb Blake McBride:
>> 
>>> What I want (in TEXT & FUNDAMENTAL modes) is for the TAB key to just 
>>> add a TAB.
>> 
>> C-q TAB – is this a choice?
>
> Of course not.  It does work, but I'm not going to type C-q TAB every 
> time I want a TAB any more than I'm willing to type C-q R every time I 
> want an "R".

You could do what I do - bind Ctrl-Tab to insert an ASCII <tab>:

  (global-set-key [C-tab] (lambda () (interactive) (insert-char 9 1)))

- Will


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

* Re: TAB key to insert tab character
  2008-02-09 17:58     ` Will Parsons
@ 2008-02-09 19:46       ` Eli Zaretskii
  2008-02-09 20:56       ` Blake McBride
       [not found]       ` <mailman.7229.1202586422.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2008-02-09 19:46 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Will Parsons <oudeis@nodomain.invalid>
> Date: 9 Feb 2008 17:58:58 GMT
> 
> You could do what I do - bind Ctrl-Tab to insert an ASCII <tab>:
> 
>   (global-set-key [C-tab] (lambda () (interactive) (insert-char 9 1)))

I think it's better to bind TAB to self-insert-command:

  (global-set-key "\C-i" 'self-insert-command)




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

* Re: TAB key to insert tab character
  2008-02-09 17:58     ` Will Parsons
  2008-02-09 19:46       ` Eli Zaretskii
@ 2008-02-09 20:56       ` Blake McBride
  2008-02-10  4:14         ` Eli Zaretskii
       [not found]         ` <mailman.7240.1202616871.18990.help-gnu-emacs@gnu.org>
       [not found]       ` <mailman.7229.1202586422.18990.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 13+ messages in thread
From: Blake McBride @ 2008-02-09 20:56 UTC (permalink / raw)
  To: help-gnu-emacs

Will Parsons wrote:
> Blake McBride wrote:
>> Peter Dyballa wrote:
>>> Am 09.02.2008 um 00:36 schrieb Blake McBride:
>>>
>>>> What I want (in TEXT & FUNDAMENTAL modes) is for the TAB key to just 
>>>> add a TAB.
>>> C-q TAB – is this a choice?
>> Of course not.  It does work, but I'm not going to type C-q TAB every 
>> time I want a TAB any more than I'm willing to type C-q R every time I 
>> want an "R".
> 
> You could do what I do - bind Ctrl-Tab to insert an ASCII <tab>:
> 
>   (global-set-key [C-tab] (lambda () (interactive) (insert-char 9 1)))
> 
> - Will

I don't want to globally set anything.  I like the way the TAB key works 
in C and Lisp modes.  I just want to change its behavior in TEXT and 
FUNDAMENTAL modes.

Blake McBride


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

* Re: TAB key to insert tab character
       [not found]       ` <mailman.7229.1202586422.18990.help-gnu-emacs@gnu.org>
@ 2008-02-10  1:18         ` Will Parsons
  0 siblings, 0 replies; 13+ messages in thread
From: Will Parsons @ 2008-02-10  1:18 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii wrote:
>> From: Will Parsons <oudeis@nodomain.invalid>
>> Date: 9 Feb 2008 17:58:58 GMT
>> 
>> You could do what I do - bind Ctrl-Tab to insert an ASCII <tab>:
>> 
>>   (global-set-key [C-tab] (lambda () (interactive) (insert-char 9 1)))
>
> I think it's better to bind TAB to self-insert-command:
>
>   (global-set-key "\C-i" 'self-insert-command)

I think you misunderstand - I'm perfectly happy to have <tab> do its
usual default action, but I also want to have the ability to insert a
<tab> character often enough to want something more convenient than
C-q TAB, and for this I use [C-tab].  Whether this is acceptable to the
OP is another matter, but since he rejected C-q Tab as too inconvenient,
I thought it worth his consideration.

- Will


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

* Re: TAB key to insert tab character
  2008-02-09 20:56       ` Blake McBride
@ 2008-02-10  4:14         ` Eli Zaretskii
       [not found]         ` <mailman.7240.1202616871.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2008-02-10  4:14 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Blake McBride <blake@mcbride.name>
> Date: Sat, 09 Feb 2008 14:56:02 -0600
> 
> > You could do what I do - bind Ctrl-Tab to insert an ASCII <tab>:
> > 
> >   (global-set-key [C-tab] (lambda () (interactive) (insert-char 9 1)))
> > 
> > - Will
> 
> I don't want to globally set anything.  I like the way the TAB key works 
> in C and Lisp modes.  I just want to change its behavior in TEXT and 
> FUNDAMENTAL modes.

Did you actually try that?  I think mode-specific key bindings always
override global bindings, so the above will not affect C mode. for
example.

But if you want to bind TAB in Text mode, then try the below:

  (define-key text-mode-map "\C-i" 'self-insert-command)

You will need to do this in a text-mode-hook.




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

* Re: TAB key to insert tab character
       [not found]         ` <mailman.7240.1202616871.18990.help-gnu-emacs@gnu.org>
@ 2008-02-11 14:27           ` Blake McBride
  2008-02-12 19:38             ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: Blake McBride @ 2008-02-11 14:27 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii wrote:
>> From: Blake McBride <blake@mcbride.name>
>> Date: Sat, 09 Feb 2008 14:56:02 -0600
>>
>>> You could do what I do - bind Ctrl-Tab to insert an ASCII <tab>:
>>>
>>>   (global-set-key [C-tab] (lambda () (interactive) (insert-char 9 1)))
>>>
>>> - Will
>> I don't want to globally set anything.  I like the way the TAB key works 
>> in C and Lisp modes.  I just want to change its behavior in TEXT and 
>> FUNDAMENTAL modes.
> 
> Did you actually try that?  I think mode-specific key bindings always
> override global bindings, so the above will not affect C mode. for
> example.
> 
> But if you want to bind TAB in Text mode, then try the below:
> 
>   (define-key text-mode-map "\C-i" 'self-insert-command)
> 
> You will need to do this in a text-mode-hook.
> 
> 

Okay, I added the following line:

	(define-key text-mode-map (kbd "TAB") 'self-insert-command)

This fixed the problem in TEXT mode.  I didn't seem to have to use it in 
a text-mode-hook.  Now the problem is how to fix thins in FUNDAMENTAL 
mode (the mode used when no special file extension is used)?

Thanks.

Blake McBride


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

* Re: TAB key to insert tab character
  2008-02-11 14:27           ` Blake McBride
@ 2008-02-12 19:38             ` Eli Zaretskii
  0 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2008-02-12 19:38 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Blake McBride <blake@mcbride.name>
> Date: Mon, 11 Feb 2008 08:27:04 -0600
> 
> Okay, I added the following line:
> 
> 	(define-key text-mode-map (kbd "TAB") 'self-insert-command)
> 
> This fixed the problem in TEXT mode.  I didn't seem to have to use it in 
> a text-mode-hook.  Now the problem is how to fix thins in FUNDAMENTAL 
> mode (the mode used when no special file extension is used)?

I think the global binding I suggested earlier, viz

  (global-set-key "\C-i" 'self-insert-command)

should do what you want.




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

end of thread, other threads:[~2008-02-12 19:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-08 23:36 TAB key to insert tab character Blake McBride
2008-02-09  4:34 ` Drew Adams
     [not found] ` <mailman.7193.1202531707.18990.help-gnu-emacs@gnu.org>
2008-02-09  5:16   ` Blake McBride
2008-02-09 13:13     ` Steve Taylor
2008-02-09 10:03 ` Peter Dyballa
     [not found] ` <mailman.7204.1202551399.18990.help-gnu-emacs@gnu.org>
2008-02-09 17:54   ` Blake McBride
2008-02-09 17:58     ` Will Parsons
2008-02-09 19:46       ` Eli Zaretskii
2008-02-09 20:56       ` Blake McBride
2008-02-10  4:14         ` Eli Zaretskii
     [not found]         ` <mailman.7240.1202616871.18990.help-gnu-emacs@gnu.org>
2008-02-11 14:27           ` Blake McBride
2008-02-12 19:38             ` Eli Zaretskii
     [not found]       ` <mailman.7229.1202586422.18990.help-gnu-emacs@gnu.org>
2008-02-10  1:18         ` Will Parsons

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).