0

When trying to open URL link in emacs under MSYS2 I get the error browse-url-default-windows-browser: Searching for program: No such file or directory, cygstart. Looking into the function browse-url-default-windows-browser I found out that it needed to call process cygstart:

    (defun browse-url-default-windows-browser (url &optional _new-window)
      "Invoke the MS-Windows system's default Web browser.
    The optional NEW-WINDOW argument is not used."
    <...>
    ((eq system-type 'cygwin)
             (call-process "cygstart" nil nil nil url))

But there is no cygstart in MSYS2 according to its wiki How does MSYS2 differ from Cygwin. Though the variable system-type really equals 'cygwin and cannot be changed to anything more appropriate.

How to fix this error?

Drew
  • 77,472
  • 10
  • 114
  • 243
Evgeny Mikhaylov
  • 179
  • 1
  • 15

2 Answers2

0

It seems that start works. I made the following change to browse-url.el and then reloaded it with load-file. There is probably a more elegant way of doing this that doesn't involve modifying browse-url.el.

((eq system-type 'cygwin)
 (shell-command (concat "start " (shell-quote-argument url)))))
Drew
  • 77,472
  • 10
  • 114
  • 243
0

Building on @rucarden's solution I found you can use browse-url-browser-function to replace the original one inside your .emacs. It's a documented setting in browser.el.

(when (eq system-type 'cygwin)
  (setq
   browse-url-browser-function
   (lambda (url &optional _new-window)
     (interactive (browse-url-interactive-arg "URL: "))
     (shell-command (concat "start " (shell-quote-argument url)())))))
ninzine
  • 16