Function: url-handler-mode

url-handler-mode is an autoloaded, interactive and byte-compiled function defined in url-handlers.el.gz.

Signature

(url-handler-mode &optional ARG)

Documentation

Handle URLs as if they were file names throughout Emacs.

After switching on this minor mode, Emacs file primitives handle URLs. For instance:

  (file-exists-p "https://www.gnu.org/")
  => t

and C-x C-f https://www.gnu.org/ RET will give you the HTML at that URL in a buffer.

This is a global minor mode. If called interactively, toggle the Url-Handler mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=url-handler-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

Probably introduced at or before Emacs version 25.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-handlers.el.gz
(defvar url-handler-regexp) ; defined below to avoid recursive load (revno:108572)

;;;###autoload
(define-minor-mode url-handler-mode
  ;; Can't use "\\[find-file]" below as it produces "[open]":
  "Handle URLs as if they were file names throughout Emacs.
After switching on this minor mode, Emacs file primitives handle
URLs.  For instance:

  (file-exists-p \"https://www.gnu.org/\")
  => t

and `C-x C-f https://www.gnu.org/ RET' will give you the HTML at
that URL in a buffer."
  :global t :group 'url
  ;; Remove old entry, if any.
  (setq file-name-handler-alist
	(delq (rassq 'url-file-handler file-name-handler-alist)
	      file-name-handler-alist))
  (if url-handler-mode
      (push (cons url-handler-regexp 'url-file-handler)
	    file-name-handler-alist)))