From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Break code lines fluently Date: Wed, 12 Mar 2014 07:25:07 -0700 (PDT) Message-ID: References: <87wqg0t1jz.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1394634340 20789 80.91.229.3 (12 Mar 2014 14:25:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Mar 2014 14:25:40 +0000 (UTC) To: Andrey Tykhonov , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 12 15:25:47 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WNk6M-000697-Ht for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Mar 2014 15:25:46 +0100 Original-Received: from localhost ([::1]:60990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNk6M-00053T-0A for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Mar 2014 10:25:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNk5w-00051z-7Z for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 10:25:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNk5n-0000pu-Li for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 10:25:20 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:29595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNk5n-0000pg-Em for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 10:25:11 -0400 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s2CEP8Cf008675 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 Mar 2014 14:25:09 GMT Original-Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s2CEP7ow015038 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 12 Mar 2014 14:25:08 GMT Original-Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2CEP7Ra010395; Wed, 12 Mar 2014 14:25:07 GMT In-Reply-To: <87wqg0t1jz.fsf@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96456 Archived-At: > (defun test () > (let ((test t)) > (if test > (message "True") > (mes|sage "False")))) > Point is located in the middle of "message" function. And I would like to > insert more code to the `let' form (after the `if'). Here is one approach: C-- 2 C-M-u RET C-M-u is `backward-up-list'. You give it a negative prefix arg to go forward instead of backward. -2 means go forward and up past (-1) the `message' sexp and then (-2) past the `if' sexp. RET then indents (with recent Emacs dev snapshots - use C-j with older versions). If you don't want to count, just repeat C-- C-M-u until you get where you want to go. You can also bind `up-list' to a key, and use that to do the same thing as C-M-u with a negative arg. E.g. M-x global-set-key C-o RET up-list RET C-o C-o RET ; move up & forward 2 list levels, then newline & indent The real advantage of binding a key to `up-list' is that you can just hold that key (C-o or whatever) down until you get where you want (the same as you can do with `backward-up-list', C-M-u). Prefix key `C-M-' introduces Lisp stuff in Emacs-Lisp mode, including commands that move over lists: e.g., C-M-u, C-M-d, C-M-n, C-M-p. And commands that move over sexps, whether lists or not: C-M-f, C-M-b. Others will no doubt give you other ways, in particular that make use of 3rd-party libraries. There are many ways to skin this cat. (If you use a mouse, you can of course also just click where you want to insert the newline: direct access. That's sometimes easier or quicker, since you can see the destination and you don't need to move there incrementally or by counting list levels. But it does take one hand off the keyboard.)