all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: change spaces indent in text mode?
Date: Sat, 06 Feb 2010 23:23:09 -0800	[thread overview]
Message-ID: <4B6E6A5D.9060006@gmail.com> (raw)
In-Reply-To: <slrnhmq9kp.1qf.grahn+nntp@frailea.sa.invalid>

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	other threads:[~2010-02-07  7:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.440.1264793480.14305.help-gnu-emacs@gnu.org>
2010-01-29 19:39 ` change spaces indent in text mode? 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 [this message]
2010-01-29 19:28 Brendan Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B6E6A5D.9060006@gmail.com \
    --to=fatkasuvayu+linux@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.