[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: How to make browse-url-default-browser use emacs-w3m?



In [emacs-w3m : No.12263] jidanni@xxxxxxxxxxx wrote:
> How do I make
> (define-key dired-mode-map "b" 'browse-url-of-dired-file)
> use emacs-w3m and not Firefox.
> Should I do
> (... browse-url-default-browser ... w3m-browse-url) ?

If you want the dired command "b" to run `w3m-browse-url' regardless
of any default or customized browse-url-* variables setting, try:

(define-key dired-mode-map "b"
  (lambda ()
    (interactive)
    (let ((browse-url-browser-function #'w3m-browse-url))
      (call-interactively #'browse-url-of-dired-file))))

Otherwise:

(defun my-browse-url-of-dired-file ()
  "Run `browse-url-of-dired-file' using emacs-w3m."
  (interactive)
  (let ((browse-url-browser-function #'w3m-browse-url))
    (call-interactively #'browse-url-of-dired-file)))

(define-key dired-mode-map "b" #'my-browse-url-of-dired-file)