Changing the default font in Emacs

Josh Stella wrote a delightful post about how he uses Emacs, not necessarily for development work. I found quite a few configuration tips, and already implemented few of them. One of those tweaks is using the Input font family. Visiting fontbureau made me want this font too!

I thought it will be as simple as copy-paste (I’m still not used to the appropriate kill-yank terminology) Josh’s configuration. It wasn’t – after reloading my init, the font didn’t pick up.

Few experimentations later, though, and it did work. First, I had to download and install the font in my mac, dahhh… Then, I had to modify the name of the font (Josh used InputSerif; I had to change it to Input). Here’s my configuration:

;; set up fonts for different OSes. OSX toggles to full screen.
(setq myfont "Input")
((string-equal system-name "ygilad.local")
 (set-face-attribute 'default nil :font myfont :height 144)

Indeed, it looks beautiful. Here’s a screen grab of this post in Input: emacs_with_input_font.png

There’s still one problem – this modification to my config broke the org-reader plugin, and I can’t export my org files to Pelican. Sadly, I’ll have to resort to the default font (Menlo), until I figure out a fix.

Leap Into The Past – IRC

So we’re living in the future, yet I’m traversing the past. It started with this blog, when I decided to build it from scratch rather than using one of the modern blogging platforms, such as WordPress and tumblr. Not only that, but I also insisted on writing it in pure, static HTML. No real-time rendering, no dynamic libraries, no Ajax nor server-side scripts. Just HTML, CSS and a little of JavaScript.

Then, I stopped using Evernote and started to manage my life with plain text files. That transition opened the door to a search for a new text editor. New is just a figure of speech, because in the course of that search I fell under the spells of Emacs and Vim, two of the oldest pieces of software out there.

And now, I’m taking another step into the past, to the Internet’s cave era. Instead of embracing Twitter or Reddit (although Reddit do start to win me over), I resorted to… IRC.

I won’t get into why I’ve started to use IRC, or what I find in it that I don’t in modern social networks; I’ll do it in a different post. I’ll just note that I’m starting a new journey, a journey of learning. I have no idea how to navigate and use IRC, let alone how follow its protocols (technical and communal). I’ll have to RTFM

But the journey I ought taking, is also what attracts me to IRC and all those archaic beasts. They come with manuals, and I, a simple user, has to surrender my time and my mind to them, and learn. Read manuals upon manuals, posts, email lists and discussion boards. Follow the rules of communication, listen and learn how to interact before pressing to transmit. Only then, after substantial amount of time, will I feel comfortable using the basics of the said app\software. Years will pass by before I will be able to take full advantage of it. It might not happen during these life, though, so I must be a good servant for a chance to see the light in the after life.

Yeah, there is something magical, almost religious, with those apps, their communities and the philosophies behind them. There is something special in learning, and committing to them. If not the efficiency gain, then at least the resistance to the modern world that do anything to dummify my mind for attention.

But I’ve drifted too far already. I suspect the imminent next step will be to move this site to a BBS

Developer for a day

Earlier today I demoed a simple search page that I developed as part of a 24 hour hackathon here at Outbrain. What makes this search page unique is that it uses the Sphere platform1 to find content that isn’t only relevant to the search query, but also caters to the user’s interests. So, for example, if I search for “python”, I’ll get articles about python, the programming language. If my mom, on the other hand, do the same search, she’ll get articles like this one.

But what I developed isn’t the subject of this article (I might write about it in a separate post). What I do want to share is my experience at putting a developer hat for a day. As a product manager, who works very closely with engineers, this turned out to be an invaluable lesson.

I had no intention of building anything in that hackathon. My plan was to help and support the hacking teams2. A few minutes after the hackathon began, though, I thought it will be cool to build this search page. Unfortunately, at that point there were no developers around to whom I could pitch my idea. All of them were already assigned to other teams. But I got this impulse to build something, so I decided to challenge my lack of development skills, and form a team of one.

Well, saying that I’m not a developer isn’t entirely true. Afterall, I graduated as a software engineer, I understand technology, I can speak intelligently about software architecture and design patterns, and I was intimately involved in designing and building the Sphere platform. I even do some coding in my spare time3. But, I’ve never coded with a mission or under a strict deadline. So I thought, this would be an opportunity to get serious about coding. Indeed, serious I became, spending the next 24 hours (minus 6 hours of sleep) hacking my way toward something I’ll be proud to present.

Here’s how my next 24 hours have looked like:

10:20am – 20 minutes into the hackathon I’m having this idea, and yada yada yada I decide to code.

10:40am – I can see what the architecture of the solution should look like, and what APIs I’ll have to use. It’s going to be easier than I thought…

11:30am – Hitting a dead-end. My initial approach won’t work, because I don’t have access, from the environment I’m using, to the API I rely on. Need to think of a new direction.

12:00pm – Found a new direction. I’m not sure it’s the right one, and I’ll have to learn a framework that I didn’t use before (well, I didn’t use any framework before…), but I’m running out of options, so I’m taking the chance. I find a tutorial, and hope to learn everything I need to know before the hackathon is over.

1:30pm – Urr… this is the longest tutorial ever, and it’s not even related to the use-case I’m trying to solve.

2:15pm – OK, good news and bad news. The good – I finally finished the tutorial. The bad – I still don’t have a clue how to work with this framework to build what I have in mind.

3:00pm – 5 hours have passed, and I still have nothing. What’s worse – people around me have high expectations of me. I have no idea why, but I know I’m going to disappoint them. I’m loosing my patience, and even the quietest chatter in the room distracts me. I’m agitated, and my fuse shortens by the minute. I hope no one will talk to me. I need silence. Maybe I should put headphones on, or go to a secluded room…

4:10pm – Half a day went by, and I’m farther away from my initial idea than I was 6 hours ago. Maybe some coffee and fresh air will help me regain energy and spirit.

4:20 – I don’t know if it’s the coffee or the time off the computer, but I’m thinking more clearly now. In fact, I have an idea. I need to run back to the office.

5:30pm – I have a working solution! It looks awful, but works…. all I have to do now is take care of the front-end. Easy breezy.

9:15pmI hate CSS. I’m about to loose my mind. I must eat.

10:00pm – I need to have some sleep. I’m sure things will look easier tomorrow.

8:10am – CSS is still CSS.

9:55am – 5 minutes to my demo. With some help, hand-holding and a lot of duct-tape my work is somewhat presentable. I hope people see the potential, and won’t get caught-up with the UI.

10:10am – I’ve just presented my thing. I feel awesome. I built something and got people’s applause.

Now, what did I learn from this schizophrenic experience:

I don’t want to be a developer.

Yeah, as simple as that. I’ll keep doing it as a hobby, but I’ll never do it professionally. I mean, I love the problem solving, and creating something with my own hands is amazing. But, getting sucked into the smallest of details, spending hours trying to figure out what I did wrong, only to find a missing ;, and wasting tons of time on configuration before I can do anything, make me go nuts…

OK, so as this door is now closed, what did I learn about coding that will help me understand engineers better?

Coding requires focus

Soooo much of it. Even the slightest distraction can throw your thought process miles away. It then takes a lot of time to regain your thoughts, and get back to where you were before. I now understand even better Joel’s “Human Task Switches Considered Harmful” post.

Tools are important

Don’t ask why, but I’ve started to learn Emacs recently, and so far I love it. But, Emacs isn’t the most dummy proof app out there. Here’s a funny chart, that actually stops being that funny when you start learning Emacs:


So, since I’m somewhere at the bottom of the learning curve still, I thought this hackathon would be an opportunity to learn the tool better and faster. But as soon as time started to press on me, and at the first instance when I didn’t know how to do something in Emacs that was trivial in other tools, I closed it and opened the other tools I feel comfortable with (Sublime and CodeRunner).

Knowing what’s the expected outcome is key

Having a clear idea of what my end product should do, and to some extent – how it should look like, was crucial. I had so much to learn in a very short time, but knowing what my end goal was kept me focused. It also helped me stay on course and learn only what was relevant to getting my project done (otherwise I have the tendency to drift away quickly).

And lastly, I experienced first hand how deadlines and quality [don’t] play [well] together:

Code becomes crappier as deadline approaches

You might think that my experience isn’t a good enough example, and I might agree. I’m just saying that now I can better relate to this #NoDeadlines trend.

If you’re involved, at any capacity, in product development, you already know this lesson, because crappy code keeps bouncing back at you and eats the time and resources you need in order to build new stuff. Don’t be fooled by fancy terms, such as “tech-debt” and “refactoring” – these are politically correct ways to refer to crappy code. And the stricter the deadlines, the more of it you’ll get4.

So with that, I’ll put my developer hat down. It’s too big for me…



Check out the platform here, and leave a comment if you’re interested to learn more.


There were 19 internal and external teams hacking.


In case you’re interested, here’s my GitHub account.


No, it doesn’t mean I won’t ask for time-lines and set deadlines in the future…


What’s this?

This is an org mode based file where I draft all my posts. I keep this file and post it because it helps me work on several posts in paralel, and add to drafts as I go. Once I’m done with a post, I move it to a new file, which is then pushed as a stand alone post.


Switching buffer focus

Sometimes I feel, much like /u/imnothere123puff, that to use Emacs efficiently, I need few more hands. Take buffer and windows navigation for example – the default keybinding to circle through open buffers is C-x o; to switch to the next buffer – C-x right.

Those keybindings are annoying. Not only that they require two steps for one action, but they also hurting your cadence of typing1.

I wanted to change this behavior and define different keybindings that will be easier to type and fit better with my mental model, which associate tab with switching between different areas on the screen. I took it also as an opportunity to establish a workflow for customizing various behaviors of emacs.

Here’s the workflow I came up with:

  • Define what the outcome behavior should be. In this case, I wanted a comfortable keybinding to circle through
    • In my case I wanted to:
      • Define a keybinding to switch focus among open windows within the same frame
      • Define a keybinding to navigate accross buffers
  • Is there already a keybinding for that function? if yes, look for the function this keybinding trigger. `C-h k RET [keybinding]` will describe exactly what happens when you run the sequence of keys.
  • Locate the function that is triggered when the keybinding used.
  • Go to your init file, where the keybinding of your liking should be configured.
  • Insert this elips snippet anywhere2
    (global-set-key [(control tab)] 'other-window)

This is a good example for how to start customizing emacs. I first looked for what

Using calendar

The goal here is to use emacs to:

  1. View my gcal in Emacs
  2. Sync gcal with Emacs
  3. View org cal
  4. Sync org entries in gcal

Indirect buffer

When working on an org file, many times I zoom into one of the sections to focus on it. At times I would like to zoom out just for a second, but not loose my point. In those instances, the indirect buffer is what I would like to use. I learned about it from the excellent video [link] here, but I have hard time to remember how to do it. So here’s a quick checklist.

Working with Markdown

When on my desktop, most of what I write is in orgmode. But when you think about it, while org is text based, and a superset of markdown, it’s not really portable – you can’t write or read it anywhere else that’s not Emacs.

So when I’m on my mobile, I take notes using Drafts and Editorial (mainly the former though). I write my notes in markdown and then export them to Dropbox. So when I’m back to my desktop and want to continue workin on the notes that I’ve started, I prefer to continue edit them in Markdown.

Here are few of the commands I frequently use:

  1. Live preview – C-c C-c l – this will open another window of eww and present the rendered html output of the markdown I’m working on. It’s not “live live”, but updates every time you hit save.

And by the way – I use Jason Blevins exellent markdown-mode, and learned everything that I’m covering here from the documentation he put together.

And by the way, not that I have anything against org, in fact I started to use emacs because of it and don’t look back, but I like the simlicity of markdown, and this package reminds me of its charm.

Defining writing modes

Draft writing mode

Editing Mode

Multiple cursor

Recently I moved my site from Pelican to WordPress. As part of this move I also dumped disqus and now use WordPress commenting system. I didn’t find a good way to import my comments from disqus to WordPress, and can get myself to do this arduous work manually.

In parallel, I recently got curious to try and find use to multiple cursors. Today I watched the amazing Emacs Rocks! episod featuring multiple coursors. Not only that I thought that this is a feature I must muster, I now had a usecase to experiment with.

So here we go. I’m trying to use multiple cursors to convert disqus’ comments xml export to something WordPress can import.


Dictionary and Thesaurus

This is a summary of the packages and functions suggested in this reddit thread, and the solution I moved forward with.

Draft mode

One of the reasons I’m using Emacs is that it removes a lot of the distructions I would have otherwise have. Being completely text based, and keyboard driven, my hands are always in a typing position, so I have to concentrait less on stuff that are not writing.
Yet, I still get distructed often. For example, I will struggle with spelling a certain word, think of a better way to phrase a sentence I wrote in a previous paragraph, or spend time with finding a better way to say something. Those small distructions, while relevant to writing (it’s not that I open a browser and go to reddit or anything, I’m still in writing mode), but they cut the line of thought, and might take my in tangles (link to the post about writing).

Long story short, I learned about draft-mode, a minor mode that once enabled let you do nothing but writing. It emulating a typewriter, so all you can do is move forward. No way back, no way to delete, lookup a word or do anything that is not keep typing.

I found this entriguing, especially as a way to brain dump a though or a first draft. Sure, the outcome is messy to say the least, but being able to consentrait only on squeesing out this thought is invaluable.

So, here’s what I did, and what I found out:

Adding a dictionary

Commands to move between frames

Now that I’ve started to use mu4e for my emails, I want to keep my inbox open in a seperate frame, and the documents that I’m working on in another. I’m looking for a simple way to move from one frame to the other.

Setting Emacs on Mac for Python

What do I try to achive with this integration?

  • Python syntax highlighting
  • Auto-complition, including for default and 3rd party packages
  • Evaluate code in a seperate, horizontal buffer (like I did in CodeRunner)

I recently moved all my writing to emacs, and since I do, or should I say – try to do some python coding – I searched for a tutorial on how to customize emacs as a Python editor.

Before emacs, the litle Python I wrote, was done with CodeRunner and Sublime Text, but mostly in the out-of-box IDLE. Each one of these enviornemt lacked something, so I didn’t have any strings attached when I decided to move my coding to emacs.

I started to google things like “setting emacs for python on mac”, but I didn’t find one tutorial that could walk me through the entire configuration. I did find some useful sprinkles of tips and information.

anything relevant. So instead of keep looking, I decided to figure it out myself, and write a tutorial on it, so other in my position have a better start than I had.

Load dired-x by default   emacs

There are times when I want to take a peek at a file’s underlying folder. I might want to open another file from that folder, do a quick rename or just get myself oriented about where the file I’m working on lives.

I learned that there is a keybinding for it, but that I can use this keybinding only if I have dired-x enabled.

After some googling I learned that dired-x is part of emacs, and there is no need to install anything. I needed, however, to enable it somehow3. A little more digging till I found in the dired manual the following code snippet that will auto load the package:

(autoload 'dired-jump "dired-x"
  "Jump to Dired buffer corresponding to current buffer." t)

(autoload 'dired-jump-other-window "dired-x"
  "Like \\[dired-jump] (dired-jump) but in other window." t)

(define-key global-map "\C-x\C-j" 'dired-jump)
(define-key global-map "\C-x4\C-j" 'dired-jump-other-window)

And now, C-x C-j will open the folder of the current file. C-x 4 C-j will open the folder in a different window.

Bidirectional Editing

I rarly write in hebrew, but now that I’ve started to use emacs for emails, sometime I’ll have to answer an email in my native language. Writing in Hebrew is a challange because of its right-to-left nature that tend to break everything… for years I couldn’t use mac for that reason.

It turned out to be an easy enought to set Emacs to respect my Hebrew, and even to make it play nice when it’s surrounded by other languages.


Pelican + Orgmode   orgmode pelican

For awhile now I’m trying to create a workflow for writing and publishing a blog post. Here is a list of my requirments:

  1. The source should be in a text based format, so text, markdown or org, each will be good.
  2. I would like to be able to manage and edit from one folder, preferable the folder where I have all my notes.

Until recently, I wrote my articles in markdown. When I was done with the article, I copied it to the content folder in my pelicon based blog. I then run `make html` to process the source into a static html, and when I was sutisfied with the piece, I would have pushed the pelican output folder to aws, where my blog is hosted.

Rarely was I satisfied with the piece when copying it to the pelican folder. Many times I had to do some final editing. Since I edited my original text in a a markdown editor, and the code for the site in Sublime Text, I was inclined to the open the article in Sublime, cause mose of the times I was already there, messing with other code, and do the changes on the spot. In that broken workflow, I was left with two copies for each of my posts. Most of the times these copies weren’t identicle. So, once copying a post into pelican, I couldn’t trust that I can edit the original post, but had to go back to the content folder, and open the post there. That turned my central note folder useless when it came to managing my posts.

I recently started to work with emacs, and move a lot of my text based activities to it. And so working on the site and on articles are done at the same place.

I still want to keep a version of my posts in dropbox though, so I still want to have some kind of export workflow in place. This is also true since I want to start writing my posts in org, which isn’t supported out of the box by pelican.

So after a long introduction, the problem I’m trying to solve is

  • How to export a post from my dropbox folder to the content folder in Pelican?

    I want to have the editable format of the article available only in one place. What I’ve experienced so far was that I started an article in my notes folder, at first through nvAlt and then moved to emacs and deft. When I thought I was done and moved the article to the content

  • Configure Org mode to publish (in general)

    This is a straight forward customization. I had to follow the tutorial.

  • Configure the html export to pelican
  • Importing html file into Pelican

    It turns out importing to pelican is harder than I expected.

    But, the export doesn’t work as I thought it will. The problem was that the header that Pelican expect, wasn’t translated in a way it can work with. So as a result, the file that was created in the Pelican content folder wasn’t compiled to the output.

  • Trying an import to markdown

    HTML publishing didn’t work for now. Before trying to work on the main problem, which is the header of the file, I’ll try to do a markdown export and see that it works. If it does, I might keep it like that and work with org to markdown.

    Markdown export doesn’t work well also. Two issues that I had:

    • Org add the outline of the post on top. This is annoying, but I’m sure I can find the solution easily, but not at the moment.
    • The bigger issue is that I can’t seem to be able to pass the head meta tags that Pelican expects to get and process.

    Hitting the wall. Markdown export doesn’t work either.

  • Trying the org-export

    I tried to follow this article but wasn’t able to make it work. I cloned the repository and made the export. But still, the header meta wasn’t included in the output HTML. Now the post mentioned another utility that was “easily” created to do that, but it’s not included, so what’s the point in the article…?

    So, just as I’m about to give up, I found a way that allows me to pass header parameters to the html output. Now, I can have org communicate with pelican. I don’t like this solution that much, because it clatters my org file with markup, but this is something I can live with.

    reference to how the header tag looks like

    Now, I’m only missing the syntax highlighting in the output file, the one that goes to the site.
    Found a solution for that. I had to include htmlize, and now I can export or files into html! yay.

    Next problem to solve:
    Footnotes are shown awkwardly. I’ve looked for a setting that will allow me to remove the footnote header. Found this variable “Org Footnote Section” and removed the “Collect footnotes under heading” to nil. I’m going to restart emacs and see what happens. Finger crossed…

    Oh wow. I found the tresure! I went to emacs settings and searched for “org html export”. I found that I can control evry element of the export, including how the footnotes section will be formated. But I’m greedy, and now looking for header construction, in a way that I can include tags or meta headers in markdown or org format, and have them translate into header tags. This way I won’t have to include ugly markups in my source files.

    Found another article that was helpful in understanding how ord export works, and include some tips on setting up the publishing hook for git – export the site whenever I do a commit. I might get back to it at some point.

    Ok, I think I got to the end of the journey. I found out that after all the trubles that I went through, there is a plugin for pelican. How stupid am I not to figure it out. And more than that – the plugin set in my computer all this time… so reading this post walked me through the setup, and now I can have my org files directly in my pelican content directory. Halelluya!!!

    One last obsecal. That damn syntaxy highlighting thing went away again. I think the first article I read had a solution for that. I’ll go check it out again.

    Yes, Yes, Yes! adding this simple (require ‘color-theme-github) did the trick, and now my implementation is done.

    And now that I can have my org files directly in pelican, I can actually save also this pipeline posts file there, only in dradt mode.

  • References
  • Merging Drafts Into One Orgmode File

    Up until now my writing workflow included creating new file for each post I started to write. I gave those drafts a file name starting with “post -“. This way it was easy to sift through my posts ideas in nvAlt.

    Recentely, I moved to emacs, and was drawn into orgmode. I now write everything in org. Org is the best outliner I worked with, and so when I read [Sacha’s]() tip on managing all her posts-to-be in one org outline, I got curious. I started by outlining several new ideas that I had, and eventually decided to merge my entire collection of drafts into one org file.

  • Why is it a good idea?

    I started to do it, but realised quickly that it will be lame to manually copy and paste the content of some 30 files into one file. Inspired by the “Automate The Boring Stuff With Python” that I read couple of months ago, I thought this might be a good opportunity to implement what I learned. And so I went ahead and wrote the following script that scan my draft files, create a new outline header from the filename (minuse the “post – “prefix) and append the content of each file under the relevant header.

  • Exporting a post from org mode to pelican

    I’m trying to move my blog posts from markdown to org.

    Starting with an outline that is part of a bigger org file that holds all my drafts.
    In my Dropbox folder, I keep all my notes in a Notes/ folder. In that folder I created a sub-folder for all my posts.

    I then killed the sub-tree that held my draft and yanked it into a new org file in the post folder.

    Now, before exporting this post to an HTML in the pelican folder, I needed to add some meta data, especially date, which pelican is finicky about.

    Ok, reporting failure on that for now. I didn’t find a good reference to how I do the export to HTML, and what org headers I need to use to make the transition. And so I did for now, an export to markdown, saved the markdown in the Pelicon content folder and published from there.

    This is a bad compromise, because I had to do some modifications to the markdown document, such as adding

Link to a specific subtree in another org file

Refile a Subtree to a New Org File

I manage all my drafts for new posts in one file. This is an insperation from Sacha.
So now, what I want to be able to do is refiling a subtree, which represent post’s draft, to a new file that will turn to the final post.

I googled it, and here is the result I got. Reading through it makes me think that like integrating org with pelican, this isn’t going to be a quick configuration, but will require some more involvemnt. I will therefore stash this modification, cause I have some more important things to work on at the moment…

Pass Org Header Parameters to Pelican

After a long process of trying to integrate Org with Pelican, I landed on Pelican’s org_reader plugin. It works well and allows me to write my posts in orgmode. But as I gain more posts, I want to categorize and orginize them better.

Org_reader is quit limiting in the amount of header properties it allows to map. In fact it support only the title, category, date and author. In fact, it maps org’s category to pelican’s tags, while both org and pelican has the accurate property names for both tags and category.

So, I decided to expand this plugin to support more properties (maybe all?). I don’t know yet how to do it, whether I should simply change the package localy on my computer and risk breaking it when an update to this plugin is available, or do it the proper way – forking (either to add the missing functionality and then making a pull request, or use it as a starting point to an alternative version of the plugin).

While the second route makes much more sence, it also mean that a quick and dirty solution isn’t an option. And that means I have to learn, at least some, elisp. I’m not sure I’m ready for it at the moment.

So, I’ll put that project on a hold for now, and I’ll start by setting my emacs environment to work with elisp – development and debugging. Yeah, I already see how I’m going to be sucked into learning elisp in no time…

10 minutes later:
I forked the org_reader repository…

2 hours later:
Started to read “Learning Elisp the Hard Way”.

Links in orgmode

  • Create an external link

    The format for a link in org is:


    I found it tricky to use this convention. The way I inclined to create links is to first construct he governing brackets, so to get something like4. I’ll then go and add the description and lastly the url.

    The problem is that when I enter the description part, and move the point outside the description’s enclosed paranthesees, the link changes, and all I can see is the description. In that view I can’t modify the url part of the link.

    I found the answer in Org Mode Compact Guide

    Org will recognize plain URL-like links and activate them as clickable
    links. The general link format, however, looks like this:

    [[link][description]] or alternatively [[link]]

    Once a link in the buffer is complete (all brackets present), Org will change the display so that ‘description’ is displayed instead of [[fsdf]] and ‘link’ is
    displayed instead of [[link]]. To edit the invisible ‘link’ part, use
    C-c C-l with the cursor on the link.

    So now, instead of constructing the markup for a link, I simply type ‘C-c C-l RET’ at the point where I want the reference link to be inserted. In the prompt that shows in the mini-buffer, I enter the link’s url and the description. I

  • Remove a link

    I created a link, but want to remove the link, and keep only the description. Here’s a function that I’ll have to add to my init file.

    (defun afs/org-replace-link-by-link-description ()
        "Replace an org link by its description or if empty its address"
      (if (org-in-regexp org-bracket-link-regexp 1)
          (let ((remove (list (match-beginning 0) (match-end 0)))
            (description (if (match-end 3) 
                     (org-match-string-no-properties 3)
                     (org-match-string-no-properties 1))))
        (apply 'delete-region remove)
        (insert description))))

    I got this script from an answer in stack-overflow.

    • The want:

      I have a link that I’ve defined. Now I want to remove the link part, and remain only with the link’s lable. So for example, if I have google linke, and I want to remove the underline url, but still keep the string google.

      • Solution

        I bumped into a function that’s doing it in the past. I’m not sure if I documented it or not, but I should return\search for it and grab the code…

Forking the org_reader plugin

The goal is to be able to export org files simlessly to pelican. I want to have all the meta tags that Pelican allows, synced from org in Emacs.
I will build on top of the org_reader plugin, and then decide if I make a pull request, or add my own version with attribution to the other plugin.

Here’s what I did:

  • Forked the org_reader plugin
  • Copied the plugin to a new folder – ort_to_pelican
  • Created a test blog in pelican

    I don’t want to make changes that harm my current implementation. Want to create a clean environment to experimintations.

  • Find the touching point with org meta

    I found the part of the code where the plug in connect with the org export meta data. I switched the json to get static values, just to make sure I’m touching the right spot.

    Here’s the before:

    metadata = {'title': 'json_output['title']',
                        'tags': json_output['category'] or '',
                        'slug': slug,
                        'author': json_output['author'],
                        'date': json_output['date']}
            parsed = {}
            for key, value in metadata.items():
                parsed[key] = self.process_metadata(key, value)
            return json_output['post'], parsed

    And the after:

     metadata = {'title': 'TITLE - This is a test of a static json',
                        'tags': 'emacs',
                        'slug': 'This is a test slug',
                        'author': 'Yaniv',
                        'date': '2015-11-11'}
            parsed = {}
            for key, value in metadata.items():
                parsed[key] = self.process_metadata(key, value)
            return json_output['post'], parsed

    I changed the attributes of the json that probably feeds the pelican with static values. The resulted article showed those static attributes.


  • Read the meta tags from the org post

    Instead of waiting for the meta tags to be exported from org, I’ll go ahead and fetch them directly from the org file. The reason for going around the org export is that it’s apis only expost subset of entities, while I want to support more properties.

  • Implemented the parsing method

    This method read the org file.
    It read lines and if a line is a property line, it breaks it into a dictionaty.

  • Need to map the resulting dictionary with the pelicon terminology.
  • Resources

Inserting an inline image with org

I’m trying to add an image from a url that will show inline (and not as a link). What I found in the org manual is how to do it with a local file, but it seems to not work with remote file, or with using http: instead of file:.

Here’s what I found so far:

Ok, I found this answer in stack-overflow that worked for me. I think I made the wrong search, and the information that I got was about how to show images inline in an org file. While this might be useful, it wasn’t exactly what I needed. I will explore the inline image display later on.

Orgmode – Presentation With Reavel

I want to be able to write my presentation with text. I don’t like doing my presentation with any of the ordinary apps because I end up spending most of my time on the look and feel rather than on the content, and on what I want to achive from the presentation.

As I move more and more parts of my life to org, running presentations using it sounded like a good idea. I looked for plugins that I can use for that task. I used landslide with markdown before, the experience was ok. What I found for org, which work also with markdown, is Reveal. So I decided to give it a try.

  • Installation and configuration
    • Clone reveal into ~/dev/reveal. Here’s a link to the latest version.
    • Configure org-reveal package in Emacs
      • First try: Add the following to my init file
        (use-package ox-reveal
        :ensure t
        (setq org-reveal-root "~/dev/reveal/reveal.js"))

        That didn’t work. When evaluating my init file, it complained that the package isn’t available.

      • Second try: Clone the org-reveal repository into my ~/.emacs.d/lisp/ folder (that’s were I place packages that I downloaded manually, i.e. not from one of the package hubs). That didn’t work either. My init loaded without problem, but the org-reveal package didn’t.
      • Third try: I commented the use-package config, and used the ordinary require:
        (require 'ox-reveal)

        This time it worked.

    • Try it out – Seems that the package is now loading. So I created a test presentation, like this one:
      * Slide 1
      * Slide 2 
      ** Slide 2.1
      ** Slide 2.2
      * Slide 3

    I then called org-reveal-export-to-html, but got an error Symbol's function definition is void: org-export-get-referenc. Not sure why… Taking a step backward, to read the documentation again, and see where did I take the wrong step.

  • Reference

Add footnote within the same section

This way I can add footnotes to a post while still in draft stage and page.


Flip between light and dark themes

I want to creat a function that flip between light and dark thems.

  • Choose the themes I want to flip through.
  • Create a variable that will hold the name of the current theme, so I can switch it with a keybinding.

Add Solarized theme to emacs

I fell in love with that theme.
I installed the solarized theme from elpa (github repo here)
This was very easy, but the problem was that the headers in org mode didn’t adhear to the theme.
I tried this package:, but couldn’t make init to load the theme correctly. I also didn’t want to change my path to themes to that theme’s folder, because I might want to add more themes to that path, and the custom-theme-directory doesn’t seem to be a list.

So now I found this post –
I hope this article will be helpful. It wasn’t.

Both Sacha’s configuration, and the article I read didn’t help. It seemed that I have a cumborsum variable of the header that inherited it’s value, and overriden the theme.

Eventually, like many other questions, I found a solution in an answer at stack-overflow. I had to use the first repo, and add this line to the init:

(setq solarized-scale-org-headlines nil)

Experimitation with Spacemacs

  • Note taken on [2015-11-16 Mon 14:45]

The other day I added @melpa_emacs to my emacs twitter list, so now I can see every new package or update that is submitted to melpa.

One of those packages is spaceline. I didn’t know what it is, but saw that it has many downloads (relatively). I was intrigued to learn more. Realized it a package that imitates the look and feel of spacemacs mode-line. Hmmm… Spacemacs. Should I try it? afterall it aims to combine the benefites of vim and emacs. Since I use Evil mode, I thought it might be a good idea to take spacemacs for a spin.

I was relactunt to do it in the past, because spacemacs is known for the amount of packages it adds by default, and I liked the idea of controling and growing the emacs installation and customization with me. My curiosity won, and I cloned spacemacs.

I loaded it, but figured it will ential another phase of learning completly new product, and decided it’s not the right time for me to start that journey. Especially as I’m starting to feel more comfortable with emacs “vanilla”.

So, I backed up the spacemacs folder and stashed it for now. I’ll probably want to get back to it at some point in the future. I hope that by then I’ll have more capacity to learn new things, and be even more proficient with emacs.

Add several folders to deft


  • How do I pass a list of folders so deft search in them?


There is no way to specify more than one folder. The variable name hint to that – it called setq deft-directory – note directory in singular rather than plural5

TODO Undo tree mode

Copied the setting from Sacha’s config file –
Need to learn a little more how to use it.

How to modify emacs window so the buffer have right and left margins

There is the set-left-margin, but this modify the actual text in the buffer. I want to change the window, so it will not affect the actual text within the buffer.

How do I change windows layout back and forth

When I write documents, I want the document I’m working on to take the entire frame. If I want to take a quick glimps to another file, or to look for some related information, I want to open anotehr window within the same frame. When I’m done, I want to go back to the previous layout of single window.

Of course, C-x 3 to open the 2 window and then C-x 1 to get rid of the window will do the same thing. But what if I want to keep the layout as well as the documents the shown in each of the windows? what if I want to quickly tuggle back and forth between those layouts?

The C-x {n} keybinding have no history. So if I open a second window, it will open with the file I have on the initial window, and I’ll have to switch focus and open the second file. If I close the second window, and then open it again, again it will open on the file shown on the single window. Did I loose you with all the swiching back and forth? so yeah, that’s how I loos track of all the open files and where they are when I switch from one to another.

So, what I’m looking for is a way to move between predefined frame configurations, or way to save and go back to a layout that I already created.

It took me awhile to articulate what I’m looking for. When I did, I landed on this stack-overflow thread, which was a usefull starting point.

From that answer, I learned about two packages:

  1. Winner-mode

This is as simple as undo\redo for windows layout. It’s part of Emacs, so no need to download the package or set use-package to load it.

I found it to be very usefull for cases when I want to go back and forth between two layouts. This is what I was looking for originally. The problem with this package seems to be that every action on the window pushes into the undo stack. So if I’m on a certain file, open a new file, split the frame into two vertical windows and in one of the windows open a third file, I registered 3 actions to the undo ring. To get to the first file that was shown on a single window, I have to run the undo command 3 times. And to get back to the 2 layout (2 windows with 2 differnet files), I’ll have to redo 3 times. Not that convinient or intuitive.

Actually, I might have to look at it again. If I go through the undo ring, and get to say the 4th layout within the ring. Now when I redo, I’ll jump to the initial layout, the one I’ve started the undo at. Yet, it will still take me another 4 undos to get back again to the second layout…

  1. workgroups2

This one seems to be a more comprehensive package. It allows to save and restore workplaces and frame configurations. It seems to answer my needs, and add some more functionality that I didn’t think about at first.

But it requires some more research and exprimintation before I can tell if it’s what I was looking for, and if it is something I can see myself working with.

Do I want to give it a try now…? think I should, if I’m already at that.

Running several instances of Emacs

This should be a follow up on the “How do I change windows layout” post. I actually want to not only switch between different layouts, but also have different look\theme for different windows\documents\layouts.


Adding a tag cloud

Add inline footnotes

Yesterday I got a feedback from a friend who read this post. Her feedback was that she would have liked to be able to read the footnotes inline, instead of having to scroll all the way down the article. That’s a good feedback, and I want to think of ways to adderss it. One way will be to add a tooltip to the footnote reference.



Updating wordpress – checklist

Importing comments from disqus


Parsing emails in Python

I have an idea for an app (I’ll just say it has something to do with food and personalization…), and want to validate the problem, the assumptions that I have, and the solution that I have in mind. New product development 101.

Thinking of the MVP of the MVP, I want to collect some data about my own patterns. I want to get the history of my food orders, and the best place to look for this information is in Gmail. That’s where all the confirmation emails live.

I want to create a Python script that goes through the relevan emails, and fetch the information I’m looking for. Part of the problem – accessing the history of emails – is already solved, since I have all my emails on my local machine, stored in an /Maildir folder (another good reason, in retrospec, to use mu4e.)

Before parsing emails, I need to understend the ins-and-outs of python and email management.

Sending email

$ python3
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> import smtplib
>>> smtpObj = smtplib.SMTP_SSL('', 465)
>>> smtpObj.ehlo()
(250, b' at your service, []\nSIZE 35882577\
>>> smtpObj.login('', ' MY_SECRET_PASSWORD')
(235, b'2.7.0 Accepted')
>>> smtpObj.sendmail('', '', 'Subject: So
long.\nDear Alice, so long and thanks for all the fish. Sincerely, Bob')
>>> smtpObj.quit()
(221, b'2.0.0 closing connection ko10sm23097611pbd.52 - gsmtp')


  • In the sentmail function:
    • The body of the email defined in the third argument. It must start with “Subject:”.
    • The “\n” seperates between the subject and the body of the email.


  • Install imapclient and pyzmail

    Finding and retriving emails is easier using these two modules. Here’s how to install them:

    ~ $ python3 -m pip install imapclient
    ~ $ python3 -m pip install pyzmail

Connecting to Elasticsearch (or ELK with Python)

Integrating Sphere with Alfred

We have a hackathon

Adding scheduled job in mac

I want to run the offlineimap every x minutes. For that I can use either keyboard maestro or LaunchAgent. Need to decide on an approach.

How to figure out the size of a folder from terminal

Here’s a quick way to find the size of a folder, via terminal

The command du “summarizes disk usage of each FILE, recursively for directories,” e.g.,

du -hs /path/to/directory
  • -h is to get the numbers “human readable”, e.g. get 140M instead of 143260 (size in KBytes)
  • -s is for summary

(otherwise you’ll get not only the size of the folder but also for everything in the folder separately)

source to the answer in stack-overflow.

Writing a python script for Lorem Ipsum

I want to be able to get a Lorem Ipsum text in varying length. I think I can write a small script to do it. I will be able to run it using alfred, with an argument for the number of words I would like to get.

Parsing a json file with logstash

  • I downloaded the yelp academy data and would like to throw it to elastic search and see what I can do with it.
  • The dataset include json files with all the information within it as json objects.
  • I thought I could use the elasticsearch bulk upload api, like this:
curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary "@accounts.json"

But it didn’t work. I googled the error that I got:

  "error" : {
    "root_cause" : [ {
      "type" : "illegal_argument_exception",
      "reason" : "Malformed action/metadata line [1], expected START_OBJECT or END_OBJECT but found [VALUE_STRING]"
    } ],
    "type" : "illegal_argument_exception",
    "reason" : "Malformed action/metadata line [1], expected START_OBJECT or END_OBJECT but found [VALUE_STRING]"
  "status" : 400

and found that elasticsearch doesn’t take this input as is. It has an “awekward” format that it can work with, and require an \n at the end of every json object.

I’m not sure I want to start parsing the json file and append \n to the end of each json object. Instead, it might be a good opportunity to try working with logstash. I’m sure it has a json plugin that takes json file as an input, format it and send it into elasticsearch.

In the logstash documentation I see that I should use the json filter, and one of the required fields is source. I’m not sure what this source field means, but keep its value to "message", following the example in the documentation.

Chacking my logstash configuration seems to be ok:

~/dev/elk/logstash-2.2.2 $ bin/logstash -f yelp-json.conf --configtest
Configuration OK

Running logstash on my config file doesn’t work though. Here’s my template file:

Nothing happens. No json is parsed. I’m spending an hour trying to understand what I’m doing wrong, and eventually realize that its something to do with the timestamp. I have to let logstash know that it should start monitoring the file from the beggining, and not look for only new entries (think it looks for entries from the last 24 hours by default).

Ok, it finally works. As I’ve suspected, it was the time related configuration. Here’s my logstash config file:

input {
  file {
    sincedb_path => "/dev/null"
    type => "json"
    path => "/Users/ygilad/Downloads/yelp_dataset/test.json"
    start_position => beginning 
    ignore_older => 0

        source => "message"
output {
    elasticsearch {
                  index => "test_business"

The json file I would like to parse has only json objects in it, there’s no field that include the desired object. How do I point the filter to the root of every json object?

Is it possible that I’m just too impatient, and that the configuration I had in place worked all this time…?

I found this repository


Elastic Search is amazing


Few years ago, gas prices went beserk, to well over 150$ a barrle. It seemed as if oil will be over in just a few years. Might be good news for some, but that’s not the argument I’m trying to get at.

Anyway, just as it seemed that we are forced into a oil-less economy, and started to think of sustainable energy resources, fraking started to cought out steam as a way to access deep layers of pockets of gas and oil. Suddenly oil resovoure quadrupled(?)

Again, I’m not an anti inviormentalist, so get of my back. What I’m trying to get at is that Elastic Search is like fraking, just without all the bad things that comes with it. Let me share with you how ES feels like from a product point of view.

It took us almost a month to drill a report

It took us a year to create a pool of content, and it’s very limited.

Elastic search brings all though resources to the ground level

Now, with easy to use interface, even non-technocal people can dig the data and play with it. Suddenly we have milions of documents at the tip of our finger, and I can search for documents in with any filter I’m interested in, just like I can do with Google, only that I know that I will get content in return.

  "size": 75,
  "query": {
    "filtered": {
      "query": {
        "range": {
          "Leiki.Metallica": {
            "gte": 0.5
      "filter": {
        "term": {
          "langId": "en"

Getting Feedback from users and customers


A friend of mine asked me the other day how do we collect feedback from clienct, and how do we incorporate this feedback in our product roadmap. My immediate response was that we do collect feedback. This feedback includes not only meetings with clients, but mainly ….

But my answer got me thinking. Do we really don’t collect feedback? are we really driven only by a vision, thinking that we have all the answers, and only building something with the hope that everyone will understand it at the end of the day? and when I thought about it deeper, the answer become No. Absolutly not.

Feedback is part of our process, even if we don’t think of it as such

A feedback loop is essential to everything I do, whether it’s through direct partners’ feedback, user testings, a\b testing or data analysis. Here are just few examples for the type of feedback we collected, what we learned from it, and how it influenced our product.


  • Direct to consumers first

    We started with direct to consumer products, such as a Firefox and chrome extensions. While the initial UI\UX were driven by our experience working with publishers, we quickly revised it after gathering data from user feedback that was collected through user testing, engagement data (mainly google analytics) and a\b testing.

    The feedback we gathered showed us a mixed picture. On the one hand, we satisfied a (small) segment of the users we saw. On the other hand, data showed that our building a d2c from scratch will not be sustainable. Our cost per user was way over the LTV.

  • NTDs

    That led us to two main decisions. 1) We should build our distribution first and a destination second and 2) everything we build should be reusable (i.e. API driven). With that decision, we had to first chose the types of partners that will see the value in what we’re building. After numerous meetings with different partners that have different goals, we selected partners who care mostly about engagement and audience growth (rather than pure monetization). Our initial partners were companies, usually technology driven, that don’t produce their own content, but want to use content to drive engagement and retention.

    Working with those partners, we learned about the KPIs they’re interested in, and capabilities they would like to have. For example, one partner wanted to create an on-boarding experience to a content hub they were planning to build inside their app. They wanted to leverage our platform to power the content, but also to allow users to control the sites and categories of content they being recommended with. This request led us to expand our platform and expose a set of APIs that enable this functionality. Today, those APIs play an important role in our story.

  • Back to publishers

    As we’ve started to scale our pilot with partners, we found that our vision and the platform we’ve built aligns well also with a certain segment of publishers – small, “high brow” publishers that produce premium content for niche audience. Meetings and brainstorming with such partners, we learned that taking an API route isn’t practical, because they usually don’t have the technical capabilities to integrate with our platform through an API. That led us to work on a JS based solution, with the goal of minimizing time to deployment, and the required technical skills to work with us.

    We launched that new product couple of weeks ago. You can take a look at that article from First Round Review for an example how this product looks like (see the recommendation units on the sides and bottom of the article).

  • The hackathon as a feedback loop

    The development hub that I showed briefly yesterday, was driven by tons of user testings, spec reviews and demos we presented to partners. Last week, we conducted a dry run for that platform, in a hackathon we organized in our office. We invited external teams to hack and build with our APIs. The goal was to test how “self-servised” and self-explanatory the work with our platform and documentation is.

    You can take a look at that blog post for my personal lessons. But we had another, bigger and surprising take-away. Most of the teams in the hackathon chose to use one certain API, that we made available the night before the hackathon, just as a through away and as an afterthought, without knowing how it can really be leveraged. That was a unique way to learn about how our partners really want to use our platform, and where we might want to grow it.


Fearute ownership


From Idea to Vision and Back to an MVP

The last couple of weeks were an interesting experiment in trying to think my idea from the vision perspective. What is the need that it’s going to serve, where does it fit in the bigger ecosystem, what’s the bigger vision – a stand-alone app or a bigger platform, what’s the buiseness model, who might be good partners, exit strategy and all those investor like information that should find its place in a presentation.

After going through that and speaking with some friend whom advice I highly appreciate, I’m confident there is something here. There’s an idea and there’s a vision. Now I had to figure out where to start. What’s the MVP?

I thought that the next thing will be to find someone who will lead the technical front. Most of my connections are in Israel, and one of the advises I got was to find someone local (NYC), otherwise I won’t be able to have like 3 hours in sturbacks, cracking some pesky problem together with my co-founder.

I also read this very good article about finding a technical co-founder, and decided to take the advise there, and start doing the technical work that I can do, and create some value that potential candidates can appreciate, understand and see the value in. That might also turn out to be a good MVP.


Process mail

This is the workflow I use for the last couple of months to process my mail, process it to a paperless storage, and be on top of my bills.

  • 2Do – a reacuring reminder to check my physical mailbox
  • Scanner pro
  • Dropbox
  • Hazel
  • DevonThink

Remove HTML Files With Hazel

Here’s a simple Hazel rule I created in order to deal with superflous html files that are created whenever I do a file export from my \~/Dropbox/Notes folder.

  • [ ] I need to see how I set the rule so it monitor both files within the folder and within sub-folder in that folder.

Stitch two images together

I have two screenshots I took on my iPhone. Now I want to stich them and show them as one image, side by side.


So much going on…

I wish I could start an async thread that would have gone and document everything that’s going on at the moment. So many open thread, in so many areas of my life, that I don’t find a minute to stop and document, write or share the magnitude of learnings that I accumulate. So I’ll try to log dump at least one, which might be worthwhile for me later on, as technical documentation and for some other readers.

Imapclient + Elasticsearch

I want to be able to learn about my eating habits. More specifically, I would like to get a picture of the restaurants and dishes I’m ordering from. My assumption is that this list is limmited, and that most of the time I’m spending on trying to figure out what to eat is a waste, because I end up eating the same dishes from the same places.

Why collecting this data?

This is a good MVP to a bigger idea that will help me (and hopefuly others) turn the decision of ‘what to eat’ fun again.

Don’t Build a Dominos Pizza Company

  • Note taken on [2015-11-16 Mon 15:45]
    started writing this

I want to follow up on my discussion with Elad today. I want to say something about us being the wrong people at the wrong phase of the company. But I also want to say that the company’s going astray. I want to make a metaphor to Domino’s pizza. I want to say that about 20 years ago dominoes was all about the pizza about making it the best pizza for their customers.
The van over the years dominoes look for other ways to make revenue. Pizza wasn’t necessarily the only thing they wanted to do in order to grow. So, new people who join dominoes wearing to miss surly passionate about pizza but passionate about making money. People probably join from McDonald’s and brought with them the best way to do burgers in people join from K FC with recipes for chicken wings. So little by little those old people who cared about pizza is where less and less relevant. Not only that he cared about one thing but they were people of the past.

What I want to say, is that those people might be the people of the past. It might be that Domino’s is no longer at pizza place. But as a customer I don’t know the hell what Domino’s is you have no identity and it’s not here to stay.

When Domino’s pizza just started

I’m sure they were all about the pizza. How to bake the best pizza, that will take over the world

At some point, pizza didn’t take over the world

Domino’s moved to another mode

Bring new people, who were more adapt to the new company

But those people didn’t have the initial dna of the early dominos days. They weren’t passionate about the pizza, but about the business and about fixing this company.

From kfc, and macdonald

Dominos hired people “who already did it”. Some from KFC, some from macdonald. The early employees of dominos now were part of the past. They were naive, and didn’t “grow” with the business. Sell only pizza is so 60s.


Just a reminder about this tool.

Many times I find a link that seemed to be dead. I sigh disappointed and look for a new resource. Sometimes I recall this amazing site, tha

It’s not about you. It’s about the topic.

Recently I spend more and more time in social networks other than the ones like Twitter and FB, though I rarely used FB. But my point is that my attention shifted to other channels.

The results of that narcissism:

  • I started to use Reddit more, because I was interested in the topic.
  • I found it more and more engaging. I liked it, because it didn’t feel like a waste of time. It’s knowledge about the things I’m interested in. (Emacs, product management, writing).
  • Engagment led to participation.
  • But then the equation skewed. Instead of logging it and read the new posts, for days I would open Reddit and scroll to find my submissions. How many upvotes were added? Any new comments? I suddenly noticed that I scroll past days of discussion, just to selfishly check the status of my posts.
  • Than, few long days went by without me posting anything. Stat flattens. And suddenly I have less interest opening the app. No point, no one commented on what I said.

So what’s the point I’m trying to make?

Is it the obsession with self centric attention? Is it the tension between narcissism and essence

Mechanical Keybords

POST – how to make yourself look dumb

So here’s a very effective tip to how to expedite the first impression your communicating, down hill.

Earlier today I met with several executives from a company that do mobile development. The goal of the meeting was to brainstorm ideas and ways we can collaborate.

After some chitchat we started the meeting. Before any of the participants introduced themselves, let alone giving some context to the meeting, one of the executive said something like:

“So let me guess, your challenge in mobile is that you didn’t figure out the creative to drive the monetization your partners are looking to drive”

My respond was simple, yet somewhat blunt:
“Wrong guess. Do you want to try again, or do you prefer I give some background and context?”

From that moment on, I couldn’t make myself listens and take things that came out from that guy’s mouth seriously. Instinctively I shut my ears to his comments, filtering them and waiting for him to go silent and let other people talk.

The takeaway:
What a bad strategy it is to come to a discussion with prior conviction, and blah your assumption on the table, before hearing something or looking for clues from the other side. The stacks are too high. It’s like sitting in the blackjack table and asking “hit me” before being felt for the first card.

But this goes well beyond discussions. How many times did you see managers falling into this trap? Starting a new role with decisions and actions, before taking the time to learn and listen.
[add my essay to business school?]



I’m borrowing this concept from Mickey Petersen, in his book Mastering Emacs


Just make sure you don’t stepping inside of another decleration.


The way EmacsWiki suggests to enable it didn’t work for me, because it requires to use dired before using dired-x.


I still follow a tip that I’ve learned from my C professor – always insert pairs – so I never have to worry about finding which parentheses I forgot to close.


Note to self – is it a true assumption that I can tell from a variable name whether it can hold a list of only a single value?

Adding a Commenting System

I decided to add comments to this blog. Initially, I didn’t want comments, because I didn’t see their value, and thought of them mainly as spam. Now I know, though, that the real reason was an anxiety from having other people commenting on my writing. But as I started to post more frequently, and share my learning and experiences, an urge to hear other people thoughts and opinions emerged. I know I’m making a lot of mistakes along the way. Letting other1 to comment and point to those mistakes seems like a good way to improve.

And so, I begun to search for a commenting system.

My first option was disqus. Why? first, because it’s synonymous to comments. Second, becaue Pelican, which generates this site, supports it by default. I created an account with disqus, but changed my mind just before implementing their widget. I was always reluctant to install 3rd party services in my site, and having to disable “cookie targeting” and “merchant code” related settings, when configuring the commenting widget, didn’t help.

Therefore, I started to look for a less obvious solution. Googling “pelican comments” and “static site comment system” reeled few options:

After doing some research, I decided that those plugins won’t work for me. To explain why, I should mention that my site is static. It means that it includes nothing but simple HTML pages, and static files like images and css. Those pages live in a dumb Amazon-S3 storage, and are served “as is”. There are no dynamic elemnts, such as database, involved in generating and serving them.

In order to enable comments, though, there must be a dynamic component somewhere in the flow. This component should intercept new comments, store them in a database or files, and tie them together with the relevant post. So, if I don’t want to use a cloud service, like disqus, I should either add logic to my hosting server, or become that logic myself.

Since, as I mentioned, S3 is nothing but storage, I have no way to run server-side scripts on it. Nor do I want to, since it will dilute the whole concept of static website… That took Hashover and ISSO off the table, because both require server-side PHP scripts.

I then tried the pelican comment plugin. Installation was quick and smooth, but eventually, like the other options, this plugin didn’t work for me either. Well, not that it didn’t work, just that I had to work for it.

Unlike the other plugins, this one requires no back-end service. It’s truly static. But as I mentioned, there must be a dynamic component somewhere. In this case, this component was me. With this plugin, comments are sent over email. I had to save each email as a file in a specific folder and give it a specific name. I then had to render the site and push it to S3. I had to repeat this process for every new comments. I don’t expect many comments, but still, this doesn’t look like a scalable or sustainable solution.

And so, disappointed of my failure to find an alternative, I went back to the first option. In less than 5 minutes I got a disqus commenting widget live on my article pages. I’m still uncomfortable having that 3rd party component hosted in my site, but I will keep it until I find a better solution.

Leave a comment if you know of any alternatives I should take a look at…



Not that I think anyone reads this blog, except for my wife when I ask her to proof read something, or friend whom I force into reading an article here and then.

Copy Git Changes to a New Branch

I’m still not fluent with git and version control. I manage repositories for projects I’m working on, but sill have hard time managing my changes, commits and branches.

For example, I’m currently working on integrating Emacs’s org-mode support to Pelican, a static web-page generator I use for this blog. I was proud of myself for remembering to create a new branch when starting the work. Somewhere in the middle of the integration, I drift away, and started to explore a new idea – adding a commenting system to the site. Before I knew it I was already working on it. Unfortunately, not only that I didn’t work on that feature in a dedicated branch, I was still on the branch I created for the org integration.

I wondered if there is a way to take the changes I made since the last commit, and pour them over into a new branch. Luckily, there is. Here’s how, thank to this answer in stack-overflow:

You can simply check out a new branch, and then commit:

git checkout -b my_new_branch
git commit

Checking out the new branch will not discard your changes.

Tried it and it worked.

Swapping Buffers in Emacs

It took me awhile to find a way to swap the position of two buffers in emacs. Yes, there is a description in emacs wiki, and the code bellow is actually taken from there, but it’s not that easy to find through the tons of irrelevant information arround it.

So if you’re looking to simply get the right buffer show on the right, and vice versa, here’s what you should add to your init file:

(defun transpose-buffers (arg)
      "Transpose the buffers shown in two windows."
      (interactive "p")
      (let ((selector (if (>= arg 0) 'next-window 'previous-window)))

          (let ((this-win (window-buffer))
                (next-win (window-buffer (funcall selector))))
            (set-window-buffer (selected-window) next-win)
            (set-window-buffer (funcall selector) this-win)
            (select-window (funcall selector)))
          (setq arg (if (plusp arg) (1- arg) (1+ arg))))))

I have no idea what this code means1, but it does what I expected it to do. I also didn’t create a keybinding for it, but you can if you would like to. Here’s how to bind it to, say, f8:

(global-set-key [f8] 'transpose-buffers)



Learning elisp is on my todo list…