Iqbal Ansari

My little corner on the Internet

  • Automatically create parent directories on visiting a new file in Emacs

    In emacs we can open a file in a non-existent directory and then use the command make-directory to create the parent directory (or directories) if they do not exist. While this is really useful, I find it a bit cumbersome to press M-xmake-directory RETRETevery time I visit such a file. I was looking for ways to automate this when I came across the variable find-file-not-found-functions. According to the documentation (C-hvfind-file-not-found-functions RET)

    Read more…
  • Switching repositories with Magit

    Magit is an awesome git interface for emacs. The normal workflow with magit is to do M-xmagit-status, if the file you are editing is in a git repository you will have magit UI opened allowing you interact with the git repo. Otherwise it will ask you to enter the path to a git repository and opens a magit UI for that repository. It often happens that you are editing a file in a some git repository but want to open the magit UI for some other git repository.

    Read more…