From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: Break code lines fluently Date: Wed, 12 Mar 2014 11:07:12 +0100 Message-ID: <532031D0.6050309@easy-emacs.de> References: <87wqg0t1jz.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1394618585 13862 80.91.229.3 (12 Mar 2014 10:03:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Mar 2014 10:03:05 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 12 11:03:15 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 1WNg0J-0001gM-HH for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Mar 2014 11:03:15 +0100 Original-Received: from localhost ([::1]:59615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNg0J-0007SN-5G for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Mar 2014 06:03:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNg04-0007SG-74 for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 06:03:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNfzz-00035J-6j for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 06:03:00 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.130]:62782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNfzy-000353-S0 for help-gnu-emacs@gnu.org; Wed, 12 Mar 2014 06:02:55 -0400 Original-Received: from purzel.sitgens (brln-4d0c2707.pool.mediaWays.net [77.12.39.7]) by mrelayeu.kundenserver.de (node=mreue006) with ESMTP (Nemesis) id 0MMtZ5-1WWCRx1rcV-008b0L; Wed, 12 Mar 2014 11:02:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <87wqg0t1jz.fsf@gmail.com> X-Provags-ID: V02:K0:15w19vSQwR3ylVrkta+VLNE1mLHMuxuNWsfGH5EqaFW u4qVD0ga6PuQsRreyjhRybx4YNi3TfvMG0YPA9g9IhMfnl8m+Y DpwtNxgy5ecblP1bCrAG7Xa3/God6+wIuzwcRva6pQaDd+O39d a6bXB4Zqun9mig0bl4OLpafRfMMoThJ178ldSNWTSmS6g6E3yj ajQ1QazyfMW47GxX3PTHnUyZo34/bA+bqNS9A+0Hyt6V9I2zv1 BZAuQzWjlP4RCKhXm6i3KdXeHdEQMzDz+OMAPtf6wEbHnJTiem o9y7rCuQW7BbKzXqSAUbTfOlmZEnP7lRyfBPH7BTOuYKKMJtmk Zi3HCBDDPWGmDhSusjLmPxfrJDgBPlEA/2/rJXBAy X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.126.130 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:96452 Archived-At: Am 12.03.2014 06:42, schrieb Andrey Tykhonov: > > Hi all! > > When I've used Eclipse I liked its default key binding "Shift-Enter" which > inserts an empty line (with indentation) after the current line. It is very > easy to implement such function in Emacs, please read, if you're > interested: http://emacsredux.com/blog/2013/03/26/smarter-open-line/ . > > I used to use this function. It is, as for me, quite handy while browsing > the code to hit "Shift-Enter" and just insert some piece of code. But what > I really were missing is having the same line opening command but for > elisp. It would be better explain by means of example. Let say I have the > following code: > > (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'). What I was always > doing in such situations, I did always navigate to the appropriate closing > bracket (in this case closing bracket of the `if') and hit Enter. (Yes, > probably there are more better ways to do that. Please share. It is very > interesting to know). Despite the fact that I quite often investigate emacs > configurations of others, wiki, documentation and packages only today I > found the solution to have possibility to break the lines more fluently. So > having such mentioned code I can execute sequentially the command several > times and have the following code to be ready to be extended in the right > place: > > (defun test () > (let ((test t)) > (if test > (message "True") > (message "False")) > |)) > > (First execution of this command breaks a line for "message", the second > execution undos this change, the third execution will break a line for > `if', the fourth undos and fifth will break a line for `let'). > > The command which I just mentioned is the `smart-return' command from the > `emacs-smart-return' tiny package which I just recently wrote and which you > could find at https://github.com/atykhonov/emacs-smart-return It is a very > thin wrapper around `smart-forward' package (Read: > https://github.com/magnars/smart-forward.el). This is just very initial > version. Thus any comments, suggestions are highly appreciated. > > > With hope that mentioned functionality will be helpful and useful, > Andrey. > > > Thanks! > > Very interesting, thanks!