Skip to main content

Posts about orgmode (old posts, page 1)

Org-mode Workshop

Well, I'm not sure if it's worth writing about. I conducted my first org-mode workshop along with Prof. Venkatesh Choppella at IIIT-Hyderabad. It was a 3 hour demo+talk kind of a thing, with a small audience of about 20 people, most of whom were new to Emacs.

We covered almost all the aspects of Org-mode after giving a brief introduction to Emacs. Outlining and note-taking part was simple and easy to understand, but the audience couldn't really appreciate the part of keeping TODO lists and agendas and other stuff. I'm hoping, the reason was not me taking over from Venkatesh.

I think the workshop should've been more hands-on and we should've asked people to try out stuff on the spot, instead of showing off the things possible with Emacs. They probably would've appreciated a few things better, that way.

Hopefully, we will be doing more workshops on Org-mode and there are surely somethings to take away from this one. I hope at least one of the participants, gets hooked to Org-mode.

The talk outline is here.

Git powered wikis improved: My bit

I accidentally came across the blog-post Git-powered wikis improved - GitHub. And this particular paragraph caught my eye:

The new editor has the capability to support every markup language that GitHub Wikis support. If you're a fan of Markdown, Textile, pod or RDoc, the function bar buttons (e.g. bold, italic, underline, etc.) will now work. We've even written brand new inline help for many of GitHub Wiki's supported markup languages.

The language definitions the editor uses are JSON-based and easy to edit. If you'd like us to support a markup language that we don't currently support, Gollum, GitHub's wiki software, is entirely open source – fork our code and send us a pull request with changes that support your choice language.

I sent a quick patch for org-mode in the function bar, and it has been accepted. :)

If not anything more, I hope, at least a couple of curious people will explore org-mode and find it useful.

CHAGANTI 635888 Emacs

Puneeth Chaganti, hereby agrees as follows:

Developer hereby agrees to assign and does hereby assign to FSF Developer's copyright in changes and/or enhancements to the suite of programs known as GNU EMACS, including any accompanying documentation files and supporting files as well as the actual program code.

Yay! I can now write code, that can go into Org-mode and Emacs! I'm looking forward to this!

Changes to Blog

Well, as you can see, I've changed my blog a bit. I had been trying to make it gel well with org-mode and looking for ways to allow me to share arbit stuff with separate feeds for tags, separate pages with independent feeds, etc.

I finally got around to tweaking the code of reprise to be able to do this. There are still a few things I would like to change, but I'll make the changes gradually. The looks are also straight from uddegal's [[reprise, with a few tiny tweaks. I hope it is alright to be using it. I really liked the theme.

Every tag now has a separate feed. /tags/emacs.atom will give you the feed of emacs for instance. Also, I plan to have a couple of more pages, one for all the interesting links I come across and another for interesting quotes. Both of these pages, have their own feeds too (quotes.atom and links.atom).

In the spirit of minimalism, I got rid of comments. I've been looking for ways of having comments without all the javascript cruft from disqus, but I didn't find any satisfactory way to do this. So, the site will have no comments. You can write to me, in case you've something to say to me.

Adios.

Why I like Org as a markup

Org-mode, as a mode, is obviously awesome. The ability to move around whole blocks of text, for re-organizing documents and the usability of tables are just two brilliant features.

But, the org markup itself is such a cool thing. I've been looking at rst all day, and it's such a pain to find out where your headings are, what level your current sub-heading is at, etc. (I'll probably do a bit better, with some getting used to. I'm an org-addict. ;)). With org-mode it's so intuitive! It's so easy to find out, with just one quick look! I don't think any other markup has this coolness! Org-mode FTW!

Pandoc can now do Org

Pandoc is a haskell library and a command line tool, that can convert markup from one to another and it does it pretty well. Until now it supported quite a few markups, but not orgmode. But now, Orgmode support has been added! Yay!

But, it can only read from other formats and write to org-mode format. The other way around, is not possible, but you can do that straight from org-mode, right?

I've often felt the need for an org-importer and hence decided to do something about it. I stumbled upon Pandoc, when I was moving my blog, and found it pretty neat. After, yet another request for an importer, on the org-mode mailing list, I decided to look at Pandoc. I was somehow under the impression that it was written in Python. But it turned out, I had to learn Haskell! A good excuse to learn a new language, eh? I brushed through a tutorial for a couple of days (and was blown off by the paradigm of the language) and was able to port the RST writer in Pandoc, to an Org writer. :)

You can get the latest version from here

WP to org-mode + hyde + disqus

Hello World!

My first post at my new home. Obviously, it was going to be about the move. You knew it, didn't you? ;)

Well, I got some space on the web, along with a few friends. Thanks to my org-mode fanboyism, I now use it to maintain my homepage. I've successfully completed import of my Wordpress posts and comments. :)

I now use

  • Emacs and Org-mode 1 to write my posts.
  • org-hyde.el 2 to publish html in a hyde parse-able format.
  • hyde 3 to convert the html pages into a blog.
  • org-publish to publish other pages in my home page.
  • git 4 and a bash script for publishing.
  • Disqus 5 for the comment system.

Yes, I know it sounds rather complicated. :) But, now that I have it set up, it's not all that difficult to make a post. It's just a matter of one git commit and push. I need to fine-tune the shell script a bit, though.

How I moved

The move definitely wasn't trivial. I guess, I could've started afresh but, what fun would that have been? ;)

This roughly how I did things – in the order that I did them.

Choosing hyde

I looked at a handful of options to maintain a blog, using org-mode — blorg, org-jekyll, blorgit, ikiwiki. After some assessment, I decided upon org-jekyll and jekyll. But then, I accidentally stumbled upon hyde.

I decided to go with hyde instead of jekyll 6 since

  1. It's in Python. I didn't want to start figuring out Ruby, now.
  2. It uses Django templates 7. And Django is something, I wish to learn. I've started with that. :)

Clean up org-jekyll to work with hyde.

I then "ported" org-jekyll.el into org-hyde.el.

  • removed stuff like categories and languages, that I was not going to use.
  • Added some code w.r.t timestamps, from org2blog, to it, so that my older org2blog posts could be easily ported.

Clean up older org2blog posts

org2blog can post either buffers or subtrees. I had posts in both formats. I converted all of them into subtrees of one tree, using some Python.

Import older posts

This was the most painful posts. Importing all the old posts from Wordpress. org-mode really needs a XHTML/XML importer!

I did all sorts of crazy stuff to get this done.

  • used pandoc to convert html to markdown
  • wrote some throw away regex code to convert markdown to org-mode.
  • wrote more regex code to convert html to org-mode.
  • hacked up a lot of stuff and finally got all the posts into org format! :)

A workflow for publishing

Set up git along with some bash code, to have a mechanism to minimize the effort in making a blog post. All this is still a lot of work, compared to the ease with which I used to use org2blog. That's partly due to ssh restrictions in my hostel.

CSS clean-up

I'm using the same CSS for org-mode published files and hyde published files. I had to clean up my hyde templates and the CSS to make both of them look similar.

My first tryst with CSS hasn't been all that bad. :)

Installing disqus and importing comments

Using disqus was one thing, I wasn't sure I wanted to do. I would've loved it if comments could be managed with org-mode too. ;) 8

Anyway, I finally decided to go with it, and I'm quite happy with it. :)

I loved the ease with which comments could be imported.

  1. Import Wordpress comments using the export xml file.
  2. Generate a CSV file containing the URL map – mapping the newer urls to the older ones.
  3. Upload the CSV file and tada!

Conclusion

I got to learn quite a few things, during all of this. I also have some bits of code, that I can share with you, in case you are interested. Leave a comment, if you wish. :)

I'm just hoping to reduce the additional steps required in publishing to ensure it doesn't add to my already erratic blogging habits.

Footnotes:

1

Org-mode - Homepage

2

Org-hyde is a port of org-jekyll.el

3

Hyde - Github

4

Git - Homepage

5

Disqus - Homepage

6

Github - Jekyll

7

Documentation - Django Templates

8

I feel it is capable of doing that. It's just my incapability that prevented me from trying it out.

Some fun from #org-mode

This is a conversation from #org-mode, published without permission from plovs, BerntH and bremner. If any of you want any of the content removed, I will do so.

<punchagan> hi all

<BerntH> hi punchagan [18:36]

<punchagan> BerntH: ever used/tried blorg or blorgit? [18:47]

<punchagan> I like the way org-publish works, but blorg exports one org file as a blog. If blorg were to be re-written on top of org-publish, how should it be done? use one file per post or just one file for the whole blog? [18:52]

<bremner> punchagan: another option is to use ikiwiki and use the org-mode plugin to render pages. This is what i do, although only a bit of the site is in org. [19:44]

<punchagan> bremner: can I have a look at your site? [19:45]

<bremner> sure, it ain't pretty, but: www.cs.unb.ca/~bremner [19:46]

<punchagan> thanks. I'll keep this in mind. [19:47]

<punchagan> I just loved the way this site looks and behaves – http://julien.danjou.info/projects.html

<bremner> well, the side bar at least is possible with ikiwiki. Other than that I suppose it is mainly a matter of css [19:48]

<BerntH> punchagan: nope [19:49]

<punchagan> ok BerntH [19:50]

<plovs> punchagan ikiwiki does have an org-mode plugin [19:56]

<punchagan> plovs: yes, bremner told me that and I've seen on Worg too. :)

<plovs> punchagan ah, yes, sorry

<punchagan> plovs: it's alright. [19:59]

<plovs> punchagan another possibility is org2blog, which uses wordpress

<punchagan> plovs: I'm the author of it. :D

<plovs> lol, ik, that punchagan [20:17]

<punchagan> lol

<punchagan> plovs: were you kidding? or serious? [20:19]

<plovs> punchagan sorry to say i was serious, but it will not happen again :-)

<plovs> i really like org2blog, played with it yesterday

<punchagan> plovs: no. I was just wondering if you were playing around with me. :P

<punchagan> I'm happy some one thinks it is useful.

<plovs> lol, no, i just didn't recognized your name, although it is kind of hard to miss [20:21]

<punchagan> I hope you don't mind, if I make this anecdote public?

org/elisp - sorting list of org-links on description

A small utility function that I used to sort the names of people who commented on my blog.

(defun org-get-link-desc-from-list ()
  """ Get link description of a list item containing just links """
  (let* ((item-beg (point))
       (item-end (org-end-of-item))
       (cur-item (buffer-substring-no-properties
		  item-beg item-end)))
    (goto-char item-beg)
    (org-columns-compact-links cur-item)))

sort-lines wasn't good enough for me, since it was sorting alphabetically and it ended up being the sorted order of the urls and not the names. This function, when used with org-sort-entries-or-items gave me what I wanted.

Thanks to benny (on #org-mode), I also learnt the difference between let and let*.

Refile to date-tree

Useful to refile notes to the journal file, which is a date-tree. org-refile isn't convenient to refile stuff to a date-tree.

(defun my/org-refile-to-journal ()
  "Refile an entry to journal file's date-tree"
  (interactive)
  (require 'org-datetree)
  (let ((journal (expand-file-name "journal.org" org-directory))
	post-date)
    (setq post-date (or (org-entry-get (point) "TIMESTAMP_IA")
			(org-entry-get (point) "TIMESTAMP")))
    (setq post-date (nthcdr 3 (parse-time-string post-date)))
    (setq post-date (list (cadr post-date)
			  (car post-date)
			  (caddr post-date)))
    (org-cut-subtree)
    (with-current-buffer (or (find-buffer-visiting journal)
			     (find-file-noselect journal))
      (save-excursion
	(org-datetree-file-entry-under (current-kill 0) post-date)
	(bookmark-set "org-refile-last-stored")))
    (message "Refiled to %s" journal))
  (setq this-command 'my/org-refile-to-journal))

(defun my/org-agenda-refile-to-journal ()
  "Refile the item at point to journal."
  (interactive)
  (let* ((marker (or (org-get-at-bol 'org-hd-marker)
		     (org-agenda-error)))
	 (buffer (marker-buffer marker))
	 (pos (marker-position marker)))
    (with-current-buffer buffer
      (save-excursion
	(save-restriction
	  (widen)
	  (goto-char marker)
	  (org-remove-subtree-entries-from-agenda)
	  (my/org-refile-to-journal)))))
  (org-agenda-redo))

(org-defkey org-agenda-mode-map (kbd "C-c C-S-w") 'my/org-agenda-refile-to-journal)
(org-defkey org-mode-map (kbd "C-c C-S-w") 'my/org-refile-to-journal)

Enjoy!

Update [2016-06-16] Raam Dev pointed me to an issue and a suggested fix, that I have updated the above code with.