Send Notifications from Emacs with i3wm and Dunst

I barely use notifications, but recently I think it's a valuable way to remind me things like helping me nurture habits, or to notify me of emergencies like a critically low laptop battery. So I try to integrate notifications to org-mode and Emacs today. The org-notify package from org-contrib (install it by (package-install 'org-contrib) ) could do this job easily before, so I first test it in the minibuffer with (org-notify "test"). [Read More]

Generate Call Graphs Using Doxygen in Emacs

Doxygen is a nice tool for generating documentations for well-annotated C/C++ projects, the one feature that I like most is generating call graphs and class diagrams, so that I can learn a project quickly by browsing the diagrams from a higher point of view. I take the following steps to generate call graphs for a project on terminals on Linux: cd /path/to/a/project/, and generate a template config file by doxygen -s -g doxygen. [Read More]

A Trick to Troubleshoot Emacs Subprocess Creating

There are many packages of Emacs that leverage subprocesses to do their jobs, Magit, eglot, elpy, to name a few. And there are times that a subprocess doesn't work as expected, for example, Magit is slow, and you're sure that it's ok when running git commands on shell. So how to spot these problems effectively and quickly? The problem is that we don't know what's going on exactly, so here I want to share a few Elisp advices to make the subprocess creating visible, and print the exact program and its arguments to the *Message* buffer. [Read More]

ppcompile: An Emacs Package to Help Coding Locally

If you are a C/C++ programmer like me, you may experience jumping around different machines to write and compile your code, or you may write code on different machines for different projects, and scp/rsync/ftp the projects around. It works, but it's a bit tedious and takes too much burden on our brains. For example, say I have two projects that should be compiled on their compiling machines respectively. There are two obvious workflows for writing code for them "simultaneously": [Read More]

How To Revert a Series of Git Commits?

Sometimes, I need to revert a series of commits that I've already pushed, doing a git hard reset (git reset --hard) is not an option, as someone may already have new commits based on mine. For example, assume that I've made a few commits like below: 65a2c62 * commit 10 25cad43 * commit 9 72ad583 * commit 8 ceebf9a * commit 7 acf8a11 * commit 6 28d526f * commit 5 63af1e2 * commit 4 982c71c * commit 3 0fb4c2d * commit 2 acf9da1 * commit 1 b5f9933 * commit 0 For whatever reason, I need to "drop" the changes made by commit 6 to commit 10, that is, go back to "commit 5" without deleting these commits. [Read More]

Generating org-mode Outlines for wikiHow Articles

Recently I found some great articles on wikiHow, then I want to keep notes of them in org-mode files. At first, I manually copied the ToC of articles, but soon I found it's tedious and takes a lot of time. Today I wrote a requests-based Python script to help me extract the ToCs (Table of Content) into org-mode outlines. It takes two arguments, the first one is the URL, the second one is the containing heading's level for the generated ToC in org-mode. [Read More]

Understanding align-regexp of Emacs

Emacs' M-x align-regex is neat when I want to align some similar text, especially when we're coding. I use its trivial version(without prefix arg) regularly on day-to-day programming work before. For example, I can use it to align below code quickly by: Choose the region M-x align-regexp and type = and Enter aaaaaaaaaaaaaa = fields[0] bbb = fields[1] cccccccc = fields[2] It will be aligned to below code, now it's better to read: [Read More]

Fine-tune Curly Braces Style of Yasnippet Snippet on the Fly

Yasnippet is a good friend to help us type less and write more, whenever we write some text snippets repeatedly. And there is also an official repository called yasnippet-snippets that contains various snippets for many programming languages (modes), so that we can have many snippets in no time by installing it. But there is a little problem when it comes to conforming to different coding styles. Take the if snippet for example, normally it will generate code like this: [Read More]