From: Marcelo de Moraes Serpa <celoserpa@gmail.com>
To: Deniz Dogan <deniz.a.m.dogan@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Textmate like code block alignment (ruby-mode)
Date: Tue, 6 Jul 2010 12:05:36 -0500 [thread overview]
Message-ID: <AANLkTikWvGJuMJK0pOkMWMzRZf74SZxH_1AA0_8cDzrd@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimmh3Hm2YiaworqaQf1eHWDVk4H9TgewIpVUsbI@mail.gmail.com>
Hi Deniz,
Thanks for being so helpful ;)
Well, my config has snippets attached to TAB too, so if I hit TAB, it
will try to complete "end". I'm using a fork of emacs-starter-kit,
and, although I have modified it a lot already, I didn't have the time
to peek into it the way I wanted so as to understand how things are
wired up, I'll need to to that eventually.
Anyway, thanks for the suggestion. Using C-j already had this
behaviour built-in btw,
Marcelo.
On Tue, Jul 6, 2010 at 12:01 PM, Deniz Dogan <deniz.a.m.dogan@gmail.com> wrote:
> 2010/7/6 Marcelo de Moraes Serpa <celoserpa@gmail.com>:
>> Hey list,
>>
>> I have ruby-mode setup and it works pretty well. One thing though is
>> that it doesn't automatically align blocks, and I have to type C-a TAB
>> to make it align the end with a def for example:
>>
>> def func <when I press ENTER here>
>> |<the pointer goes here>
>>
>> I'd like it to behave like Textmate, where when you press enter after
>> the beginning of a code block, it automatically aligns the end to like
>> so:
>>
>> def func <when I press ENTER here>
>> |<the cursor goes here, where it should be>
>>
>> It's really annoying having to align manually.
>>
>> Any ideas?
>>
>> Thanks in advance,
>>
>> Marcelo.
>>
>>
>
> You could try binding RET to newline-and-indent (bound to C-j by default).
>
> Try something like this (untested):
>
> (add-hook 'ruby-mode-hook
> (lambda ()
> (define-key ruby-mode-map (kbd "RET") 'newline-and-indent)))
>
> By the way, you normally don't have to move the cursor anywhere to
> indent the current line. Just hit TAB with the cursor anywhere on the
> line you wish to indent "correctly" and it will work just as well.
>
> --
> Deniz Dogan
>
next prev parent reply other threads:[~2010-07-06 17:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-06 16:51 Textmate like code block alignment (ruby-mode) Marcelo de Moraes Serpa
2010-07-06 17:01 ` Deniz Dogan
2010-07-06 17:05 ` Marcelo de Moraes Serpa [this message]
2010-07-06 23:27 ` Lennart Borgman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTikWvGJuMJK0pOkMWMzRZf74SZxH_1AA0_8cDzrd@mail.gmail.com \
--to=celoserpa@gmail.com \
--cc=deniz.a.m.dogan@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.
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).