From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcelo de Moraes Serpa Newsgroups: gmane.emacs.help Subject: Re: Textmate like code block alignment (ruby-mode) Date: Tue, 6 Jul 2010 12:05:36 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1278435996 923 80.91.229.12 (6 Jul 2010 17:06:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Jul 2010 17:06:36 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Deniz Dogan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 06 19:06:33 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OWBbG-0003G8-Jc for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Jul 2010 19:06:26 +0200 Original-Received: from localhost ([127.0.0.1]:41540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWBbF-0007z1-U6 for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Jul 2010 13:06:25 -0400 Original-Received: from [140.186.70.92] (port=56439 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWBaZ-0007xt-1C for help-gnu-emacs@gnu.org; Tue, 06 Jul 2010 13:05:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWBaW-00072U-Er for help-gnu-emacs@gnu.org; Tue, 06 Jul 2010 13:05:42 -0400 Original-Received: from mail-pw0-f41.google.com ([209.85.160.41]:46224) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWBaW-00072H-8L for help-gnu-emacs@gnu.org; Tue, 06 Jul 2010 13:05:40 -0400 Original-Received: by pwi8 with SMTP id 8so1225781pwi.0 for ; Tue, 06 Jul 2010 10:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=CjjN9frJC1P/QWm2mFD7vE80VCWw0XAkSbxnx6t3XJM=; b=he/fpO7uidfqfsyKJEwMWingLHS520bNpaA/Yug6D0Zq5FsbQWBjrXAG572Hr7X2NC uwMlZk1KpksTnVaPZzGOk8M1IPxVZYR0ugLlaX/aOvSPm0RhEHt9w9pz0KE1SF/J56si yObil0ULXcc/99GlU7JgoTUw+Wd0PxH7gu1uI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Ry7foDodLSy7ACy0u5YyF1O4bSZVTLsaCpK0NDgvfMyzhzaRfZB01WMa/pQXAO7ynm 9enu1fkeskolToU7rcZuO3TNJzPMEcYoPP2MY9WgeTaAqPDqfuzvgXljgcPJ+2ubjged Mkr+ZB+YZwu9Icf9+eymmeYWDa//7Os3QZdk0= Original-Received: by 10.142.157.6 with SMTP id f6mr5881691wfe.271.1278435936793; Tue, 06 Jul 2010 10:05:36 -0700 (PDT) Original-Received: by 10.143.156.2 with HTTP; Tue, 6 Jul 2010 10:05:36 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:74108 Archived-At: 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 wr= ote: > 2010/7/6 Marcelo de Moraes Serpa : >> 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 >> =A0 =A0 =A0| >> >> 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 >> | >> >> 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 > =A0(lambda () > =A0 =A0(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 >