7

I want to open a.html in a browser from emacs (v. 24.5.1, using -Q [updated after comment]).

M-x shell-command
xdg-open a.html

works as expected, but

M-x eshell
$ xdg-open a.html

does not seem to do anything. There is no error message. This problem also occurs when exporting and directly opening html files from org-mode.

  • This seems to work in my config. Does it not work for you in emacs -Q? – PythonNut Jan 7 '16 at 17:53
  • I've updated the question -- I was already using emacs -q -Q – Jannis Teunissen Jan 7 '16 at 17:58
  • 1
    @JannisTeunissen Unless I am mistaken, -Q includes the -q option, so -q -Q will be the same as -Q – elethan Jan 7 '16 at 18:41
  • Also, this does not answer the question as to why xdg-open does not work in eshell, but you can use the command browse-url-of-file called from a buffer visiting a.html to open that file in your default browser. – elethan Jan 7 '16 at 18:44
  • 2
    Try setting process-connection-type to nil (you can just type (setq process-connection-type nil) at the eshell prompt). (By the way, while this works on my machine, I don't understand why it works.) – Omar Jan 7 '16 at 23:01
4

Set process-connection-type to nil. To be honest I don't understand why xdg-open doesn't work when that variable has the value t and I also can't remember how I learned that changing the value let me use xdg-open from Emacs. (If someone knows, I'd love to hear about it.)

  • Hm, can't reproduce this here on my Linux machine. Is this by any chance linked to the operating system Emacs runs on? – wasamasa Jan 8 '16 at 8:43
  • The problem occurred on Debian unstable and Fedora 22 – Jannis Teunissen Jan 8 '16 at 14:10
0

Using setsid -w $shell_cmd is better, because of (setq process-connection-type nil) causing some problems like sudo: no tty present and no askpass program specified when using M-& sudo $shell_cmd.

REF

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.