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

<channel>
	<title>Eternal Ranting of the Spotless Mind &#187; emacs</title>
	<atom:link href="http://jwickers.wordpress.com/category/emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://jwickers.wordpress.com</link>
	<description>the known unknowns of the intarweb</description>
	<lastBuildDate>Wed, 15 Oct 2008 08:12:30 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='jwickers.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/b85f5c4ce7a07f095e190222c6ebd809?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Eternal Ranting of the Spotless Mind &#187; emacs</title>
		<link>http://jwickers.wordpress.com</link>
	</image>
			<item>
		<title>Tweaking Flymake for Java</title>
		<link>http://jwickers.wordpress.com/2008/10/13/tweaking-flymake-for-java/</link>
		<comments>http://jwickers.wordpress.com/2008/10/13/tweaking-flymake-for-java/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 08:06:45 +0000</pubDate>
		<dc:creator>jwickers</dc:creator>
				<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://jwickers.wordpress.com/?p=22</guid>
		<description><![CDATA[There is one thing that most of us like about those fancy java IDE, the way the mark syntax errors on the fly. Also if you tried something like Intellij IDEA there are a lot more options regarding coding style, java doc checks, etc &#8230; that can be very useful.

If you have been coding C [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jwickers.wordpress.com&blog=1703062&post=22&subd=jwickers&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>There is one thing that most of us like about those fancy java IDE, the way the mark syntax errors on the fly. Also if you tried something like Intellij IDEA there are a lot more options regarding coding style, java doc checks, etc &#8230; that can be very useful.</p>
<p><span id="more-22"></span></p>
<p>If you have been coding C or Java in Emacs you probably already know about <a href="http://www.emacswiki.org/emacs/FlyMake" target="_blank">flymake</a> which basically sends your buffer through a compiler and highlight the warning and errors.</p>
<p>The JDE documentation describes how to use the eclipse compiler (ECJ) to do just that with java files, but here is a few tricks to make it even more useful.</p>
<h3>Tweaking ECJ options</h3>
<p>There are some tweak you can do the ECJ configuration which can help you with two issues:</p>
<p>First, the default configuration would compile your buffer in a temporary directory and then forget about it. This is fine when working on just one file, but if your working on a project then you would be interested on how the changes you are making might effect other files. To do that you would have to give ECJ an output directory for the compiled classes which would be on top of you classpath.</p>
<p>Second, you can customize the warnings from ECJ with some flags.</p>
<p>To find what options are available, run ECJ from the command line:</p>
<pre class="brush: cpp;">java -cp /path/to/ecj.jar org.eclipse.jdt.internal.compiler.batch.Main -?
java -cp /path/to/ecj.jar org.eclipse.jdt.internal.compiler.batch.Main -?:warn</pre>
<p>In Emacs, the options passed to ECJ can be customized using the <strong>jde-ecj-command-line-args</strong> variable.</p>
<p>For example i use something like the following in my project <strong>prj.el</strong> file:</p>
<pre class="brush: cpp;">'(jde-global-classpath (quote (&quot;/my/project/flymake-build&quot; &quot;rest of the class path ...&quot;)))
'(jde-ecj-command-line-args '(&quot;-d&quot; &quot;/my/project/flymake-build&quot; &quot;-1.5&quot; &quot;-referenceInfo&quot; &quot;-enableJavadoc&quot; &quot;-warn:+over-ann,uselessTypeCheck,javadoc&quot;))</pre>
<h3>Integrating flymake with other tools</h3>
<p>Now you would say that IDEs don&#8217;t just perform syntax check (although here ECJ have some style checks as well), so what if you wanted to use an additonal tool for code style analysis?</p>
<p>Flymake itself is very simple, all it does is call a program and parse its output, so it doesn&#8217;t matter if that program is a compiler, a style checker, a spell checker, or a script that would launch all of the above &#8230;</p>
<p>For example, there is a small bash script that call both ECJ and <a href="http://checkstyle.sourceforge.net/" target="_blank">CheckStyle</a> (named <strong>java-check.sh</strong>)</p>
<pre class="brush: cpp;">#!/bin/bash
# Call ECJ compiler and CheckStyle
if [[ ! &quot;$6&quot; ]]; then
    echo &quot;Missing some arguments.&quot;
    exit 1
fi
CLASSPATH=&quot;$1&quot; #project classpath used for compilation, taken from jde classpath setting
ECJ_JAR=&quot;$2&quot;
ECJ_OPTS=&quot;$3&quot; #the customization we talked about earlier
CHECKSTYLE_JAR=&quot;$4&quot;
CHECKSTYLE_CONFIG=&quot;$5&quot; #this would at least contains -c /path/to/checks.xml with configures the checks to perform
TARGET=&quot;$6&quot;
java -cp &quot;${ECJ_JAR}:${CLASSPATH}&quot; org.eclipse.jdt.internal.compiler.batch.Main -Xemacs ${ECJ_OPTS} ${TARGET} 2&gt;&amp;1 | awk '/:[0-9]+:/ {$3 = &quot;ECJ: &quot;$3;print}'
java -cp &quot;${CLASSPATH}&quot; -jar ${CHECKSTYLE_JAR} ${CHECKSTYLE_CONFIG} ${TARGET} | awk '/:[0-9]+:/ {$2 = &quot;warning: CheckStyle: &quot;$2 ; print}' | sed -e 's/:\([0-9]\+\):[0-9]\+:/:\1:/g'</pre>
<p>The arguments will be passed by flymake later on, the awk scripts are mainly to make CheckStyle messages warnings instead of errors, and to add ECJ or CheckStyle tags in the messages so that you can know from which tool the warnings come from.</p>
<p>Now all we need to do is to call it from Emacs with the right arguments:</p>
<pre class="brush: cpp;">; for jde integration with ecj and flymake
(require 'jde-eclipse-compiler-server)
(require 'flymake)

;; flymake for java checkstyle
(defun flymake-java-ecj-checkstyle-init ()
  &quot;Use ECJ and then CheckStyle to check the current java file.&quot;
  (if (not (object-of-class-p (jde-compile-get-the-compiler) 'jde-compile-ejc-server))
      (error &quot;The ecj option for flymake can only be set when the jde-compiler is also set to ecj&quot;)
    (let* ((temp-file   (flymake-init-create-temp-buffer-copy
                         'jde-ecj-create-temp-file))
           (local-file  (file-relative-name
                         temp-file
                         (file-name-directory buffer-file-name))))
    (list &quot;java-check.sh&quot; (append
                                 ; jde classpath
                                 (cdr (jde-compile-classpath-arg (jde-compile-get-the-compiler)))
                                 ; ecj jar file
                                 (list
                                  (oref (jde-compile-get-ejc) path)
                                 ; all ecj options in one string
                                  (reduce #'(lambda (x y) (concatenate 'string x &quot; &quot; y)) jde-ecj-command-line-args)
                                 ; checkstyle jar
                                  &quot;/path/to/checkstyle.jar&quot;
                                 ; checkstyle options
                                  &quot;-c /path/to/checks.xml&quot;
                                 ; target
                                  local-file))))))

(add-to-list 'flymake-allowed-file-name-masks '(&quot;\\.java\\'&quot; flymake-java-ecj-checkstyle-init))</pre>
<p>The last line activates the custom checker for all <strong>.java</strong> files.</p>
<p><strong>Note:</strong> here is a bug in CheckStyle regarding exceptions checks where it would throw a RuntimeError and stop process the file. Be sure to disable the <strong><em>RedundantThrows</em></strong> check in the checks.xml you are using.</p>
<h3>Using flymake with BSH scripts</h3>
<p>If you are working with BeanShell scripts you may have found that even the popular IDEs do not provide much in that area. It is actually very difficult to spot runtime errors in advance since you would use variables assigned in a servlet context.</p>
<p>There is however a basic syntax check that can be done:</p>
<pre class="brush: cpp;">;; flymake for BSH scripts
(require 'flymake)

(defun flymake-bsh-init ()
  &quot;Use BSH to check the syntax of the current file.&quot;
  (let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))
     (local (file-relative-name temp (file-name-directory buffer-file-name))))
    (list &quot;bsh-check.sh&quot;
            (list local ))))

(add-to-list 'flymake-err-line-patterns
  '(&quot;^Exception in thread \&quot;main\&quot; In file: &lt;\\(.*\\)&gt; \\(.*\\) at line \\([0-9]+\\), column \\([0-9]+\\)&quot; nil 3 2))

(add-to-list 'flymake-allowed-file-name-masks '(&quot;\\.bsh\\'&quot; flymake-bsh-init))</pre>
<p>And the bash script (named <strong>bsh-check.sh</strong>):</p>
<pre class="brush: cpp;">#!/bin/sh
java -cp /home/jeremy/programmation/opentaps-1.0-autocomplete-branch/framework/base/lib/scripting/bsh-2.0b4.jar bsh.Parser &quot;$1&quot; 2&gt;&amp;1 | head -n 1</pre>
<p>Note that it is indeed basic and does not spot wrong class names or wrong method names but only syntax issues such as missing closing quotes or brackets &#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jwickers.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jwickers.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jwickers.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jwickers.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jwickers.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jwickers.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jwickers.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jwickers.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jwickers.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jwickers.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jwickers.wordpress.com&blog=1703062&post=22&subd=jwickers&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jwickers.wordpress.com/2008/10/13/tweaking-flymake-for-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/af3f411e9ded3f60427cfa1ccdb7bba8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jwickers</media:title>
		</media:content>
	</item>
		<item>
		<title>weblogger.el Enhanced !</title>
		<link>http://jwickers.wordpress.com/2007/09/20/webloggerel-enhanced/</link>
		<comments>http://jwickers.wordpress.com/2007/09/20/webloggerel-enhanced/#comments</comments>
		<pubDate>Thu, 20 Sep 2007 14:34:41 +0000</pubDate>
		<dc:creator>jwickers</dc:creator>
				<category><![CDATA[emacs]]></category>
		<category><![CDATA[intarweb]]></category>

		<guid isPermaLink="false">http://jwickers.wordpress.com/?p=13</guid>
		<description><![CDATA[Hooray !
After a few hours struggling with parenthesises, I finally managed to patch weblogger.el and xml-rpc.el to have those critical missing functionalities.
Now the default is to post as &#8220;Draft&#8221; when i use C-c C-n or C-c C-p so i can just prepare some text and save it for later. Changing publish state should be done [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jwickers.wordpress.com&blog=1703062&post=13&subd=jwickers&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hooray !</p>
<p>After a few hours struggling with parenthesises, I finally managed to patch weblogger.el and xml-rpc.el to have those critical missing functionalities.</p>
<p>Now the default is to post as &#8220;Draft&#8221; when i use <b>C-c C-n</b> or <b>C-c C-p</b> so i can just prepare some text and save it for later. Changing publish state should be done explicitly with <b>C-x C-s</b> which calls the weblogger-publish-entry function, for not changing it <b>C-c C-c</b>.<br />
Note that i said changing the published state, because at least on WordPress it switches from Draft to Published but also from Published to Draft with <b>C-x C-s</b> &#8230; i am unsure about the behaviour of other APIs.</p>
<p>I will have to do some work on this latter this week end &#8230;</p>
<p>Most importantly is the support for categories. It now display the categories in the header as &#8220;Keywords:&#8221; which you can set to one or many as a &#8220;, &#8221; separated list. For example this post is &#8220;Keywords: Emacs, intarweb&#8221;.<br />
The only thing i don&#8217;t see how to implement right now is auto-completion for the category names. Perhaps an emacs guru could have a look &#8230;</p>
<p>Another *minor* issue is that the API doesn&#8217;t provide any way to create new categories, which means that i *will* have to go on that slow web interface just for that. But how often do i need to change my categories anyway ?</p>
<p>Finally, on the would-be-nice list are clickable links in the header that open the preview page or post page. The URL is there, it just lack some hook in Emacs. Then attachment processing &#8230; the API seems to support it. </p>
<p>I also thought of markup support, but i guess it should just be installed in the blog site, processing &#8220;markup X&#8221; to HTML to &#8220;markup X&#8221; seems to be the perfect way to invoke Cthulhu bugs. So i would rather have mmm-mode support and use Emacs HTML capabilities.<br />
I found that i almost don&#8217;t need HTML, at least on WordPress and for &#8220;just text&#8221; posts, because it formats paragraphs nicely without P tags.</p>
<p>This time the files are uploaded in <a href="http://jwickers.wordpress.com/emacs-hacks/">my Emacs Hacks</a> page.</p>
<p>Happy blogging !</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jwickers.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jwickers.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jwickers.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jwickers.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jwickers.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jwickers.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jwickers.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jwickers.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jwickers.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jwickers.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jwickers.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jwickers.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jwickers.wordpress.com&blog=1703062&post=13&subd=jwickers&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jwickers.wordpress.com/2007/09/20/webloggerel-enhanced/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/af3f411e9ded3f60427cfa1ccdb7bba8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jwickers</media:title>
		</media:content>
	</item>
		<item>
		<title>KBlogger and Emacs weblogger</title>
		<link>http://jwickers.wordpress.com/2007/09/14/kblogger-and-emacs-weblogger/</link>
		<comments>http://jwickers.wordpress.com/2007/09/14/kblogger-and-emacs-weblogger/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 17:07:27 +0000</pubDate>
		<dc:creator>jwickers</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[intarweb]]></category>

		<guid isPermaLink="false">http://jwickers.wordpress.com/2007/09/14/kblogger-and-emacs-weblogger/</guid>
		<description><![CDATA[Last week I found that even WordPress was difficult to access from my home, especially the web interface &#8230; so I decided to start looking for a blog software.
Being a KDE user I naturally went to kde-apps and found KBlogger. This application is a Kicker applet which appears as a big &#8220;Blog&#8221; button.
Setting it up [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jwickers.wordpress.com&blog=1703062&post=6&subd=jwickers&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Last week I found that even WordPress was difficult to access from my home, especially the web interface &#8230; so I decided to start looking for a blog software.</p>
<p>Being a KDE user I naturally went to kde-apps and found KBlogger. This application is a Kicker applet which appears as a big &#8220;Blog&#8221; button.<br />
Setting it up was not too difficult but I had to find out that the URL of the blog is not enough, it needs to be pointed to xmlrpc.php.</p>
<p>In term of features it offers:</p>
<ul>
<li> fetching categories</li>
<li>fetching your post for edit or deletion</li>
<li>posting as draft or published</li>
</ul>
<p>Unfortunately I couldn&#8217;t stand with:</p>
<ul>
<li>the &#8220;Blog&#8221; button takes too much room in my task-bar</li>
<li>have to right click to have the list of posts .. then wait will it downloads from the server</li>
<li>there is no caching</li>
<li>if I press ESC in a dialog it cannot re-open any dialog, I have to remove and add the applet again</li>
<li>no spell checking (Qt spell checking is said to mess with the output)</li>
</ul>
<p>Also since I just started to get along with Emacs, finally, I decided I would give at chance too. So I downloaded weblogger from <a href="http://savannah.nongnu.org/projects/emacsweblogs" target="_blank">savannah</a> and applied to patches from <a href="http://www.emacswiki.org/cgi-bin/wiki/WebloggerMode" target="_blank">emacswiki</a>.</p>
<p>Unlike other Emacs features, this one was very easy to setup. The documentation on Emacs Wiki gives you the one or two commands you need and in 2 minutes I had all my entries fetched in Emacs.<br />
So compared to KBlogger, it is very fast because it caches the posts and it supports Emacs spell checking. Since I am always in Emacs anyway writing a Blog post is just a shortcut away. It also makes posting code snippets or writing as you are coding very easy.</p>
<p>Unfortunately it doesn&#8217;t support categories yet, and attachments didn&#8217;t work &#8230;</p>
<p>Also the version I had didn&#8217;t work with WordPress very well, it could not upload the edited posts. I tracked down the issue to the format of the post date. Looks like WordPress is expecting a dateTime.iso8601 but receiving a string, a quick hack later and everything works as expected.</p>
<p>If I have time, I might just look into the category feature. It should not be too difficult anyway.</p>
<p>PS: I&#8217;ve attached the patched files. They include the patches from EmacsWiki that were needed, plus my own: dateTime format, and i escape strings in CDATA rather than url encoding (at first I thought the problem came from url encoding).</p>
<p><a href="http://jwickers.files.wordpress.com/2007/09/xml-rpcel.doc" title="patched xml-rpc.el">patched xml-rpc.el</a></p>
<p><a href="http://jwickers.files.wordpress.com/2007/09/webloggerel.doc" title="patched weblogger.el">patched weblogger.el</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jwickers.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jwickers.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jwickers.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jwickers.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jwickers.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jwickers.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jwickers.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jwickers.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jwickers.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jwickers.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jwickers.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jwickers.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jwickers.wordpress.com&blog=1703062&post=6&subd=jwickers&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jwickers.wordpress.com/2007/09/14/kblogger-and-emacs-weblogger/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/af3f411e9ded3f60427cfa1ccdb7bba8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jwickers</media:title>
		</media:content>
	</item>
	</channel>
</rss>