branch: externals/embark commit e7a921060c867c2e61cea42ff10fde92a36be445 Merge: 34272d51c5 23577c7fe8 Author: Omar AntolĂn Camarena <omar.anto...@gmail.com> Commit: GitHub <nore...@github.com>
Merge pull request #573 from minad/open-externally Revert "Remove embark-open-externally to avoid duplication with consult" --- embark-consult.el | 2 -- embark.el | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/embark-consult.el b/embark-consult.el index 8b0a39570a..b53192425a 100644 --- a/embark-consult.el +++ b/embark-consult.el @@ -275,8 +275,6 @@ This function is meant to be added to `embark-collect-mode-hook'." ;;; Bindings for consult commands in embark keymaps -(define-key embark-file-map "x" #'consult-file-externally) - (define-key embark-become-file+buffer-map "Cb" #'consult-buffer) (define-key embark-become-file+buffer-map "C4b" #'consult-buffer-other-window) diff --git a/embark.el b/embark.el index 44366ce7fa..cb47c4db50 100644 --- a/embark.el +++ b/embark.el @@ -3597,6 +3597,19 @@ with command output. For replacement behaviour see command (and replace (current-buffer))))) +(defun embark-open-externally (file) + "Open FILE using system's default application." + (interactive "fOpen: ") + (if (and (eq system-type 'windows-nt) + (fboundp 'w32-shell-execute)) + (w32-shell-execute "open" file) + (call-process (pcase system-type + ('darwin "open") + ('cygwin "cygstart") + (_ "xdg-open")) + nil 0 nil + (expand-file-name file)))) + (defun embark-bury-buffer (buf) "Bury buffer BUF." (interactive "bBuffer: ") @@ -4020,6 +4033,7 @@ library, which have an obvious notion of associated directory." ("\\" embark-recentf-remove) ("I" embark-insert-relative-path) ("W" embark-save-relative-path) + ("x" embark-open-externally) ("e" eww-open-file) ("l" load-file) ("b" byte-compile-file)