all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* TAB character
@ 2002-11-20 19:03 Stirling Olson
  0 siblings, 0 replies; 9+ messages in thread
From: Stirling Olson @ 2002-11-20 19:03 UTC (permalink / raw)


How can I make the TAB key just enter a TAB character and never have
that TAB character turn into spaces?

While editing .java files and other files hitting the TAB key seems to
follow some indenting conventions that I don't understand and don't
prefer.  It often enters spaces and sometimes won't even let me enter a
further tab.  I just want to have a tab character entered in the buffer
when I hit TAB and when I backspace or delete a tab in the buffer I
don't want it to turn into spaces.

Right now indent-tabs-mode is t but that still doesn't seem to help
matters.  Right now I can't even use the editor because I can't figure
out how to outwit this thing so I can have tabs where I want.  I'm happy
to read documentation but I can't seem to find the right information and
don't really want to read 10 whole books just to figure out how to enter
a tab in my document so I can determine whether this editor is worth
learning...

Thanks in advance for any and all help.

Best Regards,
Stirling

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

* Re: TAB character
       [not found] <mailman.1037819061.24117.help-gnu-emacs@gnu.org>
@ 2002-11-22 21:56 ` Benjamin Rutt
  0 siblings, 0 replies; 9+ messages in thread
From: Benjamin Rutt @ 2002-11-22 21:56 UTC (permalink / raw)


Stirling Olson <seo@foraker.com> writes:

> How can I make the TAB key just enter a TAB character and never have
> that TAB character turn into spaces?
>
> While editing .java files and other files hitting the TAB key seems to
> follow some indenting conventions that I don't understand and don't
> prefer.  It often enters spaces and sometimes won't even let me enter a
> further tab.  I just want to have a tab character entered in the buffer
> when I hit TAB and when I backspace or delete a tab in the buffer I
> don't want it to turn into spaces.

In this case, I think you want to pick a number (like 4) that you want
to use for the distance between your tab stops.

Then, I believe you need to synchronize several variables based off of
that number:

(add-hook 'java-mode-hook
          (lambda ()
            (setq tab-width 4)
            (setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40)
            (setq c-basic-offset 4))))

Future TAB presses should indent your code only to the tab stop list,
and therefore no spaces will be inserted.
-- 
Benjamin

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

* tab character
@ 2011-10-27 13:45 Rustom Mody
  2011-10-27 14:31 ` Ludwig, Mark
  0 siblings, 1 reply; 9+ messages in thread
From: Rustom Mody @ 2011-10-27 13:45 UTC (permalink / raw)
  To: help-gnu-emacs

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

The tab-always-indent docs say:

-----------------------------
Controls the operation of the TAB key.
If t, hitting TAB always just indents the current line.
If nil, hitting TAB indents the current line if point is at the left margin
or in the line's indentation, otherwise it inserts a \"real\" TAB character.
If `complete', TAB first tries to indent the current line, and if the line
was already indented, then try to complete the thing at point.

Some programming language modes have their own variable to control this,
e.g., `c-tab-always-indent', and do not respect this variable."
  :group 'indent
--------------------------------
Why is there nothing stronger than nil? IOW why is it so hard to just have
tab be tab with no conditions?

In Miles Bader page on emacswiki http://www.emacswiki.org/emacs/MilesBader
he has code for a literal-tab-mode.  So am I right in guessing that that is
the only approach if one wants tab characters to be entered?

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

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

* RE: tab character
  2011-10-27 13:45 tab character Rustom Mody
@ 2011-10-27 14:31 ` Ludwig, Mark
  2011-10-27 15:05   ` Rustom Mody
       [not found]   ` <mailman.1178.1319727924.15868.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Ludwig, Mark @ 2011-10-27 14:31 UTC (permalink / raw)
  To: Rustom Mody, help-gnu-emacs@gnu.org

If you just want it to insert a TAB character every time, just map the key to self-insert-command.

Are you familiar with M-i that runs tab-to-tab-stop?  That might be what you want, too, especially if you want spaces inserted to 'equal' what the TAB character would do on a typewriter, for instance.

Hope this helps,

Mark

From: help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org [mailto:help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org] On Behalf Of Rustom Mody
Sent: Thursday, October 27, 2011 8:45 AM
To: help-gnu-emacs@gnu.org
Subject: tab character

The tab-always-indent docs say:

-----------------------------
Controls the operation of the TAB key.
If t, hitting TAB always just indents the current line.
If nil, hitting TAB indents the current line if point is at the left margin
or in the line's indentation, otherwise it inserts a \"real\" TAB character.
If `complete', TAB first tries to indent the current line, and if the line
was already indented, then try to complete the thing at point.

Some programming language modes have their own variable to control this,
e.g., `c-tab-always-indent', and do not respect this variable."
  :group 'indent
--------------------------------
Why is there nothing stronger than nil? IOW why is it so hard to just have tab be tab with no conditions?

In Miles Bader page on emacswiki http://www.emacswiki.org/emacs/MilesBader
he has code for a literal-tab-mode.  So am I right in guessing that that is the only approach if one wants tab characters to be entered?



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

* Re: tab character
  2011-10-27 14:31 ` Ludwig, Mark
@ 2011-10-27 15:05   ` Rustom Mody
  2011-10-27 15:13     ` Ludwig, Mark
  2011-10-27 20:23     ` Andreas Röhler
       [not found]   ` <mailman.1178.1319727924.15868.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 9+ messages in thread
From: Rustom Mody @ 2011-10-27 15:05 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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

On Thu, Oct 27, 2011 at 8:01 PM, Ludwig, Mark <ludwig.mark@siemens.com>wrote:

> If you just want it to insert a TAB character every time, just map the key
> to self-insert-command.
>

Yes I gathered that this is the only way (or  C-q TAB).  Seems fairly
low-level for such a basic usage...


> Are you familiar with M-i that runs tab-to-tab-stop?  That might be what
> you want, too, especially if you want spaces inserted to 'equal' what the
> TAB character would do on a typewriter, for instance.
>
>
I need tab to be entered as tab without any questions or ambiguity (think
makefiles?)


> Hope this helps,
>
> Mark
>
> From: help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org [mailto:
> help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org] On Behalf Of
> Rustom Mody
> Sent: Thursday, October 27, 2011 8:45 AM
> To: help-gnu-emacs@gnu.org
> Subject: tab character
>
> The tab-always-indent docs say:
>
> -----------------------------
> Controls the operation of the TAB key.
> If t, hitting TAB always just indents the current line.
> If nil, hitting TAB indents the current line if point is at the left margin
> or in the line's indentation, otherwise it inserts a \"real\" TAB
> character.
> If `complete', TAB first tries to indent the current line, and if the line
> was already indented, then try to complete the thing at point.
>
> Some programming language modes have their own variable to control this,
> e.g., `c-tab-always-indent', and do not respect this variable."
>   :group 'indent
> --------------------------------
> Why is there nothing stronger than nil? IOW why is it so hard to just have
> tab be tab with no conditions?
>
> In Miles Bader page on emacswiki http://www.emacswiki.org/emacs/MilesBader
> he has code for a literal-tab-mode.  So am I right in guessing that that
> is the only approach if one wants tab characters to be entered?
>

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

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

* RE: tab character
  2011-10-27 15:05   ` Rustom Mody
@ 2011-10-27 15:13     ` Ludwig, Mark
  2011-10-27 20:23     ` Andreas Röhler
  1 sibling, 0 replies; 9+ messages in thread
From: Ludwig, Mark @ 2011-10-27 15:13 UTC (permalink / raw)
  To: Rustom Mody, help-gnu-emacs@gnu.org

Sure, but in a Makefile, you should be in Makefile mode (Major mode for editing Makefiles), and it inserts TAB characters....

Cheers,

Mark

From: help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org [mailto:help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org] On Behalf Of Rustom Mody
Sent: Thursday, October 27, 2011 10:05 AM
To: help-gnu-emacs@gnu.org
Subject: Re: tab character

On Thu, Oct 27, 2011 at 8:01 PM, Ludwig, Mark <ludwig.mark@siemens.com> wrote:
If you just want it to insert a TAB character every time, just map the key to self-insert-command.

Yes I gathered that this is the only way (or  C-q TAB).  Seems fairly low-level for such a basic usage...

Are you familiar with M-i that runs tab-to-tab-stop?  That might be what you want, too, especially if you want spaces inserted to 'equal' what the TAB character would do on a typewriter, for instance.

I need tab to be entered as tab without any questions or ambiguity (think makefiles?)
 
Hope this helps,

Mark

From: help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org [mailto:help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org] On Behalf Of Rustom Mody
Sent: Thursday, October 27, 2011 8:45 AM
To: help-gnu-emacs@gnu.org
Subject: tab character

The tab-always-indent docs say:

-----------------------------
Controls the operation of the TAB key.
If t, hitting TAB always just indents the current line.
If nil, hitting TAB indents the current line if point is at the left margin
or in the line's indentation, otherwise it inserts a \"real\" TAB character.
If `complete', TAB first tries to indent the current line, and if the line
was already indented, then try to complete the thing at point.

Some programming language modes have their own variable to control this,
e.g., `c-tab-always-indent', and do not respect this variable."
  :group 'indent
--------------------------------
Why is there nothing stronger than nil? IOW why is it so hard to just have tab be tab with no conditions?

In Miles Bader page on emacswiki http://www.emacswiki.org/emacs/MilesBader
he has code for a literal-tab-mode.  So am I right in guessing that that is the only approach if one wants tab characters to be entered?




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

* Re: tab character
       [not found]   ` <mailman.1178.1319727924.15868.help-gnu-emacs@gnu.org>
@ 2011-10-27 15:18     ` Pascal J. Bourguignon
  0 siblings, 0 replies; 9+ messages in thread
From: Pascal J. Bourguignon @ 2011-10-27 15:18 UTC (permalink / raw)
  To: help-gnu-emacs

Rustom Mody <rustompmody@gmail.com> writes:

> On Thu, Oct 27, 2011 at 8:01 PM, Ludwig, Mark <ludwig.mark@siemens.com> wrote:
>
>     If you just want it to insert a TAB character every time, just map the key to self-insert-command.
>
> Yes I gathered that this is the only way (or  C-q TAB).  Seems fairly low-level for such a basic usage...
>
>     Are you familiar with M-i that runs tab-to-tab-stop?  That might be what you want, too, especially if you want spaces inserted to 'equal' what the TAB character would do on a typewriter, for instance.
>
> I need tab to be entered as tab without any questions or ambiguity (think makefiles?)

emacs already inserts TAB without any question asked in Makefiles.

The creator of make said it was his biggest error ever to have specified
TABs for makefiles!


http://www.faqs.org/docs/artu/ch15s04.html

    No discussion of make(1) would be complete without an
    acknowledgement that it includes one of the worst design botches in
    the history of Unix. The use of tab characters as a required leader
    for command lines associated with a production means that the
    interpretation of a makefile can change drastically on the basis of
    invisible differences in whitespace.


        Why the tab in column 1? Yacc was new, Lex was brand new. I
        hadn't tried either, so I figured this would be a good excuse to
        learn. After getting myself snarled up with my first stab at
        Lex, I just did something simple with the pattern
        newline-tab. It worked, it stayed. And then a few weeks later I
        had a user population of about a dozen, most of them friends,
        and I didn't want to screw up my embedded base. The rest, sadly,
        is history.

    -- Stuart Feldman 	 


We told you, TABs are evil!

Do not propagate them!


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


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

* Re: tab character
  2011-10-27 15:05   ` Rustom Mody
  2011-10-27 15:13     ` Ludwig, Mark
@ 2011-10-27 20:23     ` Andreas Röhler
  1 sibling, 0 replies; 9+ messages in thread
From: Andreas Röhler @ 2011-10-27 20:23 UTC (permalink / raw)
  To: help-gnu-emacs

Am 27.10.2011 17:05, schrieb Rustom Mody:
> On Thu, Oct 27, 2011 at 8:01 PM, Ludwig, Mark<ludwig.mark@siemens.com>wrote:
>
>> If you just want it to insert a TAB character every time, just map the key
>> to self-insert-command.
>>
>
> Yes I gathered that this is the only way (or  C-q TAB).  Seems fairly
> low-level for such a basic usage...
>
>
>> Are you familiar with M-i that runs tab-to-tab-stop?  That might be what
>> you want, too, especially if you want spaces inserted to 'equal' what the
>> TAB character would do on a typewriter, for instance.
>>
>>
> I need tab to be entered as tab without any questions or ambiguity (think
> makefiles?)
>
>
>> Hope this helps,
>>
>> Mark
>>
>> From: help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org [mailto:
>> help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org] On Behalf Of
>> Rustom Mody
>> Sent: Thursday, October 27, 2011 8:45 AM
>> To: help-gnu-emacs@gnu.org
>> Subject: tab character
>>
>> The tab-always-indent docs say:
>>
>> -----------------------------
>> Controls the operation of the TAB key.
>> If t, hitting TAB always just indents the current line.
>> If nil, hitting TAB indents the current line if point is at the left margin
>> or in the line's indentation, otherwise it inserts a \"real\" TAB
>> character.
>> If `complete', TAB first tries to indent the current line, and if the line
>> was already indented, then try to complete the thing at point.
>>
>> Some programming language modes have their own variable to control this,
>> e.g., `c-tab-always-indent', and do not respect this variable."
>>    :group 'indent
>> --------------------------------
>> Why is there nothing stronger than nil? IOW why is it so hard to just have
>> tab be tab with no conditions?

Hi,

think you are perfectly right to ask that.
A design flaw IMHO.
Think it's worth a bug report or a post to emacs-devel.

Andreas







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

* RE: tab character
@ 2011-10-27 22:27 Buchs, Kevin
  0 siblings, 0 replies; 9+ messages in thread
From: Buchs, Kevin @ 2011-10-27 22:27 UTC (permalink / raw)
  To: help-gnu-emacs

Whenever I want to insert a few literal tabs, I just escape it with C-q Tab. If I want to have tabs every time in a particular file, I will turn on this true-tab-mode I created:

(defvar true-tab-mode-map
  (let ( (map (make-sparse-keymap)) )  ; sparse keymap copies the existing one
    (define-key map "\t" 'self-insert-command)
    map) ; return the value of the let clause, which is map from this line
 "Keymap for `true-tab-mode'.")

(define-derived-mode true-tab-mode text-mode "text TrueTab"
" Major mode based on text mode, just reassigns the TAB key to do
an insertion of a tab.  Key map: \\{true-tab-mode-map}")



Kevin Buchs   |  Senior Engineer  |  Department of Physiology and Biomedical Engineering - SPPDG
507-538-5459  |   buchs.kevin@mayo.edu  |  http://www.mayo.edu/sppdg
Mayo Clinic  |  200 1st St. SW  |  Rochester, MN 55905  




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

end of thread, other threads:[~2011-10-27 22:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-27 13:45 tab character Rustom Mody
2011-10-27 14:31 ` Ludwig, Mark
2011-10-27 15:05   ` Rustom Mody
2011-10-27 15:13     ` Ludwig, Mark
2011-10-27 20:23     ` Andreas Röhler
     [not found]   ` <mailman.1178.1319727924.15868.help-gnu-emacs@gnu.org>
2011-10-27 15:18     ` Pascal J. Bourguignon
  -- strict thread matches above, loose matches on Subject: below --
2011-10-27 22:27 Buchs, Kevin
     [not found] <mailman.1037819061.24117.help-gnu-emacs@gnu.org>
2002-11-22 21:56 ` TAB character Benjamin Rutt
2002-11-20 19:03 Stirling Olson

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.