Thursday, July 5, 2012

Dired on steroids - Sunrise command mode

Found a nice extension to emacs dired: Sunrise.

If you want to open files in external apps from Sunrise mode add the lines below in your ".emacs"

(defun lx-sunrise-display-external ()
      "Open file at point in an external application."
      (interactive)
      (let ((file (dired-get-filename)))
        (call-process shell-file-name nil nil nil shell-command-switch
                  (format "%s \"%s\"" lx-sunrise-external-viewer file))))
    (setq lx-sunrise-external-viewer "open")
    (define-key sr-mode-map '[\C-return] 'lx-sunrise-display-external)
Now you should be able to open files with external apps with C-return. I have only tried this with OS X Emacs 24.