xwidget-plus.el 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 "25.3"))
  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, or (at your option)
  15. ;; any later version.
  16. ;;
  17. ;; This program is distributed in the hope that it will be useful,
  18. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. ;; GNU General Public License for more details.
  21. ;;
  22. ;; You should have received a copy of the GNU General Public License
  23. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  24. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  25. ;; Boston, MA 02110-1301, USA.
  26. ;;; Code:
  27. ;;; User customizable variable
  28. ;;
  29. ;;; Code:
  30. (require 'xwidget-plus-common)
  31. (require 'xwidget-plus-follow-link)
  32. ;;;###autoload
  33. (defun xwidget-plus-browse-url (url &optional new-session)
  34. "Ask xwidget-webkit to browse URL.
  35. NEW-SESSION specifies whether to create a new xwidget-webkit session.
  36. Interactively, URL defaults to the string looking like a url around point."
  37. (interactive (progn
  38. (require 'browse-url)
  39. (browse-url-interactive-arg "xwidget-webkit URL: "
  40. ;;(xwidget-webkit-current-url)
  41. )))
  42. (or (featurep 'xwidget-internal)
  43. (user-error "Your Emacs was not compiled with xwidgets support"))
  44. (when (stringp url)
  45. (if new-session
  46. (xwidget-webkit-new-session url)
  47. (progn (xwidget-webkit-goto-url url)
  48. (switch-to-buffer-other-window (xwidget-buffer (xwidget-webkit-current-session)))))))
  49. (provide 'xwidget-plus)
  50. ;;; xwidget-plus.el ends here