Function: actypes::www-url

actypes::www-url is an interactive and byte-compiled function defined in hsys-www.el.

Signature

(actypes::www-url URL &optional LABEL)

Documentation

Follow a link given by URL and optional text _LABEL.

The variable, browse-url-browser-function, customizes the url browser that is used. Valid values of this variable include browse-url-default-browser and browse-url-generic.

_LABEL is used in hui:link-possible-types with the link-to-url call and
in ibut:insert-text as the name of the implicit button inserted.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hsys-www.el
;; !! TODO: Duplicate of `link-to-url' defact to consider getting rid of
(defact www-url (url &optional _label)
  "Follow a link given by URL and optional text _LABEL.
The variable, `browse-url-browser-function', customizes the url browser that
is used.  Valid values of this variable include `browse-url-default-browser' and
`browse-url-generic'.

_LABEL is used in `hui:link-possible-types' with the `link-to-url' call and
in `ibut:insert-text' as the name of the implicit button inserted."
  (interactive "sURL to follow: ")
  (unless (stringp url)
    (error "(www-url): URL = `%s' but must be a string" url))
  (unless (seq-position url ?:)
    (setq url (concat "https://" url)))
  (if (or (functionp browse-url-browser-function)
	  ;; May be a predicate alist of functions from which to select
	  (consp browse-url-browser-function))
      (let ((browse-url-browser-function
	     (if (eq browse-url-browser-function #'eww-browse-url)
		 ;; Hyperbole-specific version
		 #'www-eww-browse-url
	       browse-url-browser-function))
	    browse-function-name
	    browser)
	(if (symbolp browse-url-browser-function)
	    (setq browse-function-name (symbol-name browse-url-browser-function)
		  browser (and (string-match
				"-\\([^-]+\\)\\'"
				browse-function-name)
			       (capitalize (substring browse-function-name
						      (match-beginning 1)
						      (match-end 1)))))
	  (setq browser "default browser"))
	(message "Sending %s to %s..." url browser)
	(browse-url url)
	(message "Sending %s to %s...done" url browser))
    (error "(www-url): `browse-url-browser-function' must be set to a web browser invoking function")))