From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Break code lines fluently
Date: Wed, 12 Mar 2014 11:07:12 +0100 [thread overview]
Message-ID: <532031D0.6050309@easy-emacs.de> (raw)
In-Reply-To: <87wqg0t1jz.fsf@gmail.com>
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!
next prev parent reply other threads:[~2014-03-12 10:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-12 5:42 Break code lines fluently Andrey Tykhonov
2014-03-12 10:07 ` Andreas Röhler [this message]
2014-03-12 14:25 ` Drew Adams
2014-03-12 15:55 ` Drew Adams
2014-03-13 0:14 ` Andrey Tykhonov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=532031D0.6050309@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.