<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CEABSHg4eCp7ImA9WhRUGUU.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625</id><updated>2012-01-30T21:05:59.630-07:00</updated><category term="visual studio" /><category term="gtk python pygtk liststore treestore treeview mvc cellrenderer treeviewcolumn howto" /><category term="cheat sheet" /><category term="return" /><category term="emacs" /><category term="kernel threads" /><category term="python" /><category term="keys" /><category term="gcc cpp macro" /><category term="howto" /><category term="pygtk" /><category term="windows" /><category term="argument" /><category term="function pointer" /><category term="parameter" /><category term="gtk" /><category term="c++" /><category term="typedef" /><category term="FileChooserDialog" /><category term="c" /><title>Emacs Junkie</title><subtitle type="html">Archive of thoughts, ideas, and knowledge.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://emacsjunkie.blogspot.com/" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/EmacsJunkie" /><feedburner:info uri="emacsjunkie" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DUUDQ34-fip7ImA9WhRWFUk.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-7349144493664279873</id><published>2012-01-02T12:30:00.000-07:00</published><updated>2012-01-02T16:34:32.056-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-02T16:34:32.056-07:00</app:edited><title>Binding or Setting Function Keys in GNU Emacs</title><content type="html">After learning the basics of emacs, you'll want to start customising your keys.&amp;nbsp; Function keys are a great place to start since few have default bindings in the stock emacs.&lt;br /&gt;
&lt;br /&gt;
For instance.&amp;nbsp; If you're a C, C++, or Java developer you'll likely want to compile from within emacs so that you can easily jump to compiler errors.&lt;br /&gt;
&lt;br /&gt;
Last I checked, there is no default key binding for doing this besides &lt;br /&gt;
&lt;pre&gt;M-x compile&lt;/pre&gt;
(to set the compile command) and &lt;br /&gt;
&lt;pre&gt;M-x recompile&lt;/pre&gt;
(to instantly compile after the compile command has been set.)&lt;br /&gt;
&lt;br /&gt;
I like to compile with F9 (force of habit from an old tool), debug with F10, and set my compile string with F11.&lt;br /&gt;
&lt;br /&gt;
For the above key bindings, add this to the end of your .emacs file:&lt;br /&gt;
&lt;pre&gt;(global-set-key [f9] 'recompile)
(global-set-key [f10] 'gdb)
(global-set-key [f11] 'compile)
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-7349144493664279873?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wQrmk8wzddpHfDNjKP1o19lkGmg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wQrmk8wzddpHfDNjKP1o19lkGmg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wQrmk8wzddpHfDNjKP1o19lkGmg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wQrmk8wzddpHfDNjKP1o19lkGmg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/7joEWWz9Ucc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/7349144493664279873/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=7349144493664279873" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/7349144493664279873?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/7349144493664279873?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/7joEWWz9Ucc/binding-or-setting-function-keys-in-gnu.html" title="Binding or Setting Function Keys in GNU Emacs" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2012/01/binding-or-setting-function-keys-in-gnu.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcEQ305eSp7ImA9WhRXEko.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-2879653227580587216</id><published>2011-12-07T22:40:00.001-07:00</published><updated>2011-12-18T22:36:42.321-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-18T22:36:42.321-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="c++" /><category scheme="http://www.blogger.com/atom/ns#" term="function pointer" /><category scheme="http://www.blogger.com/atom/ns#" term="typedef" /><category scheme="http://www.blogger.com/atom/ns#" term="howto" /><category scheme="http://www.blogger.com/atom/ns#" term="argument" /><category scheme="http://www.blogger.com/atom/ns#" term="return" /><category scheme="http://www.blogger.com/atom/ns#" term="parameter" /><category scheme="http://www.blogger.com/atom/ns#" term="c" /><title>How to return a function pointer without a typedef in C/C++</title><content type="html">The intertubes are full of examples on how to use function pointers in C/C++.  Most try to simplify things by typedef'ing the function signature.  What if you're a glutton for punishment like me and want to do it the "hard" way?&lt;br /&gt;
&lt;br /&gt;
Ok, here's the background.  Let's say you want to be able to find the cosine of an array of doubles, but you also want to be able to find the sine, tangent, etc.&lt;br /&gt;
&lt;br /&gt;
You could do this:&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;#include &lt;span style="color: green;"&gt;&amp;lt;math.h&amp;gt;&lt;/span&gt;&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;apply_sin&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;type&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;=&lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;&amp;lt;&lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;] = &lt;span style="color: #2040a0;"&gt;sin&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;apply_cos&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;type&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;=&lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;&amp;lt;&lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;] = &lt;span style="color: #2040a0;"&gt;cos&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;apply_tan&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;type&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;=&lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;&amp;lt;&lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;] = &lt;span style="color: #2040a0;"&gt;tan&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;apply_square&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;type&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;=&lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;&amp;lt;&lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;] *= &lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;];
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;/pre&gt;
&lt;br /&gt;
But this leaves a lot to be desired.  Each operation requires a new function that is nearly identical to all the rest.  Can't we factor out the commonality?&lt;br /&gt;
&lt;br /&gt;
Ok, how about this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;#include &lt;span style="color: green;"&gt;&amp;lt;math.h&amp;gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;#include &lt;span style="color: green;"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/b&gt;

&lt;b&gt;double&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;square&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;val&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;return&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;val&lt;/span&gt; * &lt;span style="color: #2040a0;"&gt;val&lt;/span&gt;;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;, &lt;b&gt;double&lt;/b&gt; (*&lt;span style="color: #2040a0;"&gt;oper&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;))
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;=&lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;&amp;lt;&lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;] = &lt;span style="color: #2040a0;"&gt;oper&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;=&lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;&amp;lt;&lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style="color: #2040a0;"&gt;printf&lt;/span&gt;(&lt;span style="color: green;"&gt;"%g "&lt;/span&gt;, &lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
    &lt;span style="color: #2040a0;"&gt;printf&lt;/span&gt;(&lt;span style="color: green;"&gt;"&lt;span style="color: #77dd77;"&gt;\n&lt;/span&gt;"&lt;/span&gt;);
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;call_it&lt;/span&gt;(&lt;b&gt;void&lt;/b&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;double&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[] = &lt;b&gt;{&lt;/b&gt;&lt;span style="color: red;"&gt;1&lt;/span&gt;,&lt;span style="color: red;"&gt;2&lt;/span&gt;,&lt;span style="color: red;"&gt;3&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;;
    &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]), &lt;span style="color: #2040a0;"&gt;sin&lt;/span&gt;);

    &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]));
    &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]), &lt;span style="color: #2040a0;"&gt;cos&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]));
    &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]), &lt;span style="color: #2040a0;"&gt;tan&lt;/span&gt;);

    &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]));
    &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]), &lt;span style="color: #2040a0;"&gt;square&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]));
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;main&lt;/span&gt;(&lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;argc&lt;/span&gt;, &lt;b&gt;char&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;argv&lt;/span&gt;[])
&lt;b&gt;{&lt;/b&gt;
    &lt;span style="color: #2040a0;"&gt;call_it&lt;/span&gt;();
&lt;b&gt;}&lt;/b&gt;

&lt;/pre&gt;
&lt;br /&gt;
So that's a bit better.  Only one implementation of the loop code, simple implementations for each operation, only the overhead of an additional pointer dereference per element.  How did we pull this off?&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;, &lt;b&gt;double&lt;/b&gt; (*&lt;span style="color: #2040a0;"&gt;oper&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;))

&lt;/pre&gt;
&lt;br /&gt;
apply_operation() takes a function pointer as a parameter (the last argument).  This makes it so that apply_operation() can take any function that takes a single double as input and returns a single double as output. Slick.&lt;br /&gt;
&lt;br /&gt;
Now, the next step: returning a function pointer (without typedefing the signature).  Let's say we have a table of operations and we associate each operation type with a function pointer so that we can do a simple lookup to get a pointer to the desired operation function.  So, in other words, we're returning a function pointer.  Here's how to do it &lt;i&gt;without&lt;/i&gt; a typedefed function signature.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;#include &lt;span style="color: green;"&gt;&amp;lt;math.h&amp;gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;#include &lt;span style="color: green;"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/b&gt;

&lt;b&gt;enum&lt;/b&gt;
&lt;b&gt;{&lt;/b&gt;
    &lt;span style="color: #2040a0;"&gt;OPER_SIN&lt;/span&gt;,
    &lt;span style="color: #2040a0;"&gt;OPER_COS&lt;/span&gt;,
    &lt;span style="color: #2040a0;"&gt;OPER_TAN&lt;/span&gt;,
    &lt;span style="color: #2040a0;"&gt;OPER_SQUARE&lt;/span&gt;
&lt;b&gt;}&lt;/b&gt;;

&lt;b&gt;struct&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;oper&lt;/span&gt;
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;type&lt;/span&gt;;
    &lt;b&gt;double&lt;/b&gt; (*&lt;span style="color: #2040a0;"&gt;func&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;);
&lt;b&gt;}&lt;/b&gt;;

&lt;b&gt;double&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;square&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;val&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;return&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;val&lt;/span&gt; * &lt;span style="color: #2040a0;"&gt;val&lt;/span&gt;;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;struct&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;oper&lt;/span&gt; &lt;span style="color: #2040a0;"&gt;oper_lut&lt;/span&gt;[] =
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;{&lt;/b&gt;&lt;span style="color: #2040a0;"&gt;OPER_SIN&lt;/span&gt;, &lt;span style="color: #2040a0;"&gt;sin&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;,
    &lt;b&gt;{&lt;/b&gt;&lt;span style="color: #2040a0;"&gt;OPER_COS&lt;/span&gt;, &lt;span style="color: #2040a0;"&gt;cos&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;,
    &lt;b&gt;{&lt;/b&gt;&lt;span style="color: #2040a0;"&gt;OPER_TAN&lt;/span&gt;, &lt;span style="color: #2040a0;"&gt;tan&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;,
    &lt;b&gt;{&lt;/b&gt;&lt;span style="color: #2040a0;"&gt;OPER_SQUARE&lt;/span&gt;, &lt;span style="color: #2040a0;"&gt;square&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;,

&lt;b&gt;}&lt;/b&gt;;

&lt;b&gt;double&lt;/b&gt; (*&lt;span style="color: #2040a0;"&gt;get_oper&lt;/span&gt;(&lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;oper_type&lt;/span&gt;))(&lt;b&gt;double&lt;/b&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;n&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;n&lt;/span&gt;=&lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;n&lt;/span&gt;&amp;lt;(&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;oper_lut&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;oper_lut&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]));&lt;span style="color: #2040a0;"&gt;n&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;b&gt;if&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;oper_type&lt;/span&gt; == &lt;span style="color: #2040a0;"&gt;oper_lut&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;n&lt;/span&gt;].&lt;span style="color: #2040a0;"&gt;type&lt;/span&gt;)
        &lt;b&gt;{&lt;/b&gt;
            &lt;b&gt;return&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;oper_lut&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;n&lt;/span&gt;].&lt;span style="color: #2040a0;"&gt;func&lt;/span&gt;;
        &lt;b&gt;}&lt;/b&gt;
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;, &lt;b&gt;double&lt;/b&gt; (*&lt;span style="color: #2040a0;"&gt;oper&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;))
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;=&lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;&amp;lt;&lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;] = &lt;span style="color: #2040a0;"&gt;oper&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;b&gt;double&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;, &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;;
    &lt;b&gt;for&lt;/b&gt; (&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;=&lt;span style="color: red;"&gt;0&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;&amp;lt;&lt;span style="color: #2040a0;"&gt;length&lt;/span&gt;;&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;++)
    &lt;b&gt;{&lt;/b&gt;
        &lt;span style="color: #2040a0;"&gt;printf&lt;/span&gt;(&lt;span style="color: green;"&gt;"%g "&lt;/span&gt;, &lt;span style="color: #2040a0;"&gt;dat&lt;/span&gt;[&lt;span style="color: #2040a0;"&gt;k&lt;/span&gt;]);
    &lt;b&gt;}&lt;/b&gt;
    &lt;span style="color: #2040a0;"&gt;printf&lt;/span&gt;(&lt;span style="color: green;"&gt;"&lt;span style="color: #77dd77;"&gt;\n&lt;/span&gt;"&lt;/span&gt;);
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;void&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;call_it&lt;/span&gt;(&lt;b&gt;void&lt;/b&gt;)
&lt;b&gt;{&lt;/b&gt;
    &lt;b&gt;double&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[] = &lt;b&gt;{&lt;/b&gt;&lt;span style="color: red;"&gt;1&lt;/span&gt;,&lt;span style="color: red;"&gt;2&lt;/span&gt;,&lt;span style="color: red;"&gt;3&lt;/span&gt;&lt;b&gt;}&lt;/b&gt;;
    &lt;b&gt;double&lt;/b&gt; (*&lt;span style="color: #2040a0;"&gt;func&lt;/span&gt;)(&lt;b&gt;double&lt;/b&gt;);
    &lt;span style="color: #2040a0;"&gt;func&lt;/span&gt; = &lt;span style="color: #2040a0;"&gt;get_oper&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;OPER_SIN&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]), &lt;span style="color: #2040a0;"&gt;func&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]));
    &lt;span style="color: #2040a0;"&gt;func&lt;/span&gt; = &lt;span style="color: #2040a0;"&gt;get_oper&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;OPER_COS&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]), &lt;span style="color: #2040a0;"&gt;func&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]));
    &lt;span style="color: #2040a0;"&gt;func&lt;/span&gt; = &lt;span style="color: #2040a0;"&gt;get_oper&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;OPER_TAN&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]), &lt;span style="color: #2040a0;"&gt;func&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]));
    &lt;span style="color: #2040a0;"&gt;func&lt;/span&gt; = &lt;span style="color: #2040a0;"&gt;get_oper&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;OPER_SQUARE&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;apply_operation&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]), &lt;span style="color: #2040a0;"&gt;func&lt;/span&gt;);
    &lt;span style="color: #2040a0;"&gt;print_vector&lt;/span&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;, &lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;)/&lt;b&gt;sizeof&lt;/b&gt;(&lt;span style="color: #2040a0;"&gt;vals&lt;/span&gt;[&lt;span style="color: red;"&gt;0&lt;/span&gt;]));
&lt;b&gt;}&lt;/b&gt;

&lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;main&lt;/span&gt;(&lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;argc&lt;/span&gt;, &lt;b&gt;char&lt;/b&gt; *&lt;span style="color: #2040a0;"&gt;argv&lt;/span&gt;[])
&lt;b&gt;{&lt;/b&gt;
    &lt;span style="color: #2040a0;"&gt;call_it&lt;/span&gt;();
&lt;b&gt;}&lt;/b&gt;

&lt;/pre&gt;
&lt;br /&gt;
The magic is in get_oper().  Did you catch it?&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;b&gt;double&lt;/b&gt; (*&lt;span style="color: #2040a0;"&gt;get_oper&lt;/span&gt;(&lt;b&gt;int&lt;/b&gt; &lt;span style="color: #2040a0;"&gt;oper_type&lt;/span&gt;))(&lt;b&gt;double&lt;/b&gt;)

&lt;/pre&gt;
&lt;br /&gt;
This means that get_oper() is a function that takes a single int as a parameter and returns a function pointer to a function that returns a double and takes a single double as its only argument.  Simple, right?  There it is--returning a function pointer from a function without typedefing the signature (the "hard" way).&lt;br /&gt;
&lt;br /&gt;
This is the best reference I've seen so far on function pointers &lt;a href="http://www.newty.de/fpt/fpt.html"&gt;http://www.newty.de/fpt/fpt.html&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-2879653227580587216?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fT4YpetdtSE27Kk3U0MwC1dTifM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fT4YpetdtSE27Kk3U0MwC1dTifM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/fT4YpetdtSE27Kk3U0MwC1dTifM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fT4YpetdtSE27Kk3U0MwC1dTifM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/Oifi4CWXLUw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/2879653227580587216/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=2879653227580587216" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/2879653227580587216?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/2879653227580587216?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/Oifi4CWXLUw/how-to-return-function-pointer-without.html" title="How to return a function pointer without a typedef in C/C++" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2011/12/how-to-return-function-pointer-without.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MCQn0ycSp7ImA9WhRQE04.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-7170489409492046013</id><published>2010-03-03T20:41:00.002-07:00</published><updated>2011-12-08T02:11:03.399-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-08T02:11:03.399-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="visual studio" /><category scheme="http://www.blogger.com/atom/ns#" term="c++" /><category scheme="http://www.blogger.com/atom/ns#" term="windows" /><category scheme="http://www.blogger.com/atom/ns#" term="emacs" /><category scheme="http://www.blogger.com/atom/ns#" term="c" /><title>Surviving Visual Studio</title><content type="html">I love emacs.  I can't describe how much I miss it when I have to do development in Windows.  Yes, I know there's a version of emacs for Windows, but it seems like if you're developing for Windows it's easier to give into the borg than to fight them.
&lt;br /&gt;
My tip for the day:&lt;br /&gt;
C-k C-f indents a region similar to C-M-\ in emacs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-7170489409492046013?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zCaaHbAZMdaELTTOb01w5kPI0kw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zCaaHbAZMdaELTTOb01w5kPI0kw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/zCaaHbAZMdaELTTOb01w5kPI0kw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zCaaHbAZMdaELTTOb01w5kPI0kw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/vNLm9pNqo3A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/7170489409492046013/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=7170489409492046013" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/7170489409492046013?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/7170489409492046013?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/vNLm9pNqo3A/surviving-visual-studio.html" title="Surviving Visual Studio" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2010/03/surviving-visual-studio.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08BRXY6cCp7ImA9WxRXFEo.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-1354999631030599954</id><published>2008-10-19T20:59:00.004-06:00</published><updated>2008-10-19T21:04:14.818-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-19T21:04:14.818-06:00</app:edited><title>Now the Economic Crisis is Personal ... Mother's Cookie Company Goes Out of Business</title><content type="html">The economic crisis hasn't really made a big difference in my life until today.  I just heard that Mother's Cookie Company is going under.  I bought one last bag of pink and white "Circus Animals".  Apparently it will have to last me for ETERNITY.  Where's the 700 billion dollar bailout for cookie companies?  Forget the whales, SAVE THE COOKIES!
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_kFxFz2YGnu4/SPv0epn68pI/AAAAAAAAAMQ/gG_8PLI1kfY/s1600-h/circus_animals.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_kFxFz2YGnu4/SPv0epn68pI/AAAAAAAAAMQ/gG_8PLI1kfY/s400/circus_animals.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5259065797291733650" /&gt;&lt;/a&gt;

Check out the &lt;a href="http://www.boston.com/news/local/connecticut/articles/2008/10/10/mothers_cookie_company_closes_amid_bankruptcy/"&gt;AP story.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-1354999631030599954?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tC4LQtGzxM_VmJjfoG1TWGefSW8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tC4LQtGzxM_VmJjfoG1TWGefSW8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tC4LQtGzxM_VmJjfoG1TWGefSW8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tC4LQtGzxM_VmJjfoG1TWGefSW8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/DSeMv5ZDjBs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/1354999631030599954/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=1354999631030599954" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/1354999631030599954?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/1354999631030599954?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/DSeMv5ZDjBs/now-economic-crisis-is-personal-mothers.html" title="Now the Economic Crisis is Personal ... Mother's Cookie Company Goes Out of Business" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_kFxFz2YGnu4/SPv0epn68pI/AAAAAAAAAMQ/gG_8PLI1kfY/s72-c/circus_animals.gif" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2008/10/now-economic-crisis-is-personal-mothers.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IGQ3s9eyp7ImA9WhRQE04.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-7775189322219285525</id><published>2008-08-14T22:53:00.007-06:00</published><updated>2011-12-08T02:12:02.563-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-08T02:12:02.563-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="gtk" /><category scheme="http://www.blogger.com/atom/ns#" term="FileChooserDialog" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="pygtk" /><title>gtk.FileChooserDialog() mini-HOWTO</title><content type="html">Enough is enough!  It seems like every time I write a pygtk app I end up needing a file chooser dialog yet every time I can't remember the details.  The &lt;a href="http://www.pygtk.org/docs/pygtk/class-gtkfilechooserdialog.html"&gt;reference page&lt;/a&gt; for gtk.FileChooserDialog() is excellent--&lt;i&gt;for reference&lt;/i&gt;.  I need a gtk.FileChooserDialog() mini-HOWTO.  Here it is:

&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
fc = gtk.FileChooserDialog(title='Open File...',
                                   parent=None,
                                   action=gtk.FILE_CHOOSER_ACTION_OPEN,
                                   buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
        fc.set_current_folder(g_directory)
        fc.set_default_response(gtk.RESPONSE_OK)
        filter = gtk.FileFilter()
        filter.set_name('Audio Files')
        filter.add_pattern('*.wav')
        filter.add_pattern('*.mp3')
        filter.add_pattern('*.flac')
        fc.add_filter(filter)
        response = fc.run()
        if response == gtk.RESPONSE_OK:
            print 'ok'
            print fc.get_filename()
            self.entry.set_text(fc.get_filename())
            g_directory = fc.get_current_folder()
        else:
            print 'not ok'
        fc.destroy()
&lt;/code&gt;&lt;/pre&gt;
There, done!  &lt;a href="http://www.pygtk.org/pygtk2tutorial/sec-FileChoosers.html"&gt;This page&lt;/a&gt; is also an excellent, more complete, example.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-7775189322219285525?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nkHa1-lOEPpzVn4DThqHD2CSpCo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nkHa1-lOEPpzVn4DThqHD2CSpCo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nkHa1-lOEPpzVn4DThqHD2CSpCo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nkHa1-lOEPpzVn4DThqHD2CSpCo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/wwPQcnaag1Q" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/7775189322219285525/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=7775189322219285525" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/7775189322219285525?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/7775189322219285525?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/wwPQcnaag1Q/gtkfilechooserdialog-mini-howto.html" title="gtk.FileChooserDialog() mini-HOWTO" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2008/08/gtkfilechooserdialog-mini-howto.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0AMSXc4fCp7ImA9WxdXFEg.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-4885298215402507204</id><published>2008-06-25T22:48:00.002-06:00</published><updated>2008-06-25T22:49:48.934-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-25T22:49:48.934-06:00</app:edited><title>I knew I Could Do Better</title><content type="html">After brushing up on the periodic table, and embellishing my education a little ...

&lt;a href="http://www.nerdtests.com/nq_ref.html"&gt;
&lt;img src="http://www.nerdtests.com/images/badge/42fe8c3ff59dbe52.gif" alt="I am nerdier than 100% of all people. Are you a nerd? Click here to find out!"&gt;&lt;/a&gt;

Beat that!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-4885298215402507204?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-EsyM5Bz2tP4nWl51zYl7zdZr7Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-EsyM5Bz2tP4nWl51zYl7zdZr7Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/-EsyM5Bz2tP4nWl51zYl7zdZr7Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-EsyM5Bz2tP4nWl51zYl7zdZr7Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/a65btBAmdEU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/4885298215402507204/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=4885298215402507204" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/4885298215402507204?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/4885298215402507204?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/a65btBAmdEU/i-knew-i-could-do-better.html" title="I knew I Could Do Better" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2008/06/i-knew-i-could-do-better.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkICRHg6eSp7ImA9WxdXFEg.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-616217943347416819</id><published>2008-06-25T22:27:00.002-06:00</published><updated>2008-06-25T22:29:25.611-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-25T22:29:25.611-06:00</app:edited><title>Mindless Drivel, but Entertaining Nonetheless</title><content type="html">&lt;a href="http://www.nerdtests.com/nq_ref.html"&gt;
&lt;img src="http://www.nerdtests.com/images/badge/88b83b32debeebda.gif" alt="I am nerdier than 94% of all people. Are you a nerd? Click here to find out!"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-616217943347416819?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MkqcUIY-J9qGYv8JFAo4dkMl3YE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MkqcUIY-J9qGYv8JFAo4dkMl3YE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/MkqcUIY-J9qGYv8JFAo4dkMl3YE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MkqcUIY-J9qGYv8JFAo4dkMl3YE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/-iUVDnx_t2U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/616217943347416819/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=616217943347416819" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/616217943347416819?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/616217943347416819?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/-iUVDnx_t2U/mindless-drivel-but-entertaining.html" title="Mindless Drivel, but Entertaining Nonetheless" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2008/06/mindless-drivel-but-entertaining.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk4BQ305eip7ImA9WxdVFU4.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-9099865873102842572</id><published>2008-04-12T15:31:00.009-06:00</published><updated>2008-07-20T00:22:32.322-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-07-20T00:22:32.322-06:00</app:edited><title>Review of "King of Kong: A Fist Full of Quarters"</title><content type="html">Over the last three days (&lt;em&gt;it's been several months ago now&lt;/em&gt;) I've had the extreme pleasure of watching &lt;a href="http://www.billyvssteve.com/"&gt;"King Kong: A Fist Full or Quarters"&lt;/a&gt;.  You &lt;i&gt;
must&lt;/i&gt; see this movie.
&lt;p/&gt;
It is, in my opinion, the quintessential American underdog story set to the music of Donkey Kong.  On one side you have Billy Mitchell, a superstar in his own world.  Arguably the best gamer of all time, but certainly the best classic gamer of all time.  Billy is amazing--He's truly gifted.  Unfortunately, like a lot of us in this world, his head is much bigger than it aught to be. (In Billy's case, his hair is longer than it aught to be too.)
&lt;p/&gt;
On the other side you have Steve Wiebe, an apparent "screw up" (and I mean that in the nicest way possible).  Of his own admission, he hasn't lived up to his true potential throughout his live.  Highly athletic yet subject to "the chokes", gifted musically but prohibitively shy, highly intelligent yet awkward and sheepish.

&lt;p/&gt;
"King of Kong: A Fist Full of Quarters" is their story.
&lt;p/&gt;
I won't spoil the rest, but I will say this: be prepared for the subculture of classic gaming's superstars, groupies, officials, desperate wannabees, outsiders, insiders, family members, winners, and losers.  It's a strange world, beyond description, even for a geek like me.

&lt;i&gt;&lt;b&gt;After&lt;/b&gt;&lt;/i&gt; you've watched the movie, go check out the current record at
&lt;a href="http://www.twingalaxies.com/index.aspx?c=22&amp;pi=2&amp;gi=3852&amp;vi=22"&gt;Twin Galaxies&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-9099865873102842572?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-22mvR2eVuaE9gf9Kvt8jTOqcrQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-22mvR2eVuaE9gf9Kvt8jTOqcrQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/-22mvR2eVuaE9gf9Kvt8jTOqcrQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-22mvR2eVuaE9gf9Kvt8jTOqcrQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/EEuWdwUdwpw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/9099865873102842572/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=9099865873102842572" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/9099865873102842572?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/9099865873102842572?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/EEuWdwUdwpw/review-of-king-of-kong-fist-full-of.html" title="Review of &quot;King of Kong: A Fist Full of Quarters&quot;" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2008/04/review-of-king-of-kong-fist-full-of.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUGQn0_fCp7ImA9WxZQEkw.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-8256959794829011567</id><published>2008-02-16T17:52:00.007-07:00</published><updated>2008-02-16T18:03:43.344-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-02-16T18:03:43.344-07:00</app:edited><title>Rock it out with Heart</title><content type="html">Though I consider myself mostly an 80's-synth-pop-new-wave-2-tone kind of person, I still have a great love for classic rock.  I think it was Homer Simpson who once said "rock peaked in '74, everyone knows that!"  Amen, Homer, Amen.&lt;br/&gt;
&lt;br/&gt;
I've been trying to play this song for +10 years now, oh well, someday I'll get it. Enjoy...&lt;br/&gt;
&lt;br/&gt;
&lt;object width="425" height="355"&gt;&lt;param name="movie" value="http://www.youtube.com/v/o5PKULglde8&amp;rel=1"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/o5PKULglde8&amp;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-8256959794829011567?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/90hJJDaztXGywce-jey_XbPolOQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/90hJJDaztXGywce-jey_XbPolOQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/90hJJDaztXGywce-jey_XbPolOQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/90hJJDaztXGywce-jey_XbPolOQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/eJX4PfbDkWs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/8256959794829011567/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=8256959794829011567" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/8256959794829011567?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/8256959794829011567?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/eJX4PfbDkWs/rock-it-out-with-heart.html" title="Rock it out with Heart" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2008/02/rock-it-out-with-heart.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8ERH84eSp7ImA9WB9QFUk.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-6264388984937840049</id><published>2007-10-27T19:40:00.000-06:00</published><updated>2007-10-27T22:13:25.131-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-10-27T22:13:25.131-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="gtk python pygtk liststore treestore treeview mvc cellrenderer treeviewcolumn howto" /><title>PyGTK Treeview digest</title><content type="html">I'm always forgetting how to use the TreeView widget to display columnar data.  In PyGTK (well, GTK+ in general) a TreeView is used to display trees (TreeStores) and columnar data (ListStores) like in the screenshot below.  In this mini HOWTO I'm restricting the post to ListStores, however, many of the concepts below apply to TreeStores.)&lt;br/&gt;
&lt;br/&gt;
A ListStore keeps track of the values you want to display in your TreeView.  You create one like this: &lt;br&gt;&lt;code&gt;liststore = gtk.ListStore(type1, type2, type3, ...)&lt;/code&gt;&lt;br/&gt;
&lt;br/&gt;
Where &lt;code&gt;type&lt;i&gt;n&lt;/i&gt;&lt;/code&gt; can be a Python type &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;str&lt;/code&gt;, a PyGTK type &lt;code&gt;gtk.Button&lt;/code&gt;..., or a gobject type like &lt;code&gt;gobject.TYPE_CHAR&lt;/code&gt; or &lt;code&gt;'gchar'&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;
Once your ListStore or "model" is created, you'll want to put things in it and take things out.
To add a row you use append or prepend like so &lt;br/&gt;&lt;code&gt;iter=liststore.append([1,2,3,'a','b','c']) iter=liststore.prepend([1,2,3,'a','b','c'])&lt;/code&gt;&lt;br/&gt;  The iterator &lt;code&gt;iter&lt;/code&gt; can be used by other calls like &lt;br/&gt;&lt;code&gt;new_iter=liststore.insert_before(iter, [1,2,3,'a','b','c']) new_iter=liststore.insert_after(iter, row=[...])&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;

So what about accessing/changing things after the fact?
&lt;br/&gt;&lt;code&gt;value=liststore.get_value(iter, column)&lt;/code&gt;&lt;br/&gt; will get a single column from a single row at &lt;code&gt;iter&lt;/code&gt;.
&lt;br/&gt;&lt;code&gt;values=liststore.get(iter,col1,col2,col3,...)&lt;/code&gt;&lt;br/&gt; gets multiple rows from &lt;code&gt;iter&lt;/code&gt; just as &lt;br/&gt;&lt;code&gt;vala, valb=liststore.get(iter, 0, 2)&lt;/code&gt;&lt;br/&gt; does.&lt;br/&gt;
&lt;br/&gt;

Conversly, &lt;br/&gt;&lt;code&gt;liststore.set(iter,col,val)&lt;/code&gt;&lt;br/&gt; sets a single column in &lt;code&gt;iter&lt;/code&gt; to value.  As does &lt;br/&gt;&lt;code&gt;liststore.set(iter,col,val,col,val,...,...)&lt;/code&gt;&lt;br/&gt; for multiple columns and values. To remove a single row do &lt;br/&gt;&lt;code&gt;liststore.remove(iter)&lt;/code&gt;&lt;br/&gt;, and &lt;br/&gt;&lt;code&gt;liststore.clear()&lt;/code&gt;&lt;br/&gt; to remove them all.&lt;br/&gt;
&lt;br/&gt;

The model (ListStore) is essentially a database.  To actually see the contents of it in a widget you'll need a TreeView, TreeViewColumns, and CellRenderers.  &lt;br/&gt;&lt;code&gt;view=gtk.TreeView(model=None)&lt;/code&gt;&lt;br/&gt; does the job of creating a TreeView, optionally setting the model off of which it's based.  Otherwise it can be set and retrieved with &lt;br/&gt;&lt;code&gt;view.set_model(model) model=view.get_model()&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;

TreeViewColumns hold the CellRenderers and are managed by the TreeView.  You add a TreeViewColumn to a TreeView like this: &lt;br/&gt;&lt;code&gt;view.append_column(column)&lt;/code&gt;.&lt;br/&gt; You make one thus &lt;br/&gt;&lt;code&gt;col=gtk.TreeViewColumn('Heading')&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;

CellRenderers do the work of displaying a particular column in the store.  CellRenderers get packed into the TreeViewColumns (which manage the column headers), therefore you can have multiple CellRenderers under one column heading.  It is a common practice to put an image and text together under the same column heading.  Different Cellrenderers exist for different types namely pixmaps, text, and toggle buttons. (And, of course, you can always make your own.)  It is easy to create a Cellrenderer: &lt;br/&gt;&lt;code&gt;cell=gtk.CellRendererText() cell=gtk.CellRendererPixbuf() cell=gtk.CellRendererToggle()&lt;/code&gt;&lt;br/&gt;. You can then pack it into the the desired TreeViewColumn with &lt;br/&gt;&lt;code&gt;column.pack_start(cell,expand=True)&lt;/code&gt;&lt;br/&gt; and &lt;br/&gt;&lt;code&gt;column.pack_end(cell,expand=False)&lt;/code&gt;.&lt;br/&gt;
&lt;br/&gt;

Here is the part I have the hardest time remembering... How do you associate data in the store with what gets displayed in the CellRenderers?  The answer is &lt;i&gt;column&lt;/i&gt; attributes.  So, to associate the text of column 0 in the &lt;i&gt;model&lt;/i&gt; with the text in a particular CellRenderer &lt;code&gt;cell&lt;/code&gt; you do &lt;br/&gt;&lt;code&gt;col.add_attribute(cell, 'text', 0)&lt;/code&gt;&lt;br/&gt; or equivalently &lt;br/&gt;&lt;code&gt;col.set_attributes(cell, text=0, prop1=modelcol1, prop2=modelcol2, ...)&lt;/code&gt;&lt;br/&gt;.  There are many other attributes besides 'text' that can be tied to your data model. Some include 'markup' (simple HTML), 'font', 'background' (color), 'foreground' (color).&lt;br/&gt;
&lt;br/&gt;

Here is a minimalist example that ties it all together:&lt;br/&gt;
&lt;pre&gt;&lt;code&gt;
import gtk

store = gtk.ListStore(int,str,str,str)
view = gtk.TreeView(model=store) # Associate the store with the view

column_int = gtk.TreeViewColumn('Integer') # These will be our column
column_str = gtk.TreeViewColumn('String')  #  headings in the TreeView widget

view.append_column(column_int) # Associate the columns with the TreeView
view.append_column(column_str) #

cell_int = gtk.CellRendererText()
cell_hex = gtk.CellRendererText()
cell_dec = gtk.CellRendererText()

column_int.pack_start(cell_int) # This column only has one CellRenderer

column_str.pack_start(cell_hex) # This column has two
column_str.pack_start(cell_dec) #

column_int.add_attribute(cell_int, 'text', 0)       # Associate col 0 of model with text of cell_int
column_int.add_attribute(cell_int, 'background', 3) # Associate col 3 of model with the cell background

column_str.add_attribute(cell_hex, 'text', 1)       # Associate col 1 of model with text of cell_hex
column_str.add_attribute(cell_dec, 'text', 2)       #    ditto for cell_dec
column_str.add_attribute(cell_hex, 'background', 3) # Associate col 3 of model with the cell background
column_str.add_attribute(cell_dec, 'background', 3) # Associate col 3 of model with the cell background

store.append([1,'0x01','1','red'])   # Add items to the store
store.append([2,'0x02','2','green']) #
store.append([3,'0x03','3','blue'])  #
store.append([4,'0x04','4','wheat']) #
store.append([5,'0x05','5','gray'])  #
store.append([0,'','',''])           #

window = gtk.Window()
window.add(view)

window.show_all()
window.connect('delete_event', gtk.main_quit)
gtk.main()
&lt;/code&gt;&lt;/pre&gt;&lt;br/&gt;
I've written it to be as simple as possible, (hence no classes, functions, etc.), so that the associations between the ListStore, TreeView, TreeViewColumns, and CellRenderers are obvious.  The result is ugly (both the code and the screenshot!), but effective at achieving the desired result.  Note that the hex and dec CellRenderers are both under the 'Strings' heading and how you can associate the model with more than just the text, in this case the background color of the cell.&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_kFxFz2YGnu4/RyQAnKQeWOI/AAAAAAAAAEY/EJt2wYlw8lc/s1600-h/flick.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; cursor: pointer;" src="http://bp0.blogger.com/_kFxFz2YGnu4/RyQAnKQeWOI/AAAAAAAAAEY/EJt2wYlw8lc/s320/flick.jpg" alt="" id="BLOGGER_PHOTO_ID_5126222948622817506" border="0" /&gt;&lt;/a&gt;


&lt;br/&gt;
For more details including sorting, additional attributes, and signals see chapter 14 of the PyGTK tutorial &lt;a href="http://www.pygtk.org/pygtk2tutorial/sec-TreeModelInterface.html"&gt;http://www.pygtk.org/pygtk2tutorial/sec-TreeModelInterface.html&lt;/a&gt;  upon which this post is heavily based.&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-6264388984937840049?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/99L3cWOf6ImMotPvWZ-wMUndN-M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/99L3cWOf6ImMotPvWZ-wMUndN-M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/99L3cWOf6ImMotPvWZ-wMUndN-M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/99L3cWOf6ImMotPvWZ-wMUndN-M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/2AOqRk1nYZA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/6264388984937840049/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=6264388984937840049" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/6264388984937840049?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/6264388984937840049?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/2AOqRk1nYZA/pygtk-treeview-digest.html" title="PyGTK Treeview digest" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://bp0.blogger.com/_kFxFz2YGnu4/RyQAnKQeWOI/AAAAAAAAAEY/EJt2wYlw8lc/s72-c/flick.jpg" height="72" width="72" /><thr:total>6</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2007/10/pygtk-treeview-digest.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4MSXoyfSp7ImA9WB5WFE0.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-3398874935900165348</id><published>2007-07-25T16:14:00.000-06:00</published><updated>2007-07-25T16:36:28.495-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-07-25T16:36:28.495-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="gcc cpp macro" /><title>Predefined Macros in gcc</title><content type="html">gcc (well cpp, the preprocessor) provides several predefined macros.  Many of these are platform independent, for instance &lt;code&gt;__FILE__&lt;/code&gt; and &lt;code&gt;__LINE__&lt;/code&gt;.  Others are platform dependent (or "system-specific" as the gcc manual puts it).  So how do you know what your particular platform defines?  Try this: &lt;br /&gt;
&lt;code style="background-color: rgb(200, 200, 200);"&gt;cpp -dM /dev/null&lt;/code&gt;

I stumbled across this trick the other day on &lt;a href="http://lists.apple.com/archives/Unix-porting/2005/Apr/msg00003.html"&gt;Apple's mailing lists archives&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-3398874935900165348?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Doimfcy3l5B5Pwwi3E_-Lxpex0Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Doimfcy3l5B5Pwwi3E_-Lxpex0Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Doimfcy3l5B5Pwwi3E_-Lxpex0Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Doimfcy3l5B5Pwwi3E_-Lxpex0Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/CiznOONob_k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/3398874935900165348/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=3398874935900165348" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/3398874935900165348?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/3398874935900165348?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/CiznOONob_k/predefined-macros-in-gcc.html" title="Predefined Macros in gcc" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2007/07/predefined-macros-in-gcc.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMAQH8_fyp7ImA9WB5WFEU.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-2734744740929620584</id><published>2007-07-25T10:16:00.000-06:00</published><updated>2007-07-26T16:04:01.147-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-07-26T16:04:01.147-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="kernel threads" /><title>Linux Kernel Threads Can Have Priorities and Can Dereference current</title><content type="html">My memory failed me on some points of kernel threads today so hopefully this post will solidify my knowledge.  
&lt;ul&gt;
&lt;li&gt;Kernel threads &lt;i&gt;can&lt;/i&gt; have a priority via the "nice" mechanism.  It is set using &lt;code&gt;set_user_nice(tsk, nice_level)&lt;/code&gt;, just as for userspace processes/threads.&lt;/li&gt;
&lt;li&gt;As a consequence of the above point, kernel threads have a task structure and it may be referred to by the &lt;code&gt;current&lt;/code&gt; pointer, again, the same as is the case with userspace processes/threads.&lt;/li&gt;
&lt;/ul&gt;
&lt;code&gt;set_user_nice()&lt;/code&gt; should be called from within the task callback function supplied to &lt;code&gt;kthread_create()&lt;/code&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-2734744740929620584?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xVS8e2ybsUBdO2io3RWoZbmf0fQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xVS8e2ybsUBdO2io3RWoZbmf0fQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xVS8e2ybsUBdO2io3RWoZbmf0fQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xVS8e2ybsUBdO2io3RWoZbmf0fQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/_YrMqXRKj6U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/2734744740929620584/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=2734744740929620584" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/2734744740929620584?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/2734744740929620584?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/_YrMqXRKj6U/linux-kernel-threads-can-have.html" title="Linux Kernel Threads Can Have Priorities and Can Dereference &lt;code&gt;current&lt;/code&gt;" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2007/07/linux-kernel-threads-can-have.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUEQHo8cSp7ImA9WB5WFE0.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-4345535197704642272</id><published>2007-07-20T08:38:00.000-06:00</published><updated>2007-07-25T16:40:01.479-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-07-25T16:40:01.479-06:00</app:edited><title>"Real HTML" in blogger</title><content type="html">Ok, first things first...  If you're a control freak like I am and want to actually use "real" HTML (tables, div, etc.) in your posts to blogger, the first thing you should do is disable the automatic conversion of line breaks to the &lt;nobr&gt;&amp;lt;br /&amp;gt;&lt;/nobr&gt; tag.&lt;br /&gt; &lt;br /&gt;  Of course, then you'll have to explicitly add &amp;lt;br /&amp;gt; tags to format your posts, but at least then you won't waste an hour trying to figure out why your tables look atrocious. (Not that I did that or anything ;) &lt;br /&gt; &lt;br /&gt;
To do this, log in, hit the "Settings" tab, then the "Formatting" tab, then set "Convert Line Breaks" to "No". &lt;br /&gt; &lt;br /&gt;

In other words "Settings"-&gt;"Formatting"-&gt;"Convert Line Breaks" = "No".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-4345535197704642272?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8V1PlmU9xgmFN5J5UDA8qpM9BIQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8V1PlmU9xgmFN5J5UDA8qpM9BIQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8V1PlmU9xgmFN5J5UDA8qpM9BIQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8V1PlmU9xgmFN5J5UDA8qpM9BIQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/_Ka71KN-m3k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/4345535197704642272/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=4345535197704642272" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/4345535197704642272?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/4345535197704642272?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/_Ka71KN-m3k/real-html-in-blogger.html" title="&quot;Real HTML&quot; in blogger" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2007/07/real-html-in-blogger.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUDR30zfCp7ImA9WhRQE04.&quot;"><id>tag:blogger.com,1999:blog-2882101181039237625.post-4447315616767782905</id><published>2007-07-19T08:29:00.000-06:00</published><updated>2011-12-08T02:24:36.384-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-08T02:24:36.384-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="cheat sheet" /><category scheme="http://www.blogger.com/atom/ns#" term="emacs" /><category scheme="http://www.blogger.com/atom/ns#" term="keys" /><title>Emacs Notes</title><content type="html">This is my general emacs knowledge base.  Some of these keys/features I use everyday others I always forget about, hence the existence of these notes.
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
//           When opening (visiting) a file (C-x C-f), disregards everything before //
M-\          Kills whitespace pointed to by point
M-^          Merge the current line with previous line (taking away whitespace)
C-x C-x      swap mark and point
C-space      set new mark
C-u C-space  goto next mark in ring
C-M-space    mark to end of paren
C-t          transpose two chars
M-t          transpose two words
C-M-t        transpose two balanced expressions
C-M-f        move forward one balanced expression
C-M-b        move backward one balanced expression
C-M-k        kill balanced expression forward
C-M-&amp;lt;del&amp;gt;    kill balanced expression backward
C-x C-t      transpose two lines
M-m          move to first non-whitespace on line
C-c C-e      in C-mode expands macros into new buffer
C-M-q        toggle-read-only
C-x w h      highlight a regexp
C-x w r      unhighlight a regexp
M-x find-file-at-point Opens file at point
M-x apropos  Find an emacs command based on regexp
M-x woman    Advanced manual page browser
C-x &amp;gt;        scroll right
C-x &amp;lt;        scroll left

Narrowing
C-x n d      Narrow to defun  (one C-function)
C-x n n      Narrow to region
C-x n w      widen

Minibuffer
M-s          Search minibuffer history forward
M-r          Search minibuffer history backward

Kill Ring
C-h v kill-ring    View contents of kill ring
C-u C-y            Yank, but leave point at beginning of yanked text

TAGS (old tags)
M-. TAG            Find a TAG
C-u M-.            Find next TAG
C-M-. PATTERN      Find a TAG using regexp PATTERN
C-x 4 . TAG        Find a tag but put in another window
M-*                Pop back to where you invoked a TAG search
M-x tags-search    Search multiple files for regexp
M-,                Continue tags search
M-x list-tags FILE Lists all tags in a file
M-x tags-apropos   Lists all tags matching a regexp

GTAGS
M-. TAG                find TAG
M-? TAG                find all references to TAG
[f3] TAG               create TAG completion list "global -c TAG"
M-x gtags-symbol-find  find a symbol (similar to [f6])

M-x ps-spool-region-with-faces
M-x desktop-read
M-x desktop-save

"C-mode"
M-a  backward statement
M-e  forward statement
C-M-u  up conditional (block)
C-M-d  down conditional (block)
C-M-n  next conditional (block)
C-M-p  prev conditional (block)
C-c C-a  Toggle Autonewline minor mode
C-c C-d  Toggle Hungry Delete minor mode
C-c C-t  Toggle both Autnewline and Hungry Delete minor modes
C-c C-\  Add \'s to a region for multi-lined macros
C-u C-c C-\  Remove \'s from multi-line macros
M-q  In a C comment, wrap text appropriately.
M-j  Add a line break in a comment.
C-x `  go to next compilation error

DIRED
(to enter)
C-x d                Enter dired mode
C-x f [tab] [enter]  Enter dired mode while visiting file
(once in)
i                    Show contents of directory at point
g                    Update buffer (reread directory from disk)
d                    Mark file at point for deletion ('D' not '*')
u                    Ummark file at point
x                    Delete (expunge) files marked for deletion
% d &amp;lt;regexp&amp;gt;         Mark files for deletion matching regexp
% m &amp;lt;regexp&amp;gt;         Mark files matching regexp
% g &amp;lt;regexp&amp;gt;         Mark all files which contain regexp (like grep)
[del]                Unmark move point up one line
[enter]              Visit file at point
f                    Visit file at point (Same as [enter])
e                    Visit file at point (Same as [enter])
o                    Visit file at point in other window
C-o                  Visit file at point in other window, but stay in dired window
v                    View file at point (read only, q to quit)
^                    Move up to parent directory (..)
m                    Mark a file (with '*' not 'D')
* s                  Mark all files in current dired window
* t                  Toggle marked files (unmark all marked, mark all unmarked)
* %                  Same as  % m &amp;lt;regexp&amp;gt;  above
* !                  Unmark all marked
* /                  Mark all directories except . and ..
C &amp;lt;name&amp;gt;             Copy current file, see manual for multiple files (marked files)
R &amp;lt;name&amp;gt;             Rename current file, see manual for multiple files
M &amp;lt;mode&amp;gt;             Change mode of file(s) (uses chmod modes)
G &amp;lt;newgroup&amp;gt;         Like chgrp
O &amp;lt;newowner&amp;gt;         Like chown
S &amp;lt;name&amp;gt;             Make symbolic link
Z                    Compress marked files (or uncompress if compressed)
! &amp;lt;cmd&amp;gt;              Run shell command &amp;lt;cmd&amp;gt; on all marked files.  If &amp;lt;cmd&amp;gt; contains '*', '*' expands to all marked files
X &amp;lt;cmd&amp;gt;              Same as ! &amp;lt;cmd&amp;gt;
% R &amp;lt;from&amp;gt; &amp;lt;to&amp;gt;      Use regular expression to rename file ^.*$ to x-^.*$ adds "x-" to all marked files
% C &amp;lt;from&amp;gt; &amp;lt;to&amp;gt;      Use regular expression to copy file ^.*$ to x-^.*$ makes new files with "x-"
% S &amp;lt;from&amp;gt; &amp;lt;to&amp;gt;      Use regular expression to symlinks files ^.*$ to x-^.*$ adds "x-" to all symlinks
q                    Quit (kill dired buffer)
=                    diff files at point and mark (uses dired-diff as command)
M-=                  diff file at point with it latest backup (.*~)
C-x u                (undo, unmark all marked, restore names of renamed files)
M-x find-dired       Use the 'find' command to fill dired buffer
M-x find-name-dired  Use the 'find' command employing -name to fill dired buffer
M-x find-grep-dired  Use the 'find' command with grep to fill dired buffer
M-x locate           Similar to 'locate' command

VC (clearcase.el)
C-x C-q              Toggle read-only on non-version controlled element
                   Checkout or checkin (whatever makes sense) version controlled element
C-x v v              Checkout or checkin (whatever makes sense) version controlled element
C-x v ~ &amp;lt;version&amp;gt;    View a specific version of a file (dired mode kicks in on tab)
C-x v i              Runs mkelem on current buffer (NOT TESTED!)
C-x v l              Display history on current buffer
C-x v u              Revert element (uncheckout current buffer)
C-x v e              Edit config spec
C-c C-c              Finishes a comment session (on checkin or checkout)
v v                  (In dired mode) Checkout or checkin all marked files (whatever makes sense for each file)

Emacs server/client
(server-start)       Starts emacs server. Clients connect with emacsclient command.
C-x #                Unblock emacsclient and kill emacsclient buffer
EDITOR               (Environment variable, set this to emacsclient)
ALTERNATE_EDITOR     (Environment variable, set to a different editor if emacs server not running)

International input mode
C-\                  Enter\Get out of international input mode.
_a                   1ª (feminine ordinal)
_o                   1º (masculine oridinal)
~c                   ç (ce com cedilha)
~a                   ã,õ - nasals
^a                   â,ô,ê - circumflex (hat)
'a                   á,é,í,ó,ú, - accent (acento agudo)
`a                   à - grave accent (acento grave)

Environment Variables
M-x getenv
M-x setenv

GDB mode
C-x space            Set breakpoint at point
M-s                  step
M-n                  next
M-i                  stepi
M-c                  continue

Filtering/Searching
M-x occur &amp;lt;RET&amp;gt; REGEXP &amp;lt;RET&amp;gt;        Lists in a buffer all lines matching REGEXP
M-x how-many &amp;lt;RET&amp;gt; REGEXP &amp;lt;RET&amp;gt;     Shows how many lines match REGEXP
M-x flush-lines &amp;lt;RET&amp;gt; REGEXP &amp;lt;RET&amp;gt;  Filter out lines matching REGEXP
M-x keep-line &amp;lt;RET&amp;gt; REGEXP &amp;lt;RET&amp;gt;    Filter out all lines not matching REGEXP

&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2882101181039237625-4447315616767782905?l=emacsjunkie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/NLTUuORIgOWBv4wGUNk_kz9vX84/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NLTUuORIgOWBv4wGUNk_kz9vX84/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/NLTUuORIgOWBv4wGUNk_kz9vX84/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NLTUuORIgOWBv4wGUNk_kz9vX84/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/EmacsJunkie/~4/vAMhxFT32IA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://emacsjunkie.blogspot.com/feeds/4447315616767782905/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2882101181039237625&amp;postID=4447315616767782905" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/4447315616767782905?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2882101181039237625/posts/default/4447315616767782905?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/EmacsJunkie/~3/vAMhxFT32IA/when-opening-visiting-file-c-x-c-f.html" title="Emacs Notes" /><author><name>Anthony Jackson</name><uri>http://www.blogger.com/profile/02185607303482763906</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://emacsjunkie.blogspot.com/2007/07/when-opening-visiting-file-c-x-c-f.html</feedburner:origLink></entry></feed>

