From: "Matthias Wächter" Date: 2012-04-28T19:09:13+09:00 Subject: Re: Global variable for spaces per tab? Am 28.04.2012 05:37, schrieb Intransition: > > > On Friday, April 27, 2012 5:01:37 PM UTC-4, Eric Christopherson wrote: > > On Apr 27, 2012 3:29 PM, "Aaron Patterson" > wrote: > > > > On Sat, Apr 28, 2012 at 05:22:47AM +0900, Ryan Davis wrote: > > > > > > On Apr 27, 2012, at 11:51 , Intransition wrote: > > > > > > > Is there any global variable in Ruby for specifying how tabs > ("\t") should be translated into spaces? > > Intransition: the amount of space shown by a tab is totally > dependent on the terminal used to display the text, and (unlike some > terminal parameters) there is no way for Ruby or any language to > change it. I guess the best thing you could do would be to implement > a writer stream that converted tabs to spaces. > > > I guess I worded that poorly. I was just wondering if there is some > setting to be read --not change. I'm not even sure ... is there such a > setting in shell/bash? > > My use case is string unindention. Say I have a string with each line is > prefixed with two "\t" characters and I want to unindent it by upto 2 > spaces. Then I need to translate the tabs to spaces. The unindent method > can have an option for it, but I was wondering if there is some system > setting I can look at for deciding a default. Sure you’re not writing a Python parser, eh? ;) – Matthias