In my Emacs config, I have set Firefox to be the browser to open URLs with,

  (setq browse-url-browser-function 'browse-url-firefox)

Now, I have one org-mode file, in which I would like to open URLs with a different program (mpv, to be precise).

What I'm currently trying is a buffer-local variable, indicated by a mode line

# -*- browse-url-browser-function: 'browse-url-chromium -*-

at the top of my org file. However, whenever I click on an org-mode link pointing to a URL (or, just click on a URL, for that matter), I get an error

Debugger entered--Lisp error: (wrong-type-argument listp quote)
  (lambda (path) (browse-url (concat "https:" path)))("//www.google.com/")
  org-open-at-mouse((mouse-2 (#<window 1244 on testfile.org> 192 (163 . 95) 82295534 nil 192 (20 . 4) nil (3 . 9) (8 . 19))))
  funcall-interactively(org-open-at-mouse (mouse-2 (#<window 1244 on yoga.org> 192 (163 . 95) 82295534 nil 192 (20 . 4) nil (3 . 9) (8 . 19))))
  call-interactively(org-open-at-mouse nil nil)

I would appreciate any pointer towards how I can resolve this.


Error is caused by this quote:

# -*- browse-url-browser-function: 'browse-url-chromium -*-

It shouldn't be there.

Open video path in MPV on *nix OS's

Add this line to the init file(.emacs), or evaluate in Scratch buffer

(org-add-link-type "mpv" (lambda (path) (browse-url-xdg-open path)))

browse-url-xdg-open uses xdg-open program that exists on all *nix desktops("X Desktop Group"). It check file extension to decide which program on desktop should open that path.

Custom link in org mode:


mpv: prefix, or any other defined by org-add-link-type
Actually it would open any file according to MIME type known to xdg-open. It would be MPV video player for a video file if it's configured as a default player on a desktop.

  • 2
    You can have Emacs create this line for you if not sure of the syntax. Try: M-x add-file-local-variable-prop-line, which will prompt you for the variable and the value to set. – glucas Jan 12 at 19:25

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.