<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Nachopp&#039;s Blog &#187; emacs</title>
	<atom:link href="http://ignaciopp.wordpress.com/tag/emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://ignaciopp.wordpress.com</link>
	<description>notes and tidbits about emacs, gnu tools, web programming, and sysadmin related stuff</description>
	<lastBuildDate>Mon, 11 Mar 2013 14:22:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ignaciopp.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Nachopp&#039;s Blog &#187; emacs</title>
		<link>http://ignaciopp.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ignaciopp.wordpress.com/osd.xml" title="Nachopp&#039;s Blog" />
	<atom:link rel='hub' href='http://ignaciopp.wordpress.com/?pushpress=hub'/>
		<item>
		<title>emacs, how to highlight what you just pasted</title>
		<link>http://ignaciopp.wordpress.com/2012/06/04/emacs-how-to-highlight-what-you-just-pasted/</link>
		<comments>http://ignaciopp.wordpress.com/2012/06/04/emacs-how-to-highlight-what-you-just-pasted/#comments</comments>
		<pubDate>Tue, 05 Jun 2012 02:24:42 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[cut]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[paste]]></category>
		<category><![CDATA[text-editing]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=926</guid>
		<description><![CDATA[This is a way to select whatever text we had just inserted inside a buffer. I forgotten this trick until now that used it again. A small tip worth annotating that might come in handy for somebody else as well: 1) yank(paste) the text &#8220;C-y&#8221; 2) mark the point where the cursor landed, (using point-to-register), [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=926&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is a way to select whatever text we had just inserted inside a buffer. I forgotten this trick until now that used it again. A small tip worth annotating that might come in handy for somebody else as well:<br />
1) yank(paste) the text <strong>&#8220;C-y&#8221;</strong><br />
2) mark the point where the cursor landed, (using point-to-register), do <strong>&#8220;C-x r SPC&#8221;</strong> and pick any letter ( a-z)<br />
3) go back to the point where you initially were, by doing <strong>&#8220;C-u SPC&#8221;</strong><br />
4) set the mark there,<strong>&#8220;C-SPC&#8221;</strong><br />
5) use <strong>&#8220;C-x r j&#8221;</strong> (+ the letter picked) to go up the point where the yanked text ends inside your buffer.<br />
6) Voila, the text yanked is highlighted ready for whatever manipulation you need to do onto it.</p>
<p>ps: Of course in case you pasted text at the end of the buffer is simpler,<br />
just a matter of:<br />
<strong>&#8220;C-u SPC&#8221;</strong><br />
<strong>&#8220;C-SPC&#8221;</strong> to mark<br />
<strong>&#8220;M &#8211; &gt;&#8221;</strong> to go to the end</p>
<p><strong>UPDATE</strong>: Actually, thanks to Peter (see comment below) I learned that this is possible just doing &#8220;<strong>C-x C-x after the yank if you have transient mark mode enabled</strong>&#8221; .</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/926/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/926/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=926&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2012/06/04/emacs-how-to-highlight-what-you-just-pasted/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>(lame) use of macro to shortcut the org-cycle function to reveal-all</title>
		<link>http://ignaciopp.wordpress.com/2012/05/25/lame-use-of-macro-to-shortcut-the-org-cycle-function-to-reveal-all/</link>
		<comments>http://ignaciopp.wordpress.com/2012/05/25/lame-use-of-macro-to-shortcut-the-org-cycle-function-to-reveal-all/#comments</comments>
		<pubDate>Fri, 25 May 2012 16:07:42 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[elisp]]></category>
		<category><![CDATA[org-mode]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=919</guid>
		<description><![CDATA[A probably ridiculous thing to do, I know, but in hope of getting valuable help for you elisp expert guys out there (I&#8217;m all ears) I&#8217;m going ahead to show the unusual path I followed to simply bind the org-cicle invoked with an argument 64 (C-u C-u C-u) (This is also a litle probe of [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=919&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A probably ridiculous thing to do, I know, but in hope of getting valuable help for you elisp expert guys out there (I&#8217;m all ears)  I&#8217;m going  ahead to show the unusual path I followed to simply bind the org-cicle invoked with an argument 64 (C-u C-u C-u)</p>
<p>(This is also a litle probe of how magnanimously flexible the emacs lisp environment can actually be to allow us to record processes we want automated for later reuse)<br />
Anyway:<br />
 1) I started to record the macro &#8220;<strong>C-(</strong>&#8220;<br />
 2) made the call to org-cycle to reveal-all by previously pressing C-u three times &#8220;<strong>C-u C-u C-u M-x org-cycle</strong>&#8220;<br />
 3) stopped recording macro &#8220;<strong>C-)</strong>&#8220;<br />
 4) did &#8220;<strong>M-x kmacro-name-last-macro</strong>&#8221;  (which provides the lambda form of the last created macro)<br />
 5) ran &#8220;<strong>M-x insert-kbd-macro</strong>&#8220;<br />
 6) assigned a key binding to it <strong>(global-set-key(kbd &#8220;C-+&#8221;) &#8216;my-org-reveal-all)</strong></p>
<p><code><br />
(fset 'my-org-reveal-all<br />
   (lambda (&amp;optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([21 21 21 134217816 111 114 103 45 99 121 99 108 101 return] 0 "%d")) arg)))<br />
</code><br />
(global-set-key(kbd &#8220;C-+&#8221;) &#8216;my-org-reveal-all)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/919/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=919&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2012/05/25/lame-use-of-macro-to-shortcut-the-org-cycle-function-to-reveal-all/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>how to undefine a key binding in emacs</title>
		<link>http://ignaciopp.wordpress.com/2012/05/19/how-to-undefine-a-key-binding-in-emacs/</link>
		<comments>http://ignaciopp.wordpress.com/2012/05/19/how-to-undefine-a-key-binding-in-emacs/#comments</comments>
		<pubDate>Sun, 20 May 2012 02:56:14 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[dot-emacs]]></category>
		<category><![CDATA[elisp]]></category>
		<category><![CDATA[text-editing]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=889</guid>
		<description><![CDATA[I just wanted to free a shortcut I had for &#8220;C-1&#8243; to let it behave the way it was meant with the command &#8220;digit-arguments&#8221;. This answer http://stackoverflow.com/questions/7549259/is-there-a-quick-way-to-unbind-keys-in-emacs came in handy. (global-unset-key (kbd &#8220;C-1&#8243;)) (define-key global-map (kbd &#8220;C-1&#8243;) &#8216;digit-argument) By the way (a little tip) you can go: C-&#60;digit ARG) instead of the C-u method; say [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=889&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I just wanted to free a shortcut I had for &#8220;C-1&#8243;  to let it behave the way it was meant with the command &#8220;digit-arguments&#8221;. This answer <a href="http://stackoverflow.com/questions/7549259/is-there-a-quick-way-to-unbind-keys-in-emacs">http://stackoverflow.com/questions/7549259/is-there-a-quick-way-to-unbind-keys-in-emacs</a> came in handy.</p>
<p>(global-unset-key (kbd &#8220;C-1&#8243;))<br />
(define-key global-map (kbd &#8220;C-1&#8243;) &#8216;digit-argument)</p>
<p>By the way (a  little tip) you can go: C-&lt;digit ARG) instead of the C-u  method; say to move 11 characters back,  &#8220;C-11 C-b&#8221; is quicker than &#8220;C-u 11 C-b&#8221;, one less hit! </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/889/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/889/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=889&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2012/05/19/how-to-undefine-a-key-binding-in-emacs/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>disable &#8220;Alt+`&#8221; hotkeys in Ubuntu 11.10</title>
		<link>http://ignaciopp.wordpress.com/2012/05/19/disable-alt-hotkeys-in-ubuntu-11-10/</link>
		<comments>http://ignaciopp.wordpress.com/2012/05/19/disable-alt-hotkeys-in-ubuntu-11-10/#comments</comments>
		<pubDate>Sat, 19 May 2012 11:59:23 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[tips&tricks]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=853</guid>
		<description><![CDATA[I finally got it on how to alter the combination of ALT + (backtick&#124;tilde) keys (the backtick is the one above the tab key), which Ubuntu Oniric Ocelot (11.10) assigned to a new functionality for flipping through windows in the switcher. This system shortcut could surely come as a nasty surprise when you upgrade from [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=853&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I finally got it on how to alter the combination of <strong>ALT + (backtick|tilde)</strong> keys (the backtick is the one above the tab key), which Ubuntu Oniric Ocelot (11.10) assigned to a new functionality for flipping through windows in the switcher. This system shortcut could surely come as a nasty surprise when you upgrade from version 10.xx, turning unusable whatever command you might had bond in your applications. My emacs setup specially does make a lot of use of these two keys, so I wanted to thank the guy and record his solution <a href="http://ubuntuforums.org/showthread.php?t=1863115">found as a response buried in this support thread</a><br />
Simply all it takes for disabling the default hotkeys is to:<br />
1) get the CompizConfig Setting Manager<br />
<code>"sudo apt-get install config-editor"</code> (it does not come included in Ubuntu Ocelot 11.10)<br />
2) bring it up, (typing &#8220;CCSM&#8221; in your terminal)<br />
3) look under Desktop -&gt; Ubuntu Unity Plugin -&gt; Switcher<br />
<a href="http://ignaciopp.files.wordpress.com/2012/05/screenshot-at-2012-05-18-195412.png"><img class="aligncenter size-medium wp-image-854" title="CompizConfig Setting Manager" src="http://ignaciopp.files.wordpress.com/2012/05/screenshot-at-2012-05-18-195412.png?w=300&#038;h=168" alt="resetting ALT+`" width="300" height="168" /></a><br />
4) pick the last two shown there, and create a key combination for them (which very non-intuitively appear listed as &#8220;disabled&#8221;). The functions in question are:<br />
:: key to flip through windows in the switcher<br />
:: key to flip through windows in the switcher backwards<br />
(note how in this case I had already set them to C-Alt 7 and C-Alt 8)</p>
<p>Yeah, it&#8217;s over babe, we&#8217;re back in business!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/853/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/853/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=853&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2012/05/19/disable-alt-hotkeys-in-ubuntu-11-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>

		<media:content url="http://ignaciopp.files.wordpress.com/2012/05/screenshot-at-2012-05-18-195412.png?w=300" medium="image">
			<media:title type="html">CompizConfig Setting Manager</media:title>
		</media:content>
	</item>
		<item>
		<title>Control-q (quoted-insert) for typing special characters in emacs</title>
		<link>http://ignaciopp.wordpress.com/2012/03/26/control-q-quoted-insert-for-typing-special-characters-in-emacs/</link>
		<comments>http://ignaciopp.wordpress.com/2012/03/26/control-q-quoted-insert-for-typing-special-characters-in-emacs/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 06:15:00 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[text-editing]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=828</guid>
		<description><![CDATA[When in need to enter special character inside emacs you can quote it with &#8220;C-q&#8221; and enter the octal character code, so for instance to type &#8220;ñ&#8221; you will do: &#8220;C-q 361&#8221; I found a thorough description of iso-latin-1 on the web, plus a great deal of general info on character and encodings available there [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=828&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>When in need to enter special character inside emacs you can quote it with &#8220;<strong>C-q</strong>&#8221; and enter the octal character code, so for instance to type &#8220;<strong>ñ</strong>&#8221; you will do: <strong>&#8220;C-q 361</strong>&#8221;  </p>
<p>I found a thorough description of <a href="http://www.cs.tut.fi/~jkorpela/latin1/all.html" title="iso-latin-1">iso-latin-1 </a> on the web, plus a great deal of general info on character and encodings available there as well <a href="http://www.cs.tut.fi/~jkorpela/chars/index.html" title="http://www.cs.tut.fi/~jkorpela/chars/index.html">http://www.cs.tut.fi/~jkorpela/chars/index.html</a></p>
<p>Within emacs it&#8217;s easy to pull any charset-table by doing &#8220;<strong>M-x list-charset-chars</strong>&#8220;, say if we type latin-iso8859-1 at the prompt the program shows: </p>
<p><a href="http://ignaciopp.files.wordpress.com/2012/03/latin-iso8859-1.gif"><img src="http://ignaciopp.files.wordpress.com/2012/03/latin-iso8859-1.gif?w=300&#038;h=91" alt="character set" title="latin-iso8859-1" width="300" height="91" class="alignnone size-medium wp-image-829" /></a></p>
<p>Then, for specifics about any character, simply  highlight it and do <strong>&#8220;M-x describe-char</strong>&#8221; to get a full detailed view like:</p>
<p>        character: ñ (241, #o361, #xf1)<br />
preferred charset: latin-iso8859-1<br />
									 (Right-Hand Part of ISO/IEC 8859/1 (Latin-1): ISO-IR-100)<br />
       code point: 0&#215;71<br />
           syntax: w 	which means: word<br />
         category: .:Base, j:Japanese, l:Latin<br />
      buffer code: #xC3 #xB1<br />
        file code: #xF1 (encoded by coding system iso-latin-1-unix)<br />
          display: by this font (glyph code)<br />
    uniscribe:-outline-Bitstream Vera Sans Mono-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1 (#x78)</p>
<p>Character code properties: customize what to show<br />
  name: LATIN SMALL LETTER N WITH TILDE<br />
  old-name: LATIN SMALL LETTER N TILDE<br />
  general-category: Ll (Letter, Lowercase)<br />
  decomposition: (110 771) (&#8216;n&#8217; &#8216;̃&#8217;)</p>
<p>There are text properties here:<br />
  charset              latin-iso8859-1</p>
<p>Awesome power!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/828/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/828/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=828&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2012/03/26/control-q-quoted-insert-for-typing-special-characters-in-emacs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>

		<media:content url="http://ignaciopp.files.wordpress.com/2012/03/latin-iso8859-1.gif?w=300" medium="image">
			<media:title type="html">latin-iso8859-1</media:title>
		</media:content>
	</item>
		<item>
		<title>emacs, taming return and tab keys in shell mode</title>
		<link>http://ignaciopp.wordpress.com/2012/02/14/emacs-taming-return-and-tab-keys-in-shell-mode/</link>
		<comments>http://ignaciopp.wordpress.com/2012/02/14/emacs-taming-return-and-tab-keys-in-shell-mode/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 15:57:01 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[indentation]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sys-admin]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=775</guid>
		<description><![CDATA[Writing heredocs in the shell from emacs presented to me a little nuisance: since the RETurn key is bound to &#8216;comint-send-input -a function that sends the text to the shell process- I coudn&#8217;t re-edit the previous line after having pressed it to insert a simple line break. (I should add that this is actually the [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=775&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Writing heredocs in the shell from emacs presented to me a little nuisance: since the RETurn key is bound to &#8216;<em><strong>comint-send-input</strong></em> -a function that sends the text to the shell process- I coudn&#8217;t re-edit the previous line after having pressed it to insert a simple line break. (I should add that this is actually the usual unix bash behaviour, I only happen to use bash from emacs and so wanted to overcome the problem there)</p>
<p>Yesterday it dawned on me to just use &#8220;<strong>C-q C-j</strong>&#8221; under that situation, (that&#8217;s how you stick in a line feed in emacs regardless of the mode you are in). </p>
<p>Given that the perspective of typing &#8220;<strong>C-q C-j</strong>&#8221; several times looked rather awkward I thought of binding <strong>RET </strong>with the <strong>control </strong>key for that:</p>
<pre style="color:#ffffff;background-color:#124368;font-size:8pt;margin-bottom:12px!important;">
<span style="background-color:#4f94cd;">(</span>global-set-key (quote [(control return)]) (quote newline)<span style="background-color:#4f94cd;">)</span></pre>
<p>But then, the idea of going the other way around showed more appealing: why not to make newlines with a simple <strong>RET</strong>, and use the <strong>Control </strong>key to send the input?  Besides, it makes sense to prevent hitting return by accident, I hate when my pinky lands there when searching the pipe &#8220;|&#8221; key.</p>
<p>While at it I decided to also rebind the <a href="http://ignaciopp.wordpress.com/2009/06/17/emacs-indentunindent-region-as-a-block-using-the-tab-key/"><strong>TAB </strong>functionality</a> so I could further improve the readability of my scripts by indenting them at the same time.</p>
<p>Implementing those changes is simple when you&#8217;ve got the luxury of a highly-configurable tool: </p>
<pre style="color:#ffffff;background-color:#124368;font-size:8pt;margin-bottom:22px;">
(<span style="color:#00ffff;">defun</span> <span style="color:#87cefa;">my-shell-hook</span> ()
  (local-set-key (quote [(<span style="color:#00ffff;">return</span>)]) (quote newline))
  (local-set-key (quote [(control return)]) (quote comint-send-input))
  (local-set-key (kbd <span style="color:#ffa07a;">"M-i"</span>)  'my-unindent)
  (local-set-key (kbd <span style="color:#ffa07a;">"C-i"</span>)  'indent-or-complete))

<span style="background-color:#4f94cd;">(</span>add-hook 'shell-mode-hook 'my-shell-hook<span style="background-color:#4f94cd;">)</span></pre>
<p><strong>UPDATE</strong>: After a day trying this set-up I think that I&#8217;d rather stick to the normal binding of the RET key. I&#8217;m leaning toward using C-j and C-m  instead, as I caught myself reaching to either of them to insert carriage returns. Here are the modified bindings in replacement:</p>
<pre style="color:#ffffff;background-color:#124368;font-size:8pt;">
<span style="background-color:#4f94cd;">(</span><span style="color:#00ffff;">defun</span> <span style="color:#87cefa;">my-shell-hook</span> ()
  (local-set-key (kbd <span style="color:#ffa07a;">"M-i"</span>)  'my-unindent)
  (local-set-key (kbd <span style="color:#ffa07a;">"C-i"</span>)  'indent-or-complete)
<span style="color:#ff7f24;">;</span><span style="color:#ff7f24;"> (local-set-key (quote [(return)]) (quote newline))
</span><span style="color:#ff7f24;">;</span><span style="color:#ff7f24;"> (local-set-key (quote [(control return)]) (quote comint-send-input))
</span><span style="color:#ff7f24;">;; </span><span style="color:#ff7f24;">I actually liked these two better for adding  newlines, leaving the return with it's default behavior
</span>  (local-set-key (quote [(control j)]) (quote newline))
  (local-set-key (quote [(control m)]) (quote newline))
  (local-set-key (quote [(<span style="color:#00ffff;">return</span>)]) (quote comint-send-input))<span style="background-color:#4f94cd;">)</span>


(add-hook 'shell-mode-hook 'my-shell-hook)
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/775/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/775/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=775&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2012/02/14/emacs-taming-return-and-tab-keys-in-shell-mode/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>alternative to interrupt shell process in emacs</title>
		<link>http://ignaciopp.wordpress.com/2012/02/11/alternative-to-interrupt-shell-process-in-emacs/</link>
		<comments>http://ignaciopp.wordpress.com/2012/02/11/alternative-to-interrupt-shell-process-in-emacs/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 04:46:08 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sys-admin]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=767</guid>
		<description><![CDATA[I picked a neat trick at http://stackoverflow.com/ to cancel a command from the shell with &#8220;C-q C-c RET&#8221; if I need to interrupt a process in a remote shell opened via tramp (only with my windows laptop which I run with cygwin and emacs 23.1.91.1) Until now, without it, I found it very frustrating for [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=767&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I picked a neat trick at <a href="http://stackoverflow.com/questions/8945958/emacs-how-to-kill-a-remote-process-without-killing-the-shell-c-c-c-c-also-kill">http://stackoverflow.com/</a> to cancel a command from the shell with &#8220;<strong>C-q C-c RET</strong>&#8221; if I need to interrupt a process in a remote shell opened via tramp (only with my windows laptop which I run with cygwin and emacs 23.1.91.1)</p>
<p>Until now, without it, I found it very frustrating for example trying to cancel a heredoc inside a shell: due to some obscure reason, typing  &#8220;<strong>C-c C-c</strong>&#8221; <em>(comint-interrupt-job)</em> rather than get me back at the shell prompt,  would kill the connection with the message &#8220;Process shell interrupt&#8221;. </p>
<p>Again though this alternative is only necessary to me when connected to remote hosts using the windows version of emacs, it&#8217;s a sweet discovery nonetheless.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/767/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/767/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=767&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2012/02/11/alternative-to-interrupt-shell-process-in-emacs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>emacs using recode-region for encoding failures</title>
		<link>http://ignaciopp.wordpress.com/2012/01/23/emacs-using-recode-region-for-encoding-failures/</link>
		<comments>http://ignaciopp.wordpress.com/2012/01/23/emacs-using-recode-region-for-encoding-failures/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 21:07:05 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[ascii characters]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[multibyte characters]]></category>
		<category><![CDATA[org-mode]]></category>
		<category><![CDATA[text-editing]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=749</guid>
		<description><![CDATA[I had an encoding issue that was bugging me inside the remember-data-file. I don&#8217;t know exactly how some latin-1 characters copy-pasted there ended up being saved as raw-text and were shown like non-ASCII characters (so a multibyte characters like &#8220;é&#8221; will appear with it&#8217;s escaped octal code &#8220;303\251&#8243; ) I tried at first setting the file&#8217;s encoding [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=749&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I had an encoding issue that was bugging me inside the remember-data-file. I don&#8217;t know exactly how some latin-1 characters copy-pasted there ended up being saved as raw-text and were shown like non-ASCII characters (so a multibyte characters like &#8220;é&#8221; will appear with it&#8217;s escaped octal code &#8220;303\251&#8243; )</p>
<p>I tried at first setting the file&#8217;s encoding system with the tag &#8220;-*-coding: utf-8 -*-&#8221;, though it seemed not sufficient. The raw characters remained there and I soon grew tired of having to type in: &#8220;<strong>utf-8</strong>&#8221; at the prompt to select the encoding every time I needed to save the file. </p>
<p>Today searching the manual found <a title="http://www.gnu.org/software/emacs/manual/html_node/emacs/Text-Coding.html" href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Text-Coding.html">here</a> one easy cure on the command &#8220;recode-region&#8221; which allows to convert the text that was decoded with the wrong coding system.</p>
<p>Really all it took after marking the whole buffer (C-x h) was doing: &#8220;M-x<strong> recode-region</strong> RET&#8221; &#8220;Text was was really in: <strong>utf-8</strong>&#8221; &#8220;But was interpreted as: <strong>raw-text&#8221;</strong></p>
<p>That was it!, the drag is over, I&#8217;m back to storing notes quickly doing just <strong>C-c r</strong> and <strong>C-c C-x</strong> with the worthy <a title="remember" href="http://www.emacswiki.org/emacs/RememberMode">remember </a>mode.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/749/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/749/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=749&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2012/01/23/emacs-using-recode-region-for-encoding-failures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>sed onliner to join lines broken by a single linefeed</title>
		<link>http://ignaciopp.wordpress.com/2011/09/26/sed-onliner-to-joing-lines-broken-by-a-single-carriage-return/</link>
		<comments>http://ignaciopp.wordpress.com/2011/09/26/sed-onliner-to-joing-lines-broken-by-a-single-carriage-return/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 15:00:20 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[text-editing]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=731</guid>
		<description><![CDATA[(This is mainly a remainder post for myself) For certain reasons I sometimes have to edit text pasted from an emacs buffer that I was editing with the longlines-mode enabled. Hence as this mode does, the paragraphs are hard wrapped beyond a certain amount of characters (when they extend over &#8216;fill-column&#8217; lenght). Although &#8220;the soft [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=731&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>(This is mainly a remainder post for myself)<br />
For certain reasons I sometimes have to edit text pasted from an emacs buffer that I was editing with the <a href="http://www.gnu.org/s/libtool/manual/emacs/Longlines.html" title="longlines-mode">longlines-mode</a> enabled. Hence as this mode does,  the paragraphs are hard wrapped beyond a certain amount of characters (when they extend over &#8216;fill-column&#8217; lenght). </p>
<p>Although &#8220;the soft newlines used for line wrapping will not show up when the text is yanked or saved to disk&#8221;, they will remain if, say, I had carelessly pasted it directly into a gmail form to save for later reuse there. </p>
<p>My way to remove those artificially-inserted line breaks, is running this oneliner on the text region. </p>
<pre style="color:#ffffff;background-color:#124368;font-size:8pt;padding:4px;">
sed <span style="color:#ff7f24;">-ne</span> '1h;1!H;${;g;s#\n\([^\n]\)# \1#g;p}' | sed <span style="color:#ff7f24;">-e</span> 's#^[ \t]*\(.*\)$#\1#g'</pre>
<p>(The first sed command tells to put a space and remove the line break. using the multiline search and replace <a href="http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/" title="method">method </a><br />
The second just gets rid of the leading white space at the beginning of line)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/731/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=731&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2011/09/26/sed-onliner-to-joing-lines-broken-by-a-single-carriage-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
		<item>
		<title>elisp function to insert heredoc parameters for shell according to hostname</title>
		<link>http://ignaciopp.wordpress.com/2011/09/25/elisp-function-to-insert-heredoc-parameters-for-shell-according-to-hostname/</link>
		<comments>http://ignaciopp.wordpress.com/2011/09/25/elisp-function-to-insert-heredoc-parameters-for-shell-according-to-hostname/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 21:10:49 +0000</pubDate>
		<dc:creator>ignacio</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[dot-emacs]]></category>
		<category><![CDATA[elisp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sys-admin]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://ignaciopp.wordpress.com/?p=714</guid>
		<description><![CDATA[Now that I&#8217;m getting fond of using a heredoc to insert mysql scripts into the bash shell, have put this into my emacs initialization file. The same shortcut (Control+Shift+f11) will conveniently write different parameters depending in which shell I&#8217;m sitting in. UPDATE: seems that I spoke too soon. Asking about the present working directory, formerly [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=714&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Now that I&#8217;m getting fond of <a title="using a heredoc to insert mysql scripts into the bash shell" href="http://ignaciopp.wordpress.com/2011/08/08/heredoc-tip-execute-mysql-commands-from-shell-with-multiline-scripts-or-queries/">using a heredoc to insert mysql scripts into the bash shell</a>, have put this into my emacs initialization file. The same shortcut (Control+Shift+f11) will conveniently write different parameters depending in which shell I&#8217;m sitting in.</p>
<p>UPDATE: seems that I spoke too soon. Asking about the present working directory, formerly &#8220;(let ((a (shell-command-to-string &#8220;pwd | tr -d &#8216;\\n&#8217;&#8221;)))&#8221;, didn&#8217;t actually work when having opened shells of different servers via Tramp.<br />
The correction below (less elegant) depends on the shell buffer being created/renamed with an identifiable name -which could be the hostname or whatever consistent nomenclature we choose-.<br />
Anyway, until figuring a better way, this does the job of inserting the right parameters into each shell:</p>
<pre style="color:#f5f5f5;background-color:#212121;overflow:auto;font-size:8pt;border-color:#424242;border-style:solid;border-width:1px 1px 0;padding:4px;"><span style="color:#00ffff;">(defun</span> <span style="color:#87cefa;">my-heredoc-sql-invocation-from-shell</span> ()
<span style="color:#ffa07a;">"Insert the appropiate parameters to run a heredoc mysql query depending on which shell I'm in"</span>
  (interactive)
  (<span style="color:#00ffff;">let</span> ((a (buffer-name (window-buffer (minibuffer-selected-window))))
        (b nil))
    (<span style="color:#00ffff;">cond</span> ((string-match <span style="color:#ffa07a;">"serverA"</span> a) 
           (setq b <span style="color:#ffa07a;">"mysql -uroot mainDbToHitAt_A--password=`cat /etc/security/mysqlpassword` -t -vv &lt;&lt;\\!"</span>))
          ((string-match <span style="color:#ffa07a;">"serverB"</span> a) 
           (setq b <span style="color:#ffa07a;">"mysql -ualpha mainDbToHitAt_B --password=`cat /etc/security/mysqlpassword` -t -vv &lt;&lt;\\!"</span>))
          ((string-match <span style="color:#ffa07a;">"serverC"</span> a) 
           (setq b <span style="color:#ffa07a;">"mysql -uroot mainDbToHitAt_C  -t &lt;&lt;\\!"</span>)))
    (insert b)))

<span style="color:#ff7f24;">;; </span><span style="color:#ff7f24;">key shortcut to bind it to
</span>(global-set-key (kbd <span style="color:#ffa07a;">"C-S-&lt;f11&gt;"</span>)  'my-heredoc-sql-invocation-from-shell)

</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ignaciopp.wordpress.com/714/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ignaciopp.wordpress.com/714/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ignaciopp.wordpress.com&#038;blog=7647034&#038;post=714&#038;subd=ignaciopp&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ignaciopp.wordpress.com/2011/09/25/elisp-function-to-insert-heredoc-parameters-for-shell-according-to-hostname/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e910a7a47cd252713530179690cb5869?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ignacio</media:title>
		</media:content>
	</item>
	</channel>
</rss>
