Emacs Dired: Opening Files in External Apps

2012-03-03, for latest update, see: http://xahlee.org/emacs/emacs_dired_open_file_in_ext_apps.html

Here's a simple elisp code that opens the current directory in desktop.

(defun open-in-desktop ()
  "Open the current file in desktop.
Works in Microsoft Windows, Mac OS X, Linux."
   ((string-equal system-type "windows-nt")
    (w32-shell-execute "explore" (replace-regexp-in-string "/" "\\" default-directory t t)))
   ((string-equal system-type "darwin") (shell-command "open ."))
   ((string-equal system-type "gnu/linux") (shell-command "xdg-open ."))
   ) )

(this command is bundled with ErgoEmacs Keybinding, with key 【Ctrl+Shift+o】)

You can give the command a hotkey. (See: Emacs: How to Define Keyboard Shortcuts.)

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs