Improve prelude-open-with
Now it uses `xdg-open` where it makes sense. It also accepts a prefix argument that forces manual selection of a command to run.
This commit is contained in:
parent
ecbcc19c6d
commit
d7d3a8fc36
1 changed files with 9 additions and 6 deletions
|
@ -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))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue