Merge branch 'master' of github.com:bbatsov/prelude

This commit is contained in:
Bozhidar Batsov 2014-05-15 17:12:12 +03:00
commit 5366fdc3ea

View file

@ -37,17 +37,22 @@
(defun prelude-open-with (arg) (defun prelude-open-with (arg)
"Open visited file in default external program. "Open visited file in default external program.
When in dired mode, open file under the cursor.
With a prefix ARG always prompt for command to use." With a prefix ARG always prompt for command to use."
(interactive "P") (interactive "P")
(when buffer-file-name (let ((current-file-name
(start-process "prelude-open-with-process" (if (eq major-mode 'dired-mode)
"*prelude-open-with-output*" (dired-get-file-for-visit)
(cond buffer-file-name)))
((and (not arg) (eq system-type 'darwin)) "open") (when current-file-name
((and (not arg) (member system-type '(gnu gnu/linux gnu/kfreebsd))) "xdg-open") (start-process "prelude-open-with-process"
(t (read-shell-command "Open current file with: "))) "*prelude-open-with-output*"
(shell-quote-argument buffer-file-name)))) (cond
((and (not arg) (eq system-type 'darwin)) "open")
((and (not arg) (member system-type '(gnu gnu/linux gnu/kfreebsd))) "xdg-open")
(t (read-shell-command "Open current file with: ")))
(shell-quote-argument current-file-name)))))
(defun prelude-buffer-mode (buffer-or-name) (defun prelude-buffer-mode (buffer-or-name)
"Retrieve the `major-mode' of BUFFER-OR-NAME." "Retrieve the `major-mode' of BUFFER-OR-NAME."