Emacs Tip: A Key to open the Current Folder in Windows

1 min read · Posted on: Jun 10, 2008 · Print this page

If the over-descriptive title was not enough, this is another one of my tips to use my favorite editor - Emacs. Some of you really liked my earlier post on Emacs tips on Windows, so here is one more tip to improve your productivity.

Most of the time while editing a document, we need to quickly browse the folder of that file. Add the following lines to your .emacs files and so that by just pressing function key F12 you can immediately view its corresponding folder:


;; explorer
;; ----------
;;; Windows explorer to open current file - Arun Ravindran

(defun explorer ()
  "Launch the windows explorer in the current directory and selects current file"
  (interactive)
  (w32-shell-execute
   "open"
   "explorer"
   (concat "/e,/select," (convert-standard-filename buffer-file-name))))

(global-set-key [f12]         'explorer)        ; F12 - Open Explorer for the current file path

A nice extra is that the opened explorer will have the current file automatically selected. Press F12 once in a while, it quickly becomes addictive ;)


Arun Ravindran profile pic

Arun Ravindran

Arun is the author of "Django Design Patterns and Best Practices". Works as a Product Manager at Google. Avid open source enthusiast. Keen on Python. Loves to help people learn technology. Find out more about Arun on the about page.

Don't miss any future posts!

Comments →

Next: ▶   DASAVATHAARAM - A Futile Head Spinning Exercise

Prev: ◀   Indie Film Making against Odds

Up: ▲   Blog

Featured Posts

Frequent Tags

banner ad for Django book

Comments

powered by Disqus