xwidget-plus.el 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ;;; xwidget-plus.el --- Improve xwidget usability -*- lexical-binding: t; -*-
  2. ;; Author: Damien Merenne
  3. ;; URL: https://github.com/canatella/xwidget-plus
  4. ;; Created: 2020-03-11
  5. ;; Keywords: convenience
  6. ;; Version: 0.1
  7. ;; Package-Requires: ((emacs "26.1"))
  8. ;; This file is NOT part of GNU Emacs.
  9. ;;; Commentary:
  10. ;; This package augment the xwidget-webkit browser to make it more usable.
  11. ;;; License:
  12. ;; This program is free software: you can redistribute it and/or modify
  13. ;; it under the terms of the GNU General Public License as published by
  14. ;; the Free Software Foundation, either version 3 of the License, or
  15. ;; (at your option) any later version.
  16. ;; This program is distributed in the hope that it will be useful,
  17. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;; GNU General Public License for more details.
  20. ;; You should have received a copy of the GNU General Public License
  21. ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. ;;; Code:
  23. (require 'xwidget-plus-common)
  24. (require 'xwidget-plus-follow-link)
  25. ;;;###autoload
  26. (defun xwidget-plus-browse-url (url &optional new-session)
  27. "Ask xwidget-webkit to browse URL.
  28. NEW-SESSION specifies whether to create a new xwidget-webkit session.
  29. Interactively, URL defaults to the string looking like a url around point."
  30. (interactive (progn
  31. (require 'browse-url)
  32. (browse-url-interactive-arg "xwidget-webkit URL: "
  33. ;;(xwidget-webkit-current-url)
  34. )))
  35. (or (featurep 'xwidget-internal)
  36. (user-error "Your Emacs was not compiled with xwidgets support"))
  37. (when (stringp url)
  38. (if new-session
  39. (xwidget-webkit-new-session url)
  40. (progn (xwidget-webkit-goto-url url)
  41. (switch-to-buffer-other-window (xwidget-buffer (xwidget-webkit-current-session)))))))
  42. (provide 'xwidget-plus)
  43. ;;; xwidget-plus.el ends here