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

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

Re: change spaces indent in text mode?


From: Suvayu Ali
Subject: Re: change spaces indent in text mode?
Date: Sat, 06 Feb 2010 23:23:09 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc11 Lightning/1.0b2pre Thunderbird/3.0.1

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.




reply via email to

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