* change spaces indent in text mode? @ 2010-01-29 19:28 Brendan Miller 0 siblings, 0 replies; 20+ messages in thread From: Brendan Miller @ 2010-01-29 19:28 UTC (permalink / raw To: help-gnu-emacs When I hit tab in text mode, it indents by 5 spaces. How do I change that? Setting tab-width doesn't seem to do the right thing. To be clear, although I indent with the tab key, I'm not using tab characters. I don't use tab characters anywhere. Brendan ^ permalink raw reply [flat|nested] 20+ messages in thread
[parent not found: <mailman.440.1264793480.14305.help-gnu-emacs@gnu.org>]
* Re: change spaces indent in text mode? [not found] <mailman.440.1264793480.14305.help-gnu-emacs@gnu.org> @ 2010-01-29 19:39 ` Teemu Likonen 2010-01-29 20:50 ` Brendan Miller ` (3 more replies) 0 siblings, 4 replies; 20+ messages in thread From: Teemu Likonen @ 2010-01-29 19:39 UTC (permalink / raw To: help-gnu-emacs * 2010-01-29 11:28 (-0800), Brendan Miller wrote: > When I hit tab in text mode, it indents by 5 spaces. How do I change > that? Setting tab-width doesn't seem to do the right thing. TAB key in text-mode indents to the columns of previous line's words. If you want to go to next tab stop, as defined in tab-stop-list variable, use M-i. For example, first write a line like this: Here are some words. Then press TAB key a couple of times on the next line. Then go to the beginning of line and press M-i a couple of times. You should see the difference. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-01-29 19:39 ` Teemu Likonen @ 2010-01-29 20:50 ` Brendan Miller 2010-01-29 21:22 ` Tom Rauchenwald ` (3 more replies) [not found] ` <mailman.443.1264798210.14305.help-gnu-emacs@gnu.org> ` (2 subsequent siblings) 3 siblings, 4 replies; 20+ messages in thread From: Brendan Miller @ 2010-01-29 20:50 UTC (permalink / raw To: Teemu Likonen; +Cc: help-gnu-emacs Great, thanks! The only problem I have, is that m-i seems to indent by 8 spaces. I tried putting (setq tab-width 4) in my .emacs, but that doesn't seem to change anything... is m-i controlled by a different variable? On Fri, Jan 29, 2010 at 11:39 AM, Teemu Likonen <tlikonen@iki.fi> wrote: > * 2010-01-29 11:28 (-0800), Brendan Miller wrote: > >> When I hit tab in text mode, it indents by 5 spaces. How do I change >> that? Setting tab-width doesn't seem to do the right thing. > > TAB key in text-mode indents to the columns of previous line's words. If > you want to go to next tab stop, as defined in tab-stop-list variable, > use M-i. For example, first write a line like this: > > Here are some words. > > Then press TAB key a couple of times on the next line. Then go to the > beginning of line and press M-i a couple of times. You should see the > difference. > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-01-29 20:50 ` Brendan Miller @ 2010-01-29 21:22 ` Tom Rauchenwald 2010-01-30 0:51 ` Brendan Miller 2010-01-29 21:30 ` Tyler Smith ` (2 subsequent siblings) 3 siblings, 1 reply; 20+ messages in thread From: Tom Rauchenwald @ 2010-01-29 21:22 UTC (permalink / raw To: help-gnu-emacs Brendan Miller <catphive@catphive.net> writes: > Great, thanks! > > The only problem I have, is that m-i seems to indent by 8 spaces. I > tried putting > > (setq tab-width 4) in my .emacs, but that doesn't seem to change > anything... is m-i controlled by a different variable? Try (setq-default tab-width 4) -tom -- Ob ein Sandkorn oder ein Stein, im Wasser gehen sie beide unter. -- Mi-do ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-01-29 21:22 ` Tom Rauchenwald @ 2010-01-30 0:51 ` Brendan Miller 2010-01-30 1:56 ` Suvayu Ali 0 siblings, 1 reply; 20+ messages in thread From: Brendan Miller @ 2010-01-30 0:51 UTC (permalink / raw To: Tom Rauchenwald; +Cc: help-gnu-emacs On Fri, Jan 29, 2010 at 1:22 PM, Tom Rauchenwald <sehnsucht.nach.unendlichkeit@quantentunnel.de> wrote: > Brendan Miller <catphive@catphive.net> writes: > >> Great, thanks! >> >> The only problem I have, is that m-i seems to indent by 8 spaces. I >> tried putting >> >> (setq tab-width 4) in my .emacs, but that doesn't seem to change >> anything... is m-i controlled by a different variable? > > Try (setq-default tab-width 4) Nope. m-i still indents by 8 spaces. I'm on emacs 23, if that matters. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-01-30 0:51 ` Brendan Miller @ 2010-01-30 1:56 ` Suvayu Ali 0 siblings, 0 replies; 20+ messages in thread From: Suvayu Ali @ 2010-01-30 1:56 UTC (permalink / raw To: help-gnu-emacs On Friday 29 January 2010 04:51 PM, Brendan Miller wrote: > On Fri, Jan 29, 2010 at 1:22 PM, Tom Rauchenwald > <sehnsucht.nach.unendlichkeit@quantentunnel.de> wrote: >> Brendan Miller<catphive@catphive.net> writes: >> >>> Great, thanks! >>> >>> The only problem I have, is that m-i seems to indent by 8 spaces. I >>> tried putting >>> >>> (setq tab-width 4) in my .emacs, but that doesn't seem to change >>> anything... is m-i controlled by a different variable? >> >> Try (setq-default tab-width 4) > > Nope. m-i still indents by 8 spaces. > > I'm on emacs 23, if that matters. For now you can try `M-x edit-tab-stops RET'. That allows you to edit the tab stops interactively. Hopefully this will be helpful. -- Suvayu Open source is the future. It sets us free. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-01-29 20:50 ` Brendan Miller 2010-01-29 21:22 ` Tom Rauchenwald @ 2010-01-29 21:30 ` Tyler Smith [not found] ` <mailman.444.1264800653.14305.help-gnu-emacs@gnu.org> [not found] ` <mailman.447.1264801240.14305.help-gnu-emacs@gnu.org> 3 siblings, 0 replies; 20+ messages in thread From: Tyler Smith @ 2010-01-29 21:30 UTC (permalink / raw To: help-gnu-emacs Brendan Miller <catphive@catphive.net> writes: > The only problem I have, is that m-i seems to indent by 8 spaces. I > tried putting > > (setq tab-width 4) in my .emacs, but that doesn't seem to change > anything... is m-i controlled by a different variable? The documentation is a little confusing on this, at least to me. My Emacs manual (info "(emacs)Text Display") says that you need to use default-tab-width for this, as tab-width is buffer local, meaning it only applies to the buffer you were in when you set it. However, the help for default-tab-width (C-h v default-tab-width) says that default-tab-width is deprecated, and tab-width should be used instead. I think this might qualify as a buglet in the documentation, unless I'm missing something obvious. Tyler ^ permalink raw reply [flat|nested] 20+ messages in thread
[parent not found: <mailman.444.1264800653.14305.help-gnu-emacs@gnu.org>]
* Re: change spaces indent in text mode? [not found] ` <mailman.444.1264800653.14305.help-gnu-emacs@gnu.org> @ 2010-02-01 17:07 ` Stefan Monnier 0 siblings, 0 replies; 20+ messages in thread From: Stefan Monnier @ 2010-02-01 17:07 UTC (permalink / raw To: help-gnu-emacs > The documentation is a little confusing on this, at least to me. My > Emacs manual (info "(emacs)Text Display") says that you need to use > default-tab-width for this, as tab-width is buffer local, meaning it > only applies to the buffer you were in when you set it. However, the > help for default-tab-width (C-h v default-tab-width) says that > default-tab-width is deprecated, and tab-width should be used instead. > I think this might qualify as a buglet in the documentation, unless I'm > missing something obvious. Indeed, thanks. It is obsolete but the doc hasn't been updated correspondingly. Stefan ^ permalink raw reply [flat|nested] 20+ messages in thread
[parent not found: <mailman.447.1264801240.14305.help-gnu-emacs@gnu.org>]
* Re: change spaces indent in text mode? [not found] ` <mailman.447.1264801240.14305.help-gnu-emacs@gnu.org> @ 2010-02-06 8:11 ` Jorgen Grahn 2010-02-07 0:51 ` Tim X 0 siblings, 1 reply; 20+ messages in thread From: Jorgen Grahn @ 2010-02-06 8:11 UTC (permalink / raw To: help-gnu-emacs On Fri, 2010-01-29, Tom Rauchenwald wrote: > Brendan Miller <catphive@catphive.net> writes: > >> Great, thanks! >> >> The only problem I have, is that m-i seems to indent by 8 spaces. I >> tried putting >> >> (setq tab-width 4) in my .emacs, but that doesn't seem to change >> anything... is m-i controlled by a different variable? > > Try (setq-default tab-width 4) A few people have suggested this. Note that this redefines the appearance *in your Emacs* of the TAB character and the text as a whole. It will look wrong in any other program and to any other reader who hasn't reconfigured his tools in the same way. I have the misfortune of working with source code where half of it uses this configuration and half doesn't. It's pure pain; please don't do it unless you *know* noone but you will ever have to read this text. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-02-06 8:11 ` Jorgen Grahn @ 2010-02-07 0:51 ` Tim X 2010-02-07 3:31 ` Tim X 2010-02-08 2:14 ` Stefan Monnier 0 siblings, 2 replies; 20+ messages in thread From: Tim X @ 2010-02-07 0:51 UTC (permalink / raw To: help-gnu-emacs Jorgen Grahn <grahn+nntp@snipabacken.se> writes: > On Fri, 2010-01-29, Tom Rauchenwald wrote: >> Brendan Miller <catphive@catphive.net> writes: >> >>> Great, thanks! >>> >>> The only problem I have, is that m-i seems to indent by 8 spaces. I >>> tried putting >>> >>> (setq tab-width 4) in my .emacs, but that doesn't seem to change >>> anything... is m-i controlled by a different variable? >> >> Try (setq-default tab-width 4) > > A few people have suggested this. Note that this redefines the > appearance *in your Emacs* of the TAB character and the text as a > whole. It will look wrong in any other program and to any other reader > who hasn't reconfigured his tools in the same way. > > I have the misfortune of working with source code where half of it > uses this configuration and half doesn't. It's pure pain; please > don't do it unless you *know* noone but you will ever have to read > this text. > Sorry, but I think you have things upside down. The problem you describe is not due to people modifying tab width, but rather inconsistent use of tabs. If everyone you had to work with used tabs, then it would be possible to realise one of the great benefits of tabs. That is, we could all have the amount of indent that we want, 2 spaces, 4, 8 10 whatever and it wouldn't matter. If we insist on everyone having the same width tab stops, then really, we have lost the benefit of tab and can just use spaces. In fact, if you are having problems because of inconsistent use of tabs/spaces maybe the solution is to have emacs convert all spaces to tabs and only use spaces when you hit the tab key or have emacs convert all leading spaces to tabs so that you don't get the mixture. There is a downside in doing this if you are in a team using version control if your VC isn't configured correctly as the changes will be seen as changes in content rather than just changes in whitespace styles. Tim -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-02-07 0:51 ` Tim X @ 2010-02-07 3:31 ` Tim X 2010-02-08 2:14 ` Stefan Monnier 1 sibling, 0 replies; 20+ messages in thread From: Tim X @ 2010-02-07 3:31 UTC (permalink / raw To: help-gnu-emacs Responding to myself to correct some errors and my misreading of the post! Tim X <timx@nospam.dev.null> writes: > Jorgen Grahn <grahn+nntp@snipabacken.se> writes: > >> On Fri, 2010-01-29, Tom Rauchenwald wrote: >>> Brendan Miller <catphive@catphive.net> writes: >>> >>>> Great, thanks! >>>> >>>> The only problem I have, is that m-i seems to indent by 8 spaces. I >>>> tried putting >>>> >>>> (setq tab-width 4) in my .emacs, but that doesn't seem to change >>>> anything... is m-i controlled by a different variable? >>> >>> Try (setq-default tab-width 4) >> >> A few people have suggested this. Note that this redefines the >> appearance *in your Emacs* of the TAB character and the text as a >> whole. It will look wrong in any other program and to any other reader >> who hasn't reconfigured his tools in the same way. >> >> I have the misfortune of working with source code where half of it >> uses this configuration and half doesn't. It's pure pain; please >> don't do it unless you *know* noone but you will ever have to read >> this text. >> > > Sorry, but I think you have things upside down. The problem you describe > is not due to people modifying tab width, but rather inconsistent use of > tabs. > On reading this back, I think I may have misunderstood what you were saying and want to clarify. Having a mixture of indents which use spaces and indents that use tabs DOES make life difficult. However, I don't believe changing the variable default-tab-widthh affects whether tabs are used or spaces. The variable that determines this is indent-tabs-mode. If this is set to nil, spaces will be used instead of tabs. Changing default-tab-width only affects the display width of tabs i.e. how many spaces used to represent a tab and does nnot affect whether tabs are used or spaces. i.e. it only affects how things are displayed and not what characters are inserted intot he buffer. > If everyone you had to work with used tabs, then it would be possible to > realise one of the great benefits of tabs. That is, we could all have > the amount of indent that we want, 2 spaces, 4, 8 10 whatever and it > wouldn't matter. Which, when re-reading the message I was responding to, would appear to be what the author was saying. Saying that changing tab width would change from using tabs to spaces is what mixed me up. i.e. Jorgen is correct that mixing tabs and spaces to do indenting creates a maintenance mess. However, I bleieve he is incorrect in stating that changing default tab width will cause spaces to be used instead of a tab char. > > If we insist on everyone having the same width tab stops, then really, > we have lost the benefit of tab and can just use spaces. In fact, if you > are having problems because of inconsistent use of tabs/spaces maybe the > solution is to have emacs convert all spaces to tabs and only use spaces > when you hit the tab key or have emacs convert all leading spaces to > tabs so that you don't get the mixture. There is a downside in doing > this if you are in a team using version control if your VC isn't > configured correctly as the changes will be seen as changes in content > rather than just changes in whitespace styles. > Sheez, I'm not having a good day. To try and clarify. I believe it is possible to have emacs automatically convert leading spaces into tabs automatically and it is probably possible to have it convert back the other way when saving files. theoretically, it should be possible to set things up so that a mixture of indents using tabs and spaces is less of a pain. If you convert all instances of n space characters to a tab, you could have emacs largely deal with the pain of mixed indent styles for you. If others in your team insist on spaces instaed of tabs (which I think is a mistake!), you can have emacs translate all your tabs to spaces before saving. This could give you the best of both worlds. When editing the file, inent can be tab based and you can change the amount (size) of the indent by changing the default tab width. To avoid arguments with your colleagues, you can then automatically convert tabs back to spaces before saving and putting the file into version control. Hope that clarifies more than cnfuses! Tim -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-02-07 0:51 ` Tim X 2010-02-07 3:31 ` Tim X @ 2010-02-08 2:14 ` Stefan Monnier 1 sibling, 0 replies; 20+ messages in thread From: Stefan Monnier @ 2010-02-08 2:14 UTC (permalink / raw To: help-gnu-emacs > If everyone you had to work with used tabs, then it would be possible to > realise one of the great benefits of tabs. That is, we could all have > the amount of indent that we want, 2 spaces, 4, 8 10 whatever and it > wouldn't matter. That works for indentations such as if (foo) { blabla } where indentation is always relative to previous indentation plus or minus some fixed number of columns (typically "one tab"). But it doesn't in cases such as foofunc(arg1, arg2, arg3, arg4) where the indentation of the second line is aligned with a particular place in the code, so that if you use TABs for this part, it will only be properly indentated if you use the same TAB width as was used when the line was originally indented. Stefan ^ permalink raw reply [flat|nested] 20+ messages in thread
[parent not found: <mailman.443.1264798210.14305.help-gnu-emacs@gnu.org>]
* Re: change spaces indent in text mode? [not found] ` <mailman.443.1264798210.14305.help-gnu-emacs@gnu.org> @ 2010-01-30 2:39 ` Tim X 2010-01-30 21:59 ` Glauber Alex Dias Prado [not found] ` <mailman.477.1264888760.14305.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 20+ messages in thread From: Tim X @ 2010-01-30 2:39 UTC (permalink / raw To: help-gnu-emacs Brendan Miller <catphive@catphive.net> writes: > Great, thanks! > > The only problem I have, is that m-i seems to indent by 8 spaces. I > tried putting > > (setq tab-width 4) in my .emacs, but that doesn't seem to change > anything... is m-i controlled by a different variable? > > On Fri, Jan 29, 2010 at 11:39 AM, Teemu Likonen <tlikonen@iki.fi> wrote: >> * 2010-01-29 11:28 (-0800), Brendan Miller wrote: >> >>> When I hit tab in text mode, it indents by 5 spaces. How do I change >>> that? Setting tab-width doesn't seem to do the right thing. >> >> TAB key in text-mode indents to the columns of previous line's words. If >> you want to go to next tab stop, as defined in tab-stop-list variable, >> use M-i. For example, first write a line like this: >> >> Here are some words. >> >> Then press TAB key a couple of times on the next line. Then go to the >> beginning of line and press M-i a couple of times. You should see the >> difference. >> > > You missed the critical phrase in Teemu's response i.e. "you want to go to next tab stop, as defined in tab-stop-list variable," ,----[ C-h v tab-stop-list RET ] | tab-stop-list is a variable defined in `indent.el'. | Its value is | (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76) | | | This variable is safe as a file local variable if its value | satisfies the predicate `listp'. | | Documentation: | List of tab stop positions used by `tab-to-tab-stop'. | This should be a list of integers, ordered from smallest to largest. | | You can customize this variable. `---- The 'default' emacs version jumps by 8 spaces per tab stop. Tim -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-01-30 2:39 ` Tim X @ 2010-01-30 21:59 ` Glauber Alex Dias Prado [not found] ` <mailman.477.1264888760.14305.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 20+ messages in thread From: Glauber Alex Dias Prado @ 2010-01-30 21:59 UTC (permalink / raw To: Tim X; +Cc: help-gnu-emacs Tim X <timx@nospam.dev.null> writes: > Brendan Miller <catphive@catphive.net> writes: > >> Great, thanks! >> >> The only problem I have, is that m-i seems to indent by 8 spaces. I >> tried putting >> >> (setq tab-width 4) in my .emacs, but that doesn't seem to change >> anything... is m-i controlled by a different variable? >> >> On Fri, Jan 29, 2010 at 11:39 AM, Teemu Likonen <tlikonen@iki.fi> wrote: >>> * 2010-01-29 11:28 (-0800), Brendan Miller wrote: >>> >>>> When I hit tab in text mode, it indents by 5 spaces. How do I change >>>> that? Setting tab-width doesn't seem to do the right thing. >>> >>> TAB key in text-mode indents to the columns of previous line's words. If >>> you want to go to next tab stop, as defined in tab-stop-list variable, >>> use M-i. For example, first write a line like this: >>> >>> Here are some words. >>> >>> Then press TAB key a couple of times on the next line. Then go to the >>> beginning of line and press M-i a couple of times. You should see the >>> difference. >>> >> >> > > You missed the critical phrase in Teemu's response i.e. > > "you want to go to next tab stop, as defined in tab-stop-list variable," > > ,----[ C-h v tab-stop-list RET ] > | tab-stop-list is a variable defined in `indent.el'. > | Its value is > | (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76) > | > | > | This variable is safe as a file local variable if its value > | satisfies the predicate `listp'. > | > | Documentation: > | List of tab stop positions used by `tab-to-tab-stop'. > | This should be a list of integers, ordered from smallest to largest. > | > | You can customize this variable. > `---- Sorry not related to the original question but what do you use to have a box like that above when writing? > The 'default' emacs version jumps by 8 spaces per tab stop. > > Tim ^ permalink raw reply [flat|nested] 20+ messages in thread
[parent not found: <mailman.477.1264888760.14305.help-gnu-emacs@gnu.org>]
* Re: change spaces indent in text mode? [not found] ` <mailman.477.1264888760.14305.help-gnu-emacs@gnu.org> @ 2010-01-30 23:06 ` Tim X 0 siblings, 0 replies; 20+ messages in thread From: Tim X @ 2010-01-30 23:06 UTC (permalink / raw To: help-gnu-emacs Glauber Alex Dias Prado <smade4@gmail.com> writes: > Tim X <timx@nospam.dev.null> writes: > >> Brendan Miller <catphive@catphive.net> writes: >> >>> Great, thanks! >>> >> >> ,----[ C-h v tab-stop-list RET ] >> | tab-stop-list is a variable defined in `indent.el'. >> | Its value is >> | (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76) >> | >> | >> | This variable is safe as a file local variable if its value >> | satisfies the predicate `listp'. >> | >> | Documentation: >> | List of tab stop positions used by `tab-to-tab-stop'. >> | This should be a list of integers, ordered from smallest to largest. >> | >> | You can customize this variable. >> `---- > > Sorry not related to the original question but what do you use to have a > box like that above when writing? > Its from boxquote.el, which is in the emacs-goodies.el file (Debian/Ubuntu) and I think is on the emacs wiki. Tim > -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-01-29 19:39 ` Teemu Likonen 2010-01-29 20:50 ` Brendan Miller [not found] ` <mailman.443.1264798210.14305.help-gnu-emacs@gnu.org> @ 2010-01-31 2:05 ` Suvayu Ali [not found] ` <mailman.482.1264903543.14305.help-gnu-emacs@gnu.org> 3 siblings, 0 replies; 20+ messages in thread From: Suvayu Ali @ 2010-01-31 2:05 UTC (permalink / raw To: Teemu Likonen; +Cc: help-gnu-emacs Hi, On Friday 29 January 2010 11:39 AM, Teemu Likonen wrote: > * 2010-01-29 11:28 (-0800), Brendan Miller wrote: > >> When I hit tab in text mode, it indents by 5 spaces. How do I change >> that? Setting tab-width doesn't seem to do the right thing. > > TAB key in text-mode indents to the columns of previous line's words. If > you want to go to next tab stop, as defined in tab-stop-list variable, > use M-i. For example, first write a line like this: > > Here are some words. > > Then press TAB key a couple of times on the next line. Then go to the > beginning of line and press M-i a couple of times. You should see the > difference. Maybe this is a little off-topic, but is their anyway to have that behaviour of the TAB key with source code, say C++ or Python? I would like to align various similar consecutive lines to make them easy to read. Thanks for any suggestions. -- Suvayu Open source is the future. It sets us free. ^ permalink raw reply [flat|nested] 20+ messages in thread
[parent not found: <mailman.482.1264903543.14305.help-gnu-emacs@gnu.org>]
* Re: change spaces indent in text mode? [not found] ` <mailman.482.1264903543.14305.help-gnu-emacs@gnu.org> @ 2010-02-01 17:04 ` Stefan Monnier 2010-02-02 1:32 ` Suvayu Ali 2010-02-06 8:21 ` Jorgen Grahn 1 sibling, 1 reply; 20+ messages in thread From: Stefan Monnier @ 2010-02-01 17:04 UTC (permalink / raw To: help-gnu-emacs >> Here are some words. >> >> Then press TAB key a couple of times on the next line. Then go to the >> beginning of line and press M-i a couple of times. You should see the >> difference. > Maybe this is a little off-topic, but is their anyway to have that behaviour > of the TAB key with source code, say C++ or Python? You can make the TAB key do whatever you want, by rebinding it to some other command. The command that does the above is called `indent-relative'. Stefan ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-02-01 17:04 ` Stefan Monnier @ 2010-02-02 1:32 ` Suvayu Ali 0 siblings, 0 replies; 20+ messages in thread From: Suvayu Ali @ 2010-02-02 1:32 UTC (permalink / raw To: help-gnu-emacs On Monday 01 February 2010 09:04 AM, Stefan Monnier wrote: >>> Here are some words. >>> >>> Then press TAB key a couple of times on the next line. Then go to the >>> beginning of line and press M-i a couple of times. You should see the >>> difference. > >> Maybe this is a little off-topic, but is their anyway to have that behaviour >> of the TAB key with source code, say C++ or Python? > > You can make the TAB key do whatever you want, by rebinding it to some > other command. The command that does the above is called > `indent-relative'. Thanks a lot Stefan. I bound it to `S-<iso-lefttab>' works like a charm. :) > Stefan -- Suvayu Open source is the future. It sets us free. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? [not found] ` <mailman.482.1264903543.14305.help-gnu-emacs@gnu.org> 2010-02-01 17:04 ` Stefan Monnier @ 2010-02-06 8:21 ` Jorgen Grahn 2010-02-07 7:23 ` Suvayu Ali 1 sibling, 1 reply; 20+ messages in thread From: Jorgen Grahn @ 2010-02-06 8:21 UTC (permalink / raw To: help-gnu-emacs On Sun, 2010-01-31, Suvayu Ali wrote: > Hi, > > On Friday 29 January 2010 11:39 AM, Teemu Likonen wrote: >> * 2010-01-29 11:28 (-0800), Brendan Miller wrote: >> >>> When I hit tab in text mode, it indents by 5 spaces. How do I change >>> that? Setting tab-width doesn't seem to do the right thing. >> >> TAB key in text-mode indents to the columns of previous line's words. If >> you want to go to next tab stop, as defined in tab-stop-list variable, >> use M-i. For example, first write a line like this: >> >> Here are some words. >> >> Then press TAB key a couple of times on the next line. Then go to the >> beginning of line and press M-i a couple of times. You should see the >> difference. > > Maybe this is a little off-topic, but is their anyway to have that > behaviour of the TAB key with source code, say C++ or Python? I would > like to align various similar consecutive lines to make them easy to > read. Thanks for any suggestions. Do you have any examples where the default Emacs indentation for C++ and Python isn't readable enough? I'm asking because "align various similar consecutive lines" is one of the things those indentation modes do already. As a source code reader (and maintainer) I appreciate when the indentation I see follows one of the built-in styles (and indent-widths) so I can edit it without having to manually tweak my indentation to keep in style. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: change spaces indent in text mode? 2010-02-06 8:21 ` Jorgen Grahn @ 2010-02-07 7:23 ` Suvayu Ali 0 siblings, 0 replies; 20+ messages in thread From: Suvayu Ali @ 2010-02-07 7:23 UTC (permalink / raw To: help-gnu-emacs On Saturday 06 February 2010 12:21 AM, Jorgen Grahn wrote: > On Sun, 2010-01-31, Suvayu Ali wrote: >> Hi, >> >> On Friday 29 January 2010 11:39 AM, Teemu Likonen wrote: >>> * 2010-01-29 11:28 (-0800), Brendan Miller wrote: >>> >>>> When I hit tab in text mode, it indents by 5 spaces. How do I change >>>> that? Setting tab-width doesn't seem to do the right thing. >>> >>> TAB key in text-mode indents to the columns of previous line's words. If >>> you want to go to next tab stop, as defined in tab-stop-list variable, >>> use M-i. For example, first write a line like this: >>> >>> Here are some words. >>> >>> Then press TAB key a couple of times on the next line. Then go to the >>> beginning of line and press M-i a couple of times. You should see the >>> difference. >> >> Maybe this is a little off-topic, but is their anyway to have that >> behaviour of the TAB key with source code, say C++ or Python? I would >> like to align various similar consecutive lines to make them easy to >> read. Thanks for any suggestions. > > Do you have any examples where the default Emacs indentation for C++ > and Python isn't readable enough? I'm asking because "align various > similar consecutive lines" is one of the things those indentation > modes do already. I work with a data analysis framework based on C++ libraries dynamically loaded by various python scripts. It often has code like this, Python: > if rec.doCalo: > ## Import CaloCluster Tool > from DataQualityTools.DataQualityToolsConf import DQTCaloClusterTool > DQTCaloClusterTool = DQTCaloClusterTool(name = 'DQTCaloClusterTool', > histoPathBase = "/GLOBAL/DQTCaloCluster", > doRunCosmics = isCosmics, > doRunBeam = isBeam, > doOfflineHists = isOffline, > doOnlineHists = isOnline > ); > > ToolSvc += DQTCaloClusterTool; > ManagedAthenaGlobalMon.AthenaMonTools += [ DQTCaloClusterTool ]; or C++: > failure = failure | registerHist(fullPathMuons, m_trkeffvsLumi = new TProfile("m_trk_trkeffvsLumi", "Trk eff per Lumi block", 1000, 0, 1000, 0, 1)).isFailure(); > failure = failure | registerHist(fullPathMuons, m_fwdetatrkeffvsLumi = new TProfile("m_trk_fwdetatrkeffvsLumi", "Forward Eta eff per Lumi block", 1000, 0, 1000, 0, 1)).isFailure(); > failure = failure | registerHist(fullPathMuons, m_bkwdetatrkeffvsLumi = new TProfile("m_trk_bkwdetatrkeffvsLumi", "Backward Eta eff per Lumi block", 1000, 0, 1000, 0, 1)).isFailure(); As you can see, because of the long and wieldy names, aligning them with the previous line often helps improve the readability. > As a source code reader (and maintainer) I appreciate when the > indentation I see follows one of the built-in styles (and > indent-widths) so I can edit it without having to manually tweak my > indentation to keep in style. Would you do this some other way? Thanks for any suggestions, I appreciate it. > /Jorgen > -- Suvayu Open source is the future. It sets us free. ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2010-02-08 2:14 UTC | newest] Thread overview: 20+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-01-29 19:28 change spaces indent in text mode? Brendan Miller [not found] <mailman.440.1264793480.14305.help-gnu-emacs@gnu.org> 2010-01-29 19:39 ` Teemu Likonen 2010-01-29 20:50 ` Brendan Miller 2010-01-29 21:22 ` Tom Rauchenwald 2010-01-30 0:51 ` Brendan Miller 2010-01-30 1:56 ` Suvayu Ali 2010-01-29 21:30 ` Tyler Smith [not found] ` <mailman.444.1264800653.14305.help-gnu-emacs@gnu.org> 2010-02-01 17:07 ` Stefan Monnier [not found] ` <mailman.447.1264801240.14305.help-gnu-emacs@gnu.org> 2010-02-06 8:11 ` Jorgen Grahn 2010-02-07 0:51 ` Tim X 2010-02-07 3:31 ` Tim X 2010-02-08 2:14 ` Stefan Monnier [not found] ` <mailman.443.1264798210.14305.help-gnu-emacs@gnu.org> 2010-01-30 2:39 ` Tim X 2010-01-30 21:59 ` Glauber Alex Dias Prado [not found] ` <mailman.477.1264888760.14305.help-gnu-emacs@gnu.org> 2010-01-30 23:06 ` Tim X 2010-01-31 2:05 ` Suvayu Ali [not found] ` <mailman.482.1264903543.14305.help-gnu-emacs@gnu.org> 2010-02-01 17:04 ` Stefan Monnier 2010-02-02 1:32 ` Suvayu Ali 2010-02-06 8:21 ` Jorgen Grahn 2010-02-07 7:23 ` Suvayu Ali
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.