Fix opening links from WSL
This commit is contained in:
parent
1f6f4d911e
commit
b542b922a0
23
config.el
23
config.el
@ -427,6 +427,29 @@
|
||||
;; Enable the fill column indicator.
|
||||
(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
|
||||
|
||||
;; Allow Emacs in WSL to open links in a browser on the Windows host.
|
||||
(when (and (eq system-type 'gnu/linux)
|
||||
(string-match
|
||||
"Linux.*Microsoft.*Linux"
|
||||
(shell-command-to-string "uname -a")))
|
||||
(setq
|
||||
browse-url-generic-program "/mnt/c/Windows/System32/cmd.exe"
|
||||
browse-url-generic-args '("/c" "start")
|
||||
browse-url-browser-function #'browse-url-generic)
|
||||
|
||||
(defun +x/browse-url-of-dired-file ()
|
||||
"In Dired, ask a WWW browser to display the file named on this line."
|
||||
(interactive)
|
||||
(let ((tem (dired-get-filename t t)))
|
||||
(if tem
|
||||
(browse-url-of-file (concat "file://///wsl$/"
|
||||
(getenv "WSL_DISTRO_NAME")
|
||||
(expand-file-name tem)))
|
||||
(error "No file on this line"))))
|
||||
|
||||
(map! (:map dired-mode-map
|
||||
"W" #'+x/browse-url-of-dired-file)))
|
||||
|
||||
;; -----------------------------------------------------------------------------
|
||||
;; Global keybindings.
|
||||
;; -----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user