<?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>noorul islam :: my thoughts &#187; emacs</title>
	<atom:link href="http://noorul.com/blog/category/emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://noorul.com/blog</link>
	<description>gnu/linux, emacs and random thoughts</description>
	<lastBuildDate>Wed, 01 Aug 2012 02:24:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Setup org2blog for blogging from emacs.</title>
		<link>http://noorul.com/blog/2011/09/12/setup-org2blog-for-blogging-from-emacs/</link>
		<comments>http://noorul.com/blog/2011/09/12/setup-org2blog-for-blogging-from-emacs/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 07:29:00 +0000</pubDate>
		<dc:creator>noorul</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[orgmode]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://noorul.com/blog/?p=122</guid>
		<description><![CDATA[org2blog is written by Puneeth Chaganti. It is an emacs extension to post org mode sub trees as wordpress blog entries. In order to set this up clone the repository from github. # clone org2blog git repository git clone http://github.com/punchagan/org2blog.git Add the following snippet to ~/.emacs (add-to-list 'load-path "~/site-lisp/org2blog") (require 'org2blog-autoloads) (setq org2blog/wp-blog-alist '(("noorul.com" :url [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/punchagan/org2blog">org2blog</a> is written by <a href="http://github.com/punchagan">Puneeth Chaganti</a>. It is an emacs extension to post org mode sub trees as wordpress blog entries. In order to set this up clone the repository from github. </p>
<pre class="src src-sh"><span style="color: #ff7f24; font-style: italic;"># </span><span style="color: #ff7f24; font-style: italic;">clone org2blog git repository</span>
git clone http://github.com/punchagan/org2blog.git
</pre>
<p> Add the following snippet to ~/.emacs </p>
<pre class="src src-emacs-lisp"><span style="color: #7f7f7f;">(</span>add-to-list 'load-path <span style="color: #ad7fa8;">"~/site-lisp/org2blog"</span><span style="color: #7f7f7f;">)</span>
<span style="color: #7f7f7f;">(</span><span style="color: #00ffff; font-weight: bold;">require</span> '<span style="color: #73d216;">org2blog-autoloads</span><span style="color: #7f7f7f;">)</span>

<span style="color: #7f7f7f;">(</span>setq org2blog/wp-blog-alist
       '<span style="color: #7f7f7f;">((</span><span style="color: #ad7fa8;">"noorul.com"</span>
          <span style="color: #729fcf;">:url</span> <span style="color: #ad7fa8;">"http://noorul.com/blog/xmlrpc.php"</span>
          <span style="color: #729fcf;">:username</span> <span style="color: #ad7fa8;">"admin"</span>
          <span style="color: #729fcf;">:tags-as-categories</span> t<span style="color: #7f7f7f;">)))</span>
<span style="color: #7f7f7f;">(</span>org2blog/wp-login<span style="color: #7f7f7f;">)</span>
</pre>
<p> Then I can go to the entry and call M-x org2blog/wp-post-subtree to post a draft or C-u M-x org2blog/wp-post-subtree to publish it. </p>
]]></content:encoded>
			<wfw:commentRss>http://noorul.com/blog/2011/09/12/setup-org2blog-for-blogging-from-emacs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Orgmode &#8211; Generate custom report using external python script.</title>
		<link>http://noorul.com/blog/2010/07/18/orgmode-generate-custom-report-using-external-python-script/</link>
		<comments>http://noorul.com/blog/2010/07/18/orgmode-generate-custom-report-using-external-python-script/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 04:09:23 +0000</pubDate>
		<dc:creator>noorul</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[orgmode]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://noorul.com/blog/?p=78</guid>
		<description><![CDATA[I use orgmode in emacs as a to-do list manager. End of every week I send my status report to the team. Earlier I used to do this manually by going through the agenda for the week and collecting relevant information. I thought of automating it since this is repeated every week. It was super [...]]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://orgmode.org">orgmode</a> in emacs as a to-do list manager. End of every week I send my status report to the team. Earlier I used to do this manually by going through the agenda for the week and collecting relevant information. I thought of automating it since this is repeated every week. </p>
<p>It was super easy for me because, I strictly associate each task with a corresponding tag to uniquely identify it. These tags are related to my office projects and the script is a custom one which suits my requirement. </p>
<p>Here is the emacs part.</p>
<pre>
(defun noorul/gen_weekly_report (startPos endPos)
  "Generate weekly report using external pythong script"
(interactive "r")
  (let (scriptName)
    (setq scriptName "~/work/python/gen_weekly_report.py")
    (shell-command-on-region startPos endPos scriptName "*Weekly Report*" 
			     nil nil t)
    ))

(global-set-key (kbd "&lt;f6&gt; r") 'noorul/gen_weekly_report)
</pre>
<p>Here is the python supporting script.</p>
<pre>
#!/usr/bin/env python
import sys
import re

report_dict = {}
cubit_issue_id_regex = re.compile('.*(cubit\d+):.*$')
artf_issue_id_regex = re.compile('.*(artf\d+):.*$')
issue_desc_regex = re.compile('.*(WAITING|DONE|NEXT) (.*) :.*$')
for line in sys.stdin.readlines():
    id_match = re.match(cubit_issue_id_regex, line)
    if not id_match:
        id_match = re.match(artf_issue_id_regex, line)
    if id_match:
        issue = id_match.groups()[0]
        issue_desc = ''
        desc_match = re.match(issue_desc_regex, line)
        if desc_match:
            issue_desc = desc_match.groups()[1]
            if issue not in report_dict.keys():
                report_dict[issue] = issue_desc

print 'This Week:\n'
for issue in sorted(report_dict.keys()):
    print '* %-10s: %s' % (issue,  report_dict[issue])
</pre>
<p>Now to collect my report, all what I have to do is, go to the agenda buffer switch to log mode and mark the week area and press &#8216;F6 r&#8217;.</p>
<p>I think I can avoid the region marking step and that will be an enhancement.</p>
]]></content:encoded>
			<wfw:commentRss>http://noorul.com/blog/2010/07/18/orgmode-generate-custom-report-using-external-python-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filtering IMAP mails using imapfilter</title>
		<link>http://noorul.com/blog/2010/07/09/filtering-imap-mails-using-imapfilter/</link>
		<comments>http://noorul.com/blog/2010/07/09/filtering-imap-mails-using-imapfilter/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 02:57:11 +0000</pubDate>
		<dc:creator>noorul</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail]]></category>

		<guid isPermaLink="false">http://noorul.com/blog/?p=59</guid>
		<description><![CDATA[I use gnus to read my mails. Gnus is a very powerful emacs tool. Basically we don&#8217;t require a client side filtering system if one is provided by the server like Google Mail. But we do require one if the server is not supporting filtering mechanism. Initially I was using inbuilt filtering system from gnus. [...]]]></description>
			<content:encoded><![CDATA[<p>I use gnus to read my mails. <a href="http://gnus.org">Gnus</a> is a very powerful emacs tool. Basically we don&#8217;t require a client side filtering system if one is provided by the server like <a href="http://gmail.com">Google Mail</a>. But we do require one if the server is not supporting filtering mechanism.</p>
<p>Initially I was using inbuilt filtering system from gnus. Since I run <a href="http://www.gnu.org/software/emacs/">emacs</a> all the time on my machine and the filtering mechanism was interfering with my editing task, I thought of decoupling the same from Gnus. Google helped me to find <a href="http://imapfilter.hellug.gr/">imapfilter</a> which is a very powerful tool.</p>
<h3>Getting imapfiler</h3>
<p>You can download the software from here <a href="http://imapfilter.hellug.gr/">http://imapfilter.hellug.gr/</a>.</p>
<h3>Installing</h3>
<p>You can compile and install the program from the sources by typing:</p>
<pre>tar -zxvf imapfilter-x.y.z.tar.gz
cd imapfilter-x.y.z
make
make install</pre>
<h3>Configuring</h3>
<p>imapfilter uses lua as extension language. Here is an example ~/.imapfilter/config.lua<br />
You can configure multiple mail accounts. Since I have only one<br />
non-gmail account I have not tried that. The syntax is self explanatory.</p>
<ul>
<li> Define an account like this.</li>
<pre>    account1 = IMAP {
    server = 'your.exchage.server.com',
    username = 'username',
    password = 'reallysecret',
    ssl = 'ssl3'
}
</pre>
</ul>
<ul>
<li> Filter messages based on different header fields like this.</li>
<pre>msgs = account1.INBOX:contain_field('To', 'x-mailing-list@mail.com')
msgs = account1.INBOX:contain_field('Subject', 'Joke')
msgs = account1.INBOX:contain_field('From', 'support@bank.com')</pre>
<p>You can use complex filters like</p>
<pre>       msgs = account1.INBOX:contain_field('To', 'y-mailing-list@mail.com') +
       account1.INBOX:contain_field('Cc', 'y-mailing-list@mail.com')</pre>
</ul>
<ul>
<li> Perform an action on the filters messages</li>
<pre>account1.INBOX:move_messages(account1['x-mailing-list'], msgs)</pre>
</ul>
<ul>
<li> If we combine everything into a function.</li>
<pre>    function sortMail()
    options.timeout = 120
    options.subscribe = true                                                    

    account1 = IMAP {
        server = 'your.exchage.server.com',
        username = 'username',
        password = 'reallysecret',
        ssl = 'ssl3'
    }                                                                           

    msgs = account1.INBOX:contain_field('To', 'x-mailing-list@mail.com')
    account1.INBOX:move_messages(account1['x-mailing-list'], msgs)
    msgs = account1.INBOX:contain_field('Subject', 'Joke')
    account1.INBOX:move_messages(account1['jokes'], msgs)
    msgs = account1.INBOX:contain_field('From', 'support@bank.com')
    account1.INBOX:move_messages(account1['bank'], msgs)

    msgs = account1.INBOX:contain_field('To', 'y-mailing-list@mail.com') +
           account1.INBOX:contain_field('Cc', 'y-mailing-list@mail.com')
    account1.INBOX:move_messages(account1['y-mailing-list'], msgs)
end                                                                             

become_daemon(300, sortMail)</pre>
</ul>
<p>Now we have a simple complete imapfilter config.lua. This file should<br />
reside in ~/.imapfilter/ folder. This is the default location.</p>
<h3>Executing imapfilter</h3>
<p>Just run the following command. The option -l is used to specify log file.</p>
<pre>imapfilter -l /tmp/imapfilter.log</pre>
<h3>Trouble</h3>
<p>I had one issue with imapfilter so far. Sometimes the program terminates because of some protocol handling issue with the exchange server. So I have a script watch_imapfilter.sh added to crontab to monitor imapfilter process.</p>
<pre>#!/bin/sh                                                                       

result=`pgrep imapfilter`
if [ $result ]
then
        echo "imapfilter is already running"
else
        echo "imapfilter is not running"
        echo "Starting imapfilter...."
        /usr/local/bin/imapfilter -l /tmp/imapfilter.log
fi</pre>
<p>And the crontab entry looks like this.</p>
<pre># m h  dom mon dow   command
*/1 * * * *          /home/noorul/bin/watch_imapfilter.sh &gt;/dev/null 2&gt;&amp;1</pre>
<h3>Further reading</h3>
<p>The <a href="http://imapfilter.hellug.gr/imapfilter.1.txt">imapfilter</a> and <a  href="http://imapfilter.hellug.gr/imapfilter_config.5.txt">imapfilter_config</a> manual pages are available online.</p>
]]></content:encoded>
			<wfw:commentRss>http://noorul.com/blog/2010/07/09/filtering-imap-mails-using-imapfilter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Compiling emacs-unicode from cvs on debian etch.</title>
		<link>http://noorul.com/blog/2008/05/25/compiling-emacs-unicode-from-cvs-on-debian-etch/</link>
		<comments>http://noorul.com/blog/2008/05/25/compiling-emacs-unicode-from-cvs-on-debian-etch/#comments</comments>
		<pubDate>Sun, 25 May 2008 07:42:32 +0000</pubDate>
		<dc:creator>noorul</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs+23]]></category>
		<category><![CDATA[emacs+unicode]]></category>
		<category><![CDATA[emacs+unicode+make]]></category>
		<category><![CDATA[gnu+emacs]]></category>
		<category><![CDATA[unicode+emacs]]></category>

		<guid isPermaLink="false">http://noorul.wordpress.com/?p=5</guid>
		<description><![CDATA[Emacs-22+ doesn&#8217;t support Xft fonts, hence the look and feel of emacs on X-Windows is not that good. But development is going on to provide this feature in emacs. The emacs-unicode-2 branch for emacs has this feature, hopefully this will get integrated to emacs-23. I followed the following steps to compile emacs-unicode from CVS. 1. [...]]]></description>
			<content:encoded><![CDATA[<p>Emacs-22+ doesn&#8217;t support Xft fonts, hence the look and feel of emacs on X-Windows is not that good. But development is going on to provide this feature in emacs. The emacs-unicode-2 branch for emacs has this feature, hopefully this will get integrated to emacs-23.</p>
<p>I followed the following steps to compile emacs-unicode from CVS.</p>
<p>1. Checkout latest source for emacs-unicode.</p>
<pre>
cd /opt
cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co -r emacs-unicode-2 emacs
</pre>
<p>2. I had a problem with NSTATICS constant in emacs/src/alloc.c when compiling. I think you might face the same problem. You have to change the value of this constant. You have to look for the definition of this constant in emacs/src/alloc.c. I did the following. May be a lower value will also work. Commented the existing definition and added mine.</p>
<pre>
/* #define NSTATICS 1280 */
#define NSTATICS 2048
</pre>
<p>3. Now use configure script to generate make files.</p>
<pre>
cd /opt/emacs
./configure  --with-gtk --enable-font-backend --with-xft  --with-freetype
</pre>
<p>4. At last the make command</p>
<pre>
make bootstrap
</pre>
<p>It took around 5 hours for me to figure out the NSTATICS problem. I hope this will help some of you. If this helps any one of you then drop me a mail. I will be happy.</p>
]]></content:encoded>
			<wfw:commentRss>http://noorul.com/blog/2008/05/25/compiling-emacs-unicode-from-cvs-on-debian-etch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
