<?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/"
	>

<channel>
	<title>Marios Braindump &#187; emacs</title>
	<atom:link href="http://www.mfasold.net/blog/tag/emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mfasold.net/blog</link>
	<description>Just shouting my thoughts out</description>
	<lastBuildDate>Fri, 23 Jul 2010 14:21:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Use the new Emacs Daemon!</title>
		<link>http://www.mfasold.net/blog/2009/11/use-the-new-emacs-daemon/</link>
		<comments>http://www.mfasold.net/blog/2009/11/use-the-new-emacs-daemon/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 15:33:22 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=400</guid>
		<description><![CDATA[Emacs usually takes quite some time to fully start up. However, as described in the great blog Emacs-Fu, Emacs 23 can now be started in the background as a daemon. This allows to fire up a new Emacs instance really fast. Thanks djcb!
]]></description>
			<content:encoded><![CDATA[<p>Emacs usually takes quite some time to fully start up. However, as <a href="http://emacs-fu.blogspot.com/2008/12/welcome-to-emacs-fu.html">described</a> in the great blog Emacs-Fu, Emacs 23 can now be started in the background as a daemon. This allows to fire up a new Emacs instance really fast. Thanks djcb!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/11/use-the-new-emacs-daemon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inline Figures in Org-Mode Paper Drafts</title>
		<link>http://www.mfasold.net/blog/2009/07/inline-figures-in-org-mode-paper-drafts/</link>
		<comments>http://www.mfasold.net/blog/2009/07/inline-figures-in-org-mode-paper-drafts/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 13:46:43 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=315</guid>
		<description><![CDATA[Writing a paper often comes along with a problem known as information fragmentation: figures, tables and the respective data sources related to the paper certainly are somewhere on your hard disk &#8211; but where? How did I name the file with the data-points again? And, the heck, which commands did I use to create that [...]]]></description>
			<content:encoded><![CDATA[<p>Writing a paper often comes along with a problem known as information fragmentation: figures, tables and the respective data sources related to the paper certainly are somewhere on your hard disk &#8211; but where? How did I name the file with the data-points again? And, the heck, which commands did I use to create that fancy plot? But chill, there is a way to avoid the joyless seeking and re-finding. At least if you <a href="http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/">draft your papers in org-mode</a>, as I described in a recent post.</p>
<p><span id="more-315"></span>The key tool here is the wonderful org-mode extension Org-R by Dan Davison. It allows to include code fragments that create figures or tables directly into your document. That way, everything will be in one place.  Searching, au revoir.</p>
<p><strong>Introduction to Org-R</strong></p>
<p>Luckily, Dan wrote a <a href="http://orgmode.org/worg/org-tutorials/org-R/org-R.php">comprehensive tutorial</a> on how to use org-R. If your planning to give it a try, I suggest to look over his words first. However, he forgot to mention two things you&#8217;ll need to enable the org-R goodness. Insert</p>
<blockquote><p>(add-to-list &#8216;load-path &#8220;~/site-lisp/org-mode/contrib/lisp&#8221;)<br />
(require &#8216;org-R)</p></blockquote>
<p>into your .emacs and edit the directory to point into your org-mode directory. Also, you need to have a R instance running (invoke <code>M-x R</code>) in the directory of your document. Try some of the examples given in his tutorial in a new .org document now.</p>
<p>What happens behind the scenes here is that org-R translates the inline commands into a R command sequence. For example, <code>infile:x.csv</code> is converted into <code>x = read.table(...)</code> . The <code>+RR</code> prefix introduces direct R commands, which are executed before the <code>+R</code> commands (except infile:). The result is then inserted as a table or as a link to a graphic. Note that many actions rely on conventions:  <code>outfile:x.png</code> will create a png image. Reading from a datafile will only work if the file suffix is .csv. And its contents will always be stored in a variable x. If you are not sure what is happening behind the scenes, the command <code>showcode:t</code> shows you the created R-code and is hence a great tool for debugging.</p>
<p><strong>Using figures</strong></p>
<p>A typical fragment for creating a figure that is also exported into LaTeX/PDF/HTML properly is</p>
<blockquote><p>#+CAPTION: Distribution of foot sizes among coputer scientists<br />
#+LABEL: fig:SizeDistribution<br />
#+ATTR_LaTeX: scale=0.5<br />
[[file:images/distanceDist.png]]<br />
#+R: infile:&#8221;tmp.csv&#8221; #+R: action:density columns:1 args:(:lwd 4)<br />
#+R: outfile:&#8221;images/distanceDist.png&#8221;<br />
#+R: inline:t</p></blockquote>
<p>The first three lines give the image a caption and a reference, and define the size of the image in the paper. Invoking C-c (or <code>org-apply</code>) in the second part will (re-)create the image. The command <code>#+R: inline:t</code> is required for the resulting link to the image having the same format as the LaTeX exporter recognizes for figures.</p>
<p><strong>Keeping your document clean</strong></p>
<p>The main intend of org-R obviously was to enable org-mode users to perform quick calculations and create simple graphs from data that originates from org-tables. Undeniable, org-r is very good at that. However, our objective shall rather be to centralize and de-fragment drafting of papers containing complex figures. When it comes to more elaborate graphs and datasets, the usefulness of  the predefined actions vanishes and longer, more complex R code is required. You might rather want to work in ESS/R-mode, where you have all the coloring and intendation niceness, and you do not have to precede every line with an +RR:.</p>
<p>The alternative is to source the functions from a separate .R file, for example you could use</p>
<blockquote><p>#+CAPTION: Distribution of finger lengths among computer scientists<br />
#+ATTR_LaTeX: scale=0.5<br />
#+LABEL: fig:LengthDistribution<br />
[[file:images/distanceDist.png]]<br />
#+R: infile:&#8221;tmp.csv&#8221;<br />
#+RR: source(&#8221;rcode.R&#8221;)<br />
#+RR: myDensity(x)<br />
#+R: outfile:&#8221;images/distanceDist.png&#8221;<br />
#+R: inline:t</p></blockquote>
<p>with the following code (imagine a longer fragment) in rcode.R</p>
<blockquote><p>myDensity &lt;- function(x) {  <br />
    plot(density(x[,1]), col=&#8221;chartreuse4&#8243;, lwd=5, xlim=c(0,2000))<br />
}</p></blockquote>
<p>That way, you avoid immense R code pollution in your draft, yet you have all the information (data-files, linked code and parameters) in one place. Happy drafting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/07/inline-figures-in-org-mode-paper-drafts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding out where your Program Crashes with the Emacs GUD</title>
		<link>http://www.mfasold.net/blog/2009/05/finding-out-where-your-program-crashes-with-the-emacs-gud/</link>
		<comments>http://www.mfasold.net/blog/2009/05/finding-out-where-your-program-crashes-with-the-emacs-gud/#comments</comments>
		<pubDate>Tue, 26 May 2009 14:34:19 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=299</guid>
		<description><![CDATA[This post describes a very, very elementary debugging skill. Yet, I could not find any concise tutorial about it on the web. So, here we go!
Assume you&#8217;re developing a small software under Linux, maybe using C or C++ and the GCC compiler. Testing your program, you find that it crashes with an error (segfault, assertion, [...]]]></description>
			<content:encoded><![CDATA[<p>This post describes a very, very elementary debugging skill. Yet, I could not find any concise tutorial about it on the web. So, here we go!</p>
<p>Assume you&#8217;re developing a small software under Linux, maybe using C or C++ and the GCC compiler. Testing your program, you find that it crashes with an error (segfault, assertion, &#8230;). How do find the cause for this crash rapidly? How can you back-trace the error?</p>
<p>First, compile your program again adding the option &#8220;<code>-g</code>&#8221; (or &#8220;<code>-gstabs</code>&#8220;). The compiler (e.g. g++) will now include information necessary for debugging into your binary. Start Emacs and invoke &#8220;<code>M-x gdb</code>&#8220;. As parameter, enter the full path of your executable. You end up with something like &#8220;<code>gdb --annotate=3 ~/myProject/myProgram</code>&#8220;. In the newly opened buffer, set the commandline parameters as for example in &#8220;<code>start --verbose-mode inputfile.dat</code>&#8220;. Simply append the program options you normally use after &#8220;<code>start</code>&#8220;.</p>
<p>Run the command &#8220;<code>c</code>&#8221; (=continue). Your program will start &#8211; and crash. Now, invoke &#8220;<code>M-x gdb-many-windows</code>&#8220;. You will see the steps leading to the function that caused the crash in the window &#8220;stack frames&#8221;. By clicking on each of the steps, Emacs will directly navigate to the respective source code block, enabling you to trace the cause of the error. Find a more extensive tutorial <a href="http://www.linuxjournal.com/article/7876">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/05/finding-out-where-your-program-crashes-with-the-emacs-gud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fetch Bibliographic Data within Emacs</title>
		<link>http://www.mfasold.net/blog/2009/03/fetch-bibliographic-data-within-emacs/</link>
		<comments>http://www.mfasold.net/blog/2009/03/fetch-bibliographic-data-within-emacs/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 11:25:04 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=276</guid>
		<description><![CDATA[Are you frequently working with bibliographies, e.g. writing LaTeX documents with BibTeX? Finding the references you want to cite, and fetching/inserting the bibliographic data usually involves a number of clicks and database searches. There is an Emacs extension that may help you out here: Pub-Mode streamlines the whole process down to a couple of keystrokes.
Also, [...]]]></description>
			<content:encoded><![CDATA[<p>Are you frequently working with bibliographies, e.g. writing LaTeX documents with BibTeX? Finding the references you want to cite, and fetching/inserting the bibliographic data usually involves a number of clicks and database searches. There is an Emacs extension that may help you out here: <a href="http://pubmode.sourceforge.net/">Pub-Mode </a>streamlines the whole process down to a couple of keystrokes.</p>
<p>Also, as he reported on a conference I attended recently, the <a href="http://www.tbi.univie.ac.at/~wash">author</a> of Pub-Mode is developing a Bibliographic Management System that, amongst other things, automtically fetches the PDF-file of a reference. No more clicking through publishers websites. I&#8217;m really waiting for this one!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/03/fetch-bibliographic-data-within-emacs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Emacs Org-mode to Draft Papers</title>
		<link>http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/</link>
		<comments>http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 22:55:49 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=86</guid>
		<description><![CDATA[Scientific papers are mostly written in LaTeX, a markup language for typesetting. With LaTeX, a document is programmed rather than edited in a WYSIWYG-way. There is a great deal of specialized editors or editor modes (e.g. AucTeX) simplifying the creation of LaTeX documents. In many cases, however, you just want to quickly write down what&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Scientific papers are mostly written in <a href="http://www.latex-project.org/">LaTeX,</a> a markup language for typesetting. With LaTeX, a document is programmed rather than edited in a WYSIWYG-way. There is a great deal of specialized editors or editor modes (e.g. <a href="http://www.gnu.org/software/auctex/">AucTeX</a>) simplifying the creation of LaTeX documents. In many cases, however, you just want to quickly write down what&#8217;s in your head instead of getting stuck in the details of LaTeX markup. I found that Emacs <a href="http://orgmode.org/">org-mode</a> is very well suited to fill that gap. You can efficiently draft a scientific document that can directly be converted into LaTeX code which you can beautify later on. I&#8217;ll show you here how.</p>
<p><span id="more-86"></span></p>
<p><strong>Installation</strong></p>
<p>First, you have to install org-mode for Emacs as described <a href="http://orgmode.org/manual/Installation.html#Installation">here</a>. Org-mode is included in Emacs since version 22.1 and the latest version can be obtained from the a git repository via</p>
<blockquote><p><code>git clone git://repo.or.cz/org-mode.git</code></p></blockquote>
<p>Be sure to use the latest version for this tutorial as there really is some active development going on and some of the features I use were included just recently.</p>
<p><strong>The First Document</strong></p>
<p>Begin by opening a new files with a &#8220;.org&#8221; extension. Paste the following lines into that document</p>
<blockquote><p><code>The Impact of Beer Consumption on Scientific Collaboration<br />
#+AUTHOR: Mario Fasold<br />
* Introduction<br />
** Previous Work<br />
Some studies relating scientific output and beer have previously been done.<br />
#+BEGIN_QUOTE<br />
In Europe, most alcohol is consumed as beer and, based on well known negative effects of alcohol consumption on cognitive performance, I predicted negative correlations between beer consumption and several measures of scientific performance.<br />
#+END_QUOTE<br />
([[<cite>www.zoologie.upol.cz/osoby/Grim/Grim_Oikos_2008_on-line.pdf</cite>]])<br />
* Results<br />
** What beer should you drink<br />
+ Becks<br />
+ Czech Budweiser<br />
+ Duff<br />
</code></p></blockquote>
<p>The first line contains the title of your document. It will be used by each of the exporters, e.g. LaTeX or HTML. Note that there was a bug in the latex exporter, leading to duplicated text after the table-of-contents if the first line of the document was a headline. Leaving the fist line empty is the suggested <a href="http://www.mail-archive.com/emacs-orgmode@gnu.org/msg08440.html">workaround</a> here.</p>
<p>The export can be controlled by various parameters that can be set anywhere in the org-document. The syntax is &#8220;#+OPTIONS: toc:nil&#8221;, for example (<a href="http://www.gnu.org/software/emacs/manual/html_node/org/Export-options.html">available options</a>). Some export options that might be useful to create a paper draft include<br />
<code> </code></p>
<ul>
<li>#+AUTHOR: the author (default taken from user-full-name)</li>
<li>#+DATE:   A date, fixed, of a format string for format-time-string</li>
<li>#+EMAIL:  his/her email address (default from user-mail-address)</li>
</ul>
<p>Using the very simple <a href="http://orgmode.org/manual/Markup-rules.html">org-mode markup</a>, the document then defines some sections, subsections, textblocks and formulas. Note that only the first three outline levels (* &#8211; ***) are used for headlines by default. Using the markup you can easily define lists, include other files, enter footnotes, define literal and source code blocks (and even use Emacs font-lock for those areas) and more. For example, a text literal is inserted via</p>
<blockquote><p><code>#+BEGIN_EXAMPLE<br />
Some example from a text file.<br />
#+END_EXAMPLE</code></p></blockquote>
<p>and the following passes code directly into latex</p>
<blockquote><p><code>#+BEGIN_LaTeX<br />
All lines between these markers are exported literally<br />
#+END_LaTeX</code></p></blockquote>
<p>Another honored mention be the org-tables mode which lets you create and edit and tables in a dead-easy manner (try to swap a table column in AucTeX&#8230;).</p>
<p><strong>Figures</strong></p>
<p>Papers and their drafts can&#8217;t live without images in most cases. The following syntax allows <a href="http://thread.gmane.org/gmane.emacs.orgmode/8588/focus=9927">since december</a> to insert one</p>
<blockquote><p><code>#+CAPTION: Degradation Plot<br />
#+ATTR_LaTeX: scale=0.75<br />
#+LABEL: fig:degradation<br />
[[./images/DegradationPlot.png]]</code></p></blockquote>
<p>It&#8217;s a little buggy still, for example, no underscores seem to be allowed within filenames for now. For more complex cases, you can just write the LaTeX-code (org-mode will recognize many identifiers):</p>
<blockquote><p><code>\begin{figure}[!tpb]<br />
\centerline{<br />
\includegraphics[scale=0.3]{images/BeerPlot}<br />
}\caption{This is plot looks like a beer.}\label{fig:Beer}<br />
\end{figure}</code></p></blockquote>
<p><strong>References</strong></p>
<p>You may also want to include references while drafting the paper. Luckily, you can use RefTex-Mode (included in Emacs) to scan your BibTeX-file (containing the bibliographies) and easily insert a reference to an entry of that file. First, activate RefTex in org-mode by inserting the following lines into .emacs:</p>
<blockquote><p><code>(defun org-mode-reftex-setup ()<br />
(load-library "reftex")<br />
(and (buffer-file-name)<br />
(file-exists-p (buffer-file-name))<br />
(reftex-parse-all))<br />
(define-key org-mode-map (kbd "C-c )") 'reftex-citation)<br />
)<br />
(add-hook 'org-mode-hook 'org-mode-reftex-setup)</code></p></blockquote>
<p>Second, include the BibTeX-file by inserting</p>
<blockquote><p><code>\bibliographystyle{plain}<br />
\bibliography{ProbePosition}</code></p></blockquote>
<p>at the end of your org-document. When you want to insert the reference just invoke &#8220;C-c )&#8221;, enter a search term (e.g. auther name) and select the right one from the search results. Note: When first opening the org document, RefTeX will ask you to give him the name of the &#8220;master&#8221; which is the .tex-file corresponding to your org-file.</p>
<p>You can also use org-mode to collect notes about all the publications you are reading. Stick to <a href="http://article.gmane.org/gmane.emacs.orgmode/2406/match=bibliography">this description</a> to find out how you could manage bibliographies and PDF-documents in a nice way.</p>
<p><strong>Outlook</strong></p>
<p>Org-mode is a very versatile and extensible mode for Emacs. If Emacs is considered an Operating System, consider Org-mode as the Emacs for that system! I  find org-mode particularly handy to draft papers. Include images, formulas, tables and references with ease, without the hassle of dealing with LaTeX markup.</p>
<p>Additionaly, you might use org-mode to organize related links, documents and data. With <a href="http://orgmode.org/worg/org-tutorials/org-R/org-R.php">org-R</a> you can even do any computations (e.g.statistics) and plots in-line using R &#8211; no need to fragment your information! Also, expect to see nice features appearing for org-mode frequently. I would be glad to hear how you use org-mode to collect information and do science!</p>
<p>Ps. Someone even wrote his complete diploma thesis with org-mode. He describes his experience <a href="http://www.mail-archive.com/emacs-orgmode@gnu.org/msg04582.html">here</a> (his org-file is a good example, too).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Emacs Ad</title>
		<link>http://www.mfasold.net/blog/2008/05/emacs-ad/</link>
		<comments>http://www.mfasold.net/blog/2008/05/emacs-ad/#comments</comments>
		<pubDate>Tue, 27 May 2008 11:33:07 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[english]]></category>

		<guid isPermaLink="false">http://www.mfasold.net/blog/?p=24</guid>
		<description><![CDATA[This screencast shows how you can use emacs as an IDE for Ruby development. It demonstrates many nice but not so known features such as ido-mode, tramp and snippets. The screencast has been produced in 2006 and is still worth seeing.
]]></description>
			<content:encoded><![CDATA[<p><a title="Emacs screencast" href="http://platypope.org/yada/emacs-demo/">This screencast </a>shows how you can use emacs as an IDE for Ruby development. It demonstrates many nice but not so known features such as ido-mode, tramp and snippets. The screencast has been produced in 2006 and is still worth seeing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mfasold.net/blog/2008/05/emacs-ad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
