* Plain text indentation problem
@ 2008-01-14 5:17 mccormick.bob
2008-01-14 16:46 ` oliver.g.charles
0 siblings, 1 reply; 3+ messages in thread
From: mccormick.bob @ 2008-01-14 5:17 UTC (permalink / raw)
To: help-gnu-emacs
I'm having an odd problem with auto-indentation in Emacs in text-mode
that I'm hoping someone here can help me with. I'm trying to edit a
file whose format needs to be similar to this:
--------------------------------------
Story: simple addition
Scenario: add one plus one
Given an addend of 1
And an addend of 1
When the addends are added
Then the sum should be 2
Scenario: add two plus five
Given an addend of 2
And an addend of 5
------------------------------------------------
The problem is, when I get to the second "Scenario" line that needs to
be indented less than the line before it. Emacs automatically indents
it the same as the previous line (which I'd expect), but what's the
best way to get the line back to the same indentation as the previous
line? I've been doing M-b's until I get to the beginning of the first
word ("Scenario"), then backspacing. The problem is if I backspace
back to the beginning of the line, then hit tab again, emacs indents
the line in one space more than the first "Scenario" line. In other
words, it looks kind of like this:
----------------------------
Scenario: add one plus one
Given an addend of 1
Scenario: add two plus five
Given an addend of 2
----------------------------------
Any ideas what I'm doing wrong? Is there an easier way to move a line
back one TAB width?
(BTW.. For anyone whose interested, the file format in question is for
the Ruby Rspec Story Runner tool)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Plain text indentation problem
2008-01-14 5:17 Plain text indentation problem mccormick.bob
@ 2008-01-14 16:46 ` oliver.g.charles
2008-01-14 22:51 ` mccormick.bob
0 siblings, 1 reply; 3+ messages in thread
From: oliver.g.charles @ 2008-01-14 16:46 UTC (permalink / raw)
To: help-gnu-emacs
> The problem is, when I get to the second "Scenario" line that needs to
> be indented less than the line before it. Emacs automatically indents
> it the same as the previous line (which I'd expect), but what's the
> best way to get the line back to the same indentation as the previous
> line? I've been doing M-b's until I get to the beginning of the first
> word ("Scenario"), then backspacing. The problem is if I backspace
> back to the beginning of the line, then hit tab again, emacs indents
> the line in one space more than the first "Scenario" line. In other
> words, it looks kind of like this:
>
> ** SNIP **
>
> Any ideas what I'm doing wrong? Is there an easier way to move a line
> back one TAB width?
>
> (BTW.. For anyone whose interested, the file format in question is for
> the Ruby Rspec Story Runner tool)
Well, the simple answer I can think of would be to write your own lisp
function (or a keyboard macro) that would do the equivlient of C-a, C-
f, <DEL>, C-e. Alternativly, you could store the location of the point
and then jump back to that instead of the end of the line.
However, I think a much more elegant and useful solution would be to
write your own major mode for ruby rspec stories. More information on
doing this can be found at [1], you are most likely most interested in
[2].
Hope this helps :)
[1]: http://two-wugs.net/emacs/mode-tutorial.html
[2]: http://two-wugs.net/emacs/mode-tutorial.html#indent
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Plain text indentation problem
2008-01-14 16:46 ` oliver.g.charles
@ 2008-01-14 22:51 ` mccormick.bob
0 siblings, 0 replies; 3+ messages in thread
From: mccormick.bob @ 2008-01-14 22:51 UTC (permalink / raw)
To: help-gnu-emacs
On Jan 14, 9:46 am, "oliver.g.char...@googlemail.com"
<oliver.g.char...@googlemail.com> wrote:
> > The problem is, when I get to the second "Scenario" line that needs to
> > be indented less than the line before it. Emacs automatically indents
> > it the same as the previous line (which I'd expect), but what's the
> > best way to get the line back to the same indentation as the previous
> > line? I've been doing M-b's until I get to the beginning of the first
> > word ("Scenario"), then backspacing. The problem is if I backspace
> > back to the beginning of the line, then hit tab again, emacs indents
> > the line in one space more than the first "Scenario" line. In other
> > words, it looks kind of like this:
>
> > ** SNIP **
>
> > Any ideas what I'm doing wrong? Is there an easier way to move a line
> > back one TAB width?
>
> > (BTW.. For anyone whose interested, the file format in question is for
> > the Ruby Rspec Story Runner tool)
>
> Well, the simple answer I can think of would be to write your own lisp
> function (or a keyboard macro) that would do the equivlient of C-a, C-
> f, <DEL>, C-e. Alternativly, you could store the location of the point
> and then jump back to that instead of the end of the line.
>
> However, I think a much more elegant and useful solution would be to
> write your own major mode for ruby rspec stories. More information on
> doing this can be found at [1], you are most likely most interested in
> [2].
>
> Hope this helps :)
>
> [1]:http://two-wugs.net/emacs/mode-tutorial.html
> [2]:http://two-wugs.net/emacs/mode-tutorial.html#indent
Honestly I'm still undecided whether I like rspec stories or not. I
agree it could be fun to write a major mode for rspec stories, but
only if I do decide to continue using rspec.
But really I was primarily posting because I confused about the odd
indentation behavior in text mode. I still can't figure out why that
would *be* the behavior. :-(
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-14 22:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-14 5:17 Plain text indentation problem mccormick.bob
2008-01-14 16:46 ` oliver.g.charles
2008-01-14 22:51 ` mccormick.bob
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).