xwidget-plus.el 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ;;; xwidget-plus.el --- Improve xwidget usability
  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") (ivy "0.13.0"))
  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 'ivy)
  31. (require 'eieio)
  32. (defgroup xwidget-plus nil
  33. "Augment the xwidget webkit browser."
  34. :group 'convenience)
  35. (defcustom xwidget-plus-follow-link-candidate-style '(("border" . "1px dashed blue")
  36. ("background" . "#0000ff20"))
  37. "Style to apply to candidate links."
  38. :type '(list (cons string string))
  39. :group 'xwidget-plus)
  40. (defcustom xwidget-plus-follow-link-selected-style '(("border" . "1px dashed red")
  41. ("background" . "#ff000020"))
  42. "Style to apply to currently selected link."
  43. :type '(list (cons string string))
  44. :group 'xwidget-plus)
  45. ;; Bring the window to front when summoning browse
  46. (defun xwidget-plus-webkit-browse-url-advise (&rest _)
  47. "Advice to add switch to window when calling `xwidget-webkit-browse-url'."
  48. (switch-to-buffer-other-window (xwidget-buffer (xwidget-webkit-current-session))))
  49. (advice-add #'xwidget-webkit-browse-url :after #'xwidget-plus-webkit-browse-url-advise)
  50. (provide 'xwidget-link)
  51. ;;; xwidget-link.el ends here
  52. ;; Local Variables:
  53. ;; eval: (mmm-mode)
  54. ;; eval: (mmm-add-classes '((elisp-js :submode js-mode :face mmm-code-submode-face :delimiter-mode nil :front "--js \"" :back "\" js--")))
  55. ;; mmm-classes: elisp-js
  56. ;; End: