diff --git a/core/prelude-core.el b/core/prelude-core.el index 6ec11d5..a4c4b68 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -35,14 +35,17 @@ (require 'thingatpt) (require 'dash) -(defun prelude-open-with () - "Open visited file in external program." - (interactive) +(defun prelude-open-with (arg) + "Open visited file in default external program. + +With a prefix ARG always prompt for command to use." + (interactive "P") (when buffer-file-name (shell-command (concat - (if (eq system-type 'darwin) - "open" - (read-shell-command "Open current file with: ")) + (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: "))) " " buffer-file-name))))