I switched to org-mode from EverNote recently, and the experience imrpoved much for note and journal writing, especially for technical notes. After the whole tool is set appropriately, I am even addicted to writing. During my setting up for org-mode and related tools, I found these code snippets are really handy, so let’s have a share.
Insert Pic from paste
You need to install pngpaste first, then with this elisp function, we can copy the picture from paste very quickly, the picture will store on current directory’s img sub-directory, it will create it if img directory is not exists.
I using Hexo for blogging, the default format is markdown in Hexo, so I need to convert org format to markdown format very conveniently, and finally org-ruby solve it. I did some dirty hacks on the codebase, please have a look at this PR, this PR solve three issues.
Add title and path attributes in org file, and the ruby script will extract it for dumping markdown file.
Fix the fill paragraph problem, I don’t need the blanks which will broken the paragraph layout.
Copy the images to proper directory for Hexo, support image size attributes.
Then I added an elisp function for auto publish it after saving file whenever “#MD_TITLE:” is founded in buffer: