<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Elisp on /usr</title><link>https://slashusr.anupamsg.me/categories/elisp/</link><description>Recent content in Elisp on /usr</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sun, 30 Jun 2013 00:00:00 +0000</lastBuildDate><atom:link href="https://slashusr.anupamsg.me/categories/elisp/index.xml" rel="self" type="application/rss+xml"/><item><title>Copying the previous line to current position in Emacs</title><link>https://slashusr.anupamsg.me/2013/06/30/copying-the-previous-line-to-current-position-in-emacs/</link><pubDate>Sun, 30 Jun 2013 00:00:00 +0000</pubDate><guid>https://slashusr.anupamsg.me/2013/06/30/copying-the-previous-line-to-current-position-in-emacs/</guid><description>&lt;p&gt;Recently, I came across a scenario where I had to quickly copy the previous line in an Emacs buffer to the current position. The usual method for doing this has been to invoke:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;C-p C-a C-k C-y RET C-y&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Which basically does the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;Moves&lt;/em&gt; to the previous line (&lt;code&gt;C-p&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Moves&lt;/em&gt; to the beginning of the previous line (&lt;code&gt;C-a&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Kills&lt;/em&gt; the line (i.e., cuts the line with &lt;code&gt;C-k&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Yanks&lt;/em&gt; the line back (i.e., restores the original line with &lt;code&gt;C-y&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Creates&lt;/em&gt; a newline (&lt;code&gt;RET&lt;/code&gt;), and&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Yanks&lt;/em&gt; another copy of the line with the final &lt;code&gt;C-y&lt;/code&gt; (which is what we wanted in the first place)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;While this &lt;em&gt;works&lt;/em&gt;, it is certainly not the most optimal mechanism to perform such a simple (albeit infrequent) operation.&lt;/p&gt;</description></item></channel></rss>