1 ;;; eww.el --- Emacs Web Wowser
3 ;; Copyright (C) 2013 Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 (eval-when-compile (require 'cl
))
28 (require 'format-spec
)
39 (defcustom eww-header-line-format
"%t: %u"
41 - %t is replaced by the title.
42 - %u is replaced by the URL."
47 (defcustom eww-search-prefix
"https://duckduckgo.com/html/?q="
48 "Prefix URL to search engine"
53 (defface eww-form-submit
54 '((((type x w32 ns
) (class color
)) ; Like default mode line
55 :box
(:line-width
2 :style released-button
)
56 :background
"#808080" :foreground
"black"))
57 "Face for eww buffer buttons."
61 (defface eww-form-checkbox
62 '((((type x w32 ns
) (class color
)) ; Like default mode line
63 :box
(:line-width
2 :style released-button
)
64 :background
"lightgrey" :foreground
"black"))
65 "Face for eww buffer buttons."
69 (defface eww-form-select
70 '((((type x w32 ns
) (class color
)) ; Like default mode line
71 :box
(:line-width
2 :style released-button
)
72 :background
"lightgrey" :foreground
"black"))
73 "Face for eww buffer buttons."
77 (defface eww-form-text
78 '((t (:background
"#505050"
80 :box
(:line-width
1))))
81 "Face for eww text inputs."
85 (defvar eww-current-url nil
)
86 (defvar eww-current-title
""
87 "Title of current page.")
88 (defvar eww-history nil
)
90 (defvar eww-next-url nil
)
91 (defvar eww-previous-url nil
)
92 (defvar eww-up-url nil
)
93 (defvar eww-home-url nil
)
94 (defvar eww-start-url nil
)
95 (defvar eww-contents-url nil
)
99 "Fetch URL and render the page.
100 If the input doesn't look like an URL or a domain name, the
101 word(s) will be searched for via `eww-search-prefix'."
102 (interactive "sEnter URL or keywords: ")
103 (if (and (= (length (split-string url
)) 1)
104 (> (length (split-string url
"\\.")) 1))
106 (unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url
)
107 (setq url
(concat "http://" url
)))
108 ;; some site don't redirect final /
109 (when (string= (url-filename (url-generic-parse-url url
)) "")
110 (setq url
(concat url
"/"))))
111 (unless (string-match-p "^file:" url
)
112 (setq url
(concat eww-search-prefix
113 (replace-regexp-in-string " " "+" url
)))))
114 (url-retrieve url
'eww-render
(list url
)))
117 (defun eww-open-file (file)
118 "Render a file using EWW."
119 (interactive "fFile: ")
120 (eww (concat "file://" (expand-file-name file
))))
122 (defun eww-render (status url
&optional point
)
123 (let ((redirect (plist-get status
:redirect
)))
125 (setq url redirect
)))
126 (set (make-local-variable 'eww-next-url
) nil
)
127 (set (make-local-variable 'eww-previous-url
) nil
)
128 (set (make-local-variable 'eww-up-url
) nil
)
129 (set (make-local-variable 'eww-home-url
) nil
)
130 (set (make-local-variable 'eww-start-url
) nil
)
131 (set (make-local-variable 'eww-contents-url
) nil
)
132 (let* ((headers (eww-parse-headers))
134 (and (string-match "#\\(.*\\)" url
)
135 (match-string 1 url
)))
137 (mail-header-parse-content-type
138 (or (cdr (assoc "content-type" headers
))
142 (or (cdr (assq 'charset
(cdr content-type
)))
143 (eww-detect-charset (equal (car content-type
)
146 (data-buffer (current-buffer)))
150 ((equal (car content-type
) "text/html")
151 (eww-display-html charset url
))
152 ((string-match "^image/" (car content-type
))
155 (eww-display-raw charset
)))
160 (let ((point (next-single-property-change
161 (point-min) 'shr-target-id
)))
163 (goto-char (1+ point
)))))))
164 (kill-buffer data-buffer
))))
166 (defun eww-parse-headers ()
168 (goto-char (point-min))
169 (while (and (not (eobp))
171 (when (looking-at "\\([^:]+\\): *\\(.*\\)")
172 (push (cons (downcase (match-string 1))
180 (defun eww-detect-charset (html-p)
181 (let ((case-fold-search t
)
185 "<meta[\t\n\r ]+[^>]*charset=\"?\\([^\t\n\r \"/>]+\\)[\\\"'.*]" nil t
)
189 "[\t\n\r ]*<\\?xml[\t\n\r ]+[^>]*encoding=\"\\([^\"]+\\)")
192 (defun eww-display-html (charset url
)
193 (unless (eq charset
'utf8
)
194 (decode-coding-region (point) (point-max) charset
))
197 'base
(list (cons 'href url
))
198 (libxml-parse-html-region (point) (point-max)))))
200 (setq eww-current-url url
)
201 (eww-update-header-line-format)
202 (let ((inhibit-read-only t
)
203 (after-change-functions nil
)
205 (shr-external-rendering-functions
206 '((title . eww-tag-title
)
207 (form . eww-tag-form
)
208 (input . eww-tag-input
)
209 (textarea . eww-tag-textarea
)
210 (body . eww-tag-body
)
211 (select . eww-tag-select
)
212 (link . eww-tag-link
)
214 (shr-insert-document document
))
215 (goto-char (point-min))))
217 (defun eww-handle-link (cont)
218 (let* ((rel (assq :rel cont
))
219 (href (assq :href cont
))
221 ;; The text associated with :rel is case-insensitive.
222 (if rel
(downcase (cdr rel
)))
223 '(("next" . eww-next-url
)
224 ;; Texinfo uses "previous", but HTML specifies
225 ;; "prev", so recognize both.
226 ("previous" . eww-previous-url
)
227 ("prev" . eww-previous-url
)
228 ;; HTML specifies "start" but also "contents",
229 ;; and Gtk seems to use "home". Recognize
230 ;; them all; but store them in different
231 ;; variables so that we can readily choose the
233 ("start" . eww-start-url
)
234 ("home" . eww-home-url
)
235 ("contents" . eww-contents-url
)
236 ("up" . eww-up-url
)))))
239 (set (cdr where
) (cdr href
)))))
241 (defun eww-tag-link (cont)
242 (eww-handle-link cont
)
245 (defun eww-tag-a (cont)
246 (eww-handle-link cont
)
249 (defun eww-update-header-line-format ()
250 (if eww-header-line-format
251 (setq header-line-format
252 (replace-regexp-in-string
254 (format-spec eww-header-line-format
255 `((?u .
,eww-current-url
)
256 (?t .
,eww-current-title
)))))
257 (setq header-line-format nil
)))
259 (defun eww-tag-title (cont)
260 (setq eww-current-title
"")
262 (when (eq (car sub
) 'text
)
263 (setq eww-current-title
(concat eww-current-title
(cdr sub
)))))
264 (eww-update-header-line-format))
266 (defun eww-tag-body (cont)
267 (let* ((start (point))
268 (fgcolor (cdr (or (assq :fgcolor cont
)
270 (bgcolor (cdr (assq :bgcolor cont
)))
271 (shr-stylesheet (list (cons 'color fgcolor
)
272 (cons 'background-color bgcolor
))))
274 (eww-colorize-region start
(point) fgcolor bgcolor
)))
276 (defun eww-colorize-region (start end fg
&optional bg
)
278 (let ((new-colors (shr-color-check fg bg
)))
281 (add-face-text-property start end
282 (list :foreground
(cadr new-colors
))
285 (add-face-text-property start end
286 (list :background
(car new-colors
))
289 (defun eww-display-raw (charset)
290 (let ((data (buffer-substring (point) (point-max))))
292 (let ((inhibit-read-only t
))
294 (goto-char (point-min))))
296 (defun eww-display-image ()
297 (let ((data (buffer-substring (point) (point-max))))
299 (let ((inhibit-read-only t
))
300 (shr-put-image data nil
))
301 (goto-char (point-min))))
303 (defun eww-setup-buffer ()
304 (pop-to-buffer (get-buffer-create "*eww*"))
306 (let ((inhibit-read-only t
))
311 (let ((map (make-sparse-keymap)))
312 (suppress-keymap map
)
313 (define-key map
"q" 'eww-quit
)
314 (define-key map
"g" 'eww-reload
)
315 (define-key map
[tab] 'shr-next-link)
316 (define-key map [backtab] 'shr-previous-link)
317 (define-key map [delete] 'scroll-down-command)
318 (define-key map "\177" 'scroll-down-command)
319 (define-key map " " 'scroll-up-command)
320 (define-key map "l" 'eww-back-url)
321 (define-key map "n" 'eww-next-url)
322 (define-key map "p" 'eww-previous-url)
323 (define-key map "u" 'eww-up-url)
324 (define-key map "t" 'eww-top-url)
325 (define-key map "w" 'eww-browse-with-external-browser)
326 (define-key map "y" 'eww-yank-page-url)
329 (define-derived-mode eww-mode nil "eww"
330 "Mode for browsing the web.
333 (set (make-local-variable 'eww-current-url) 'author)
334 (set (make-local-variable 'browse-url-browser-function) 'eww-browse-url)
335 (set (make-local-variable 'after-change-functions) 'eww-process-text-input)
336 ;;(setq buffer-read-only t)
339 (defun eww-browse-url (url &optional new-window)
340 (when (and (equal major-mode 'eww-mode)
342 (push (list eww-current-url (point))
347 "Exit the Emacs Web Wowser."
349 (setq eww-history nil)
350 (kill-buffer (current-buffer)))
352 (defun eww-back-url ()
353 "Go to the previously displayed page."
355 (when (zerop (length eww-history))
356 (error "No previous page"))
357 (let ((prev (pop eww-history)))
358 (url-retrieve (car prev) 'eww-render (list (car prev) (cadr prev)))))
360 (defun eww-next-url ()
361 "Go to the page marked `next'.
362 A page is marked `next' if rel=\"next\" appears in a <link>
366 (eww-browse-url (shr-expand-url eww-next-url eww-current-url))
367 (error "No `next' on this page")))
369 (defun eww-previous-url ()
370 "Go to the page marked `previous'.
371 A page is marked `previous' if rel=\"previous\" appears in a <link>
375 (eww-browse-url (shr-expand-url eww-previous-url eww-current-url))
376 (error "No `previous' on this page")))
379 "Go to the page marked `up'.
380 A page is marked `up' if rel=\"up\" appears in a <link>
384 (eww-browse-url (shr-expand-url eww-up-url eww-current-url))
385 (error "No `up' on this page")))
387 (defun eww-top-url ()
388 "Go to the page marked `top'.
389 A page is marked `top' if rel=\"start\", rel=\"home\", or rel=\"contents\"
390 appears in a <link> or <a> tag."
392 (let ((best-url (or eww-start-url
396 (eww-browse-url (shr-expand-url best-url eww-current-url))
397 (error "No `top' for this page"))))
400 "Reload the current page."
402 (url-retrieve eww-current-url 'eww-render
403 (list eww-current-url (point))))
407 (defvar eww-form nil)
409 (defvar eww-submit-map
410 (let ((map (make-sparse-keymap)))
411 (define-key map "\r" 'eww-submit)
412 (define-key map [(control c) (control c)] 'eww-submit)
415 (defvar eww-checkbox-map
416 (let ((map (make-sparse-keymap)))
417 (define-key map [space] 'eww-toggle-checkbox)
418 (define-key map "\r" 'eww-toggle-checkbox)
419 (define-key map [(control c) (control c)] 'eww-submit)
423 (let ((map (make-keymap)))
424 (set-keymap-parent map text-mode-map)
425 (define-key map "\r" 'eww-submit)
426 (define-key map [(control a)] 'eww-beginning-of-text)
427 (define-key map [(control c) (control c)] 'eww-submit)
428 (define-key map [(control e)] 'eww-end-of-text)
429 (define-key map [tab] 'shr-next-link
)
430 (define-key map
[backtab] 'shr-previous-link)
433 (defvar eww-textarea-map
434 (let ((map (make-keymap)))
435 (set-keymap-parent map text-mode-map)
436 (define-key map "\r" 'forward-line)
437 (define-key map [(control c) (control c)] 'eww-submit)
438 (define-key map [tab] 'shr-next-link)
439 (define-key map [backtab] 'shr-previous-link
)
442 (defvar eww-select-map
443 (let ((map (make-sparse-keymap)))
444 (define-key map
"\r" 'eww-change-select
)
445 (define-key map
[(control c
) (control c
)] 'eww-submit
)
448 (defun eww-beginning-of-text ()
449 "Move to the start of the input field."
451 (goto-char (eww-beginning-of-field)))
453 (defun eww-end-of-text ()
454 "Move to the end of the text in the input field."
456 (goto-char (eww-end-of-field))
457 (let ((start (eww-beginning-of-field)))
458 (while (and (equal (following-char) ?
)
461 (when (> (point) start
)
464 (defun eww-beginning-of-field ()
468 ((not (eq (get-text-property (point) 'eww-form
)
469 (get-text-property (1- (point)) 'eww-form
)))
472 (previous-single-property-change
473 (point) 'eww-form nil
(point-min)))))
475 (defun eww-end-of-field ()
476 (1- (next-single-property-change
477 (point) 'eww-form nil
(point-max))))
479 (defun eww-tag-form (cont)
481 (list (assq :method cont
)
482 (assq :action cont
)))
484 (shr-ensure-paragraph)
489 (when (> (point) start
)
490 (put-text-property start
(1+ start
)
491 'eww-form eww-form
))))
493 (defun eww-form-submit (cont)
494 (let ((start (point))
495 (value (cdr (assq :value cont
))))
497 (if (zerop (length value
))
501 (add-face-text-property start
(point) 'eww-form-submit
)
502 (put-text-property start
(point) 'eww-form
503 (list :eww-form eww-form
506 :name
(cdr (assq :name cont
))))
507 (put-text-property start
(point) 'keymap eww-submit-map
)
510 (defun eww-form-checkbox (cont)
511 (let ((start (point)))
512 (if (cdr (assq :checked cont
))
515 (add-face-text-property start
(point) 'eww-form-checkbox
)
516 (put-text-property start
(point) 'eww-form
517 (list :eww-form eww-form
518 :value
(cdr (assq :value cont
))
519 :type
(downcase (cdr (assq :type cont
)))
520 :checked
(cdr (assq :checked cont
))
521 :name
(cdr (assq :name cont
))))
522 (put-text-property start
(point) 'keymap eww-checkbox-map
)
525 (defun eww-form-text (cont)
526 (let ((start (point))
527 (type (downcase (or (cdr (assq :type cont
))
529 (value (or (cdr (assq :value cont
)) ""))
530 (width (string-to-number
531 (or (cdr (assq :size cont
))
534 (when (< (length value
) width
)
535 (insert (make-string (- width
(length value
)) ?
)))
536 (put-text-property start
(point) 'face
'eww-form-text
)
537 (put-text-property start
(point) 'local-map eww-text-map
)
538 (put-text-property start
(point) 'inhibit-read-only t
)
539 (put-text-property start
(point) 'eww-form
540 (list :eww-form eww-form
543 :name
(cdr (assq :name cont
))))
546 (defun eww-process-text-input (beg end length
)
547 (let* ((form (get-text-property end
'eww-form
))
548 (properties (text-properties-at end
))
549 (type (plist-get form
:type
)))
551 (member type
'("text" "password" "textarea")))
554 ;; Delete some space at the end.
557 (if (equal type
"textarea")
558 (1- (line-end-position))
560 (let ((new (- end beg
)))
561 (while (and (> new
0)
562 (eql (following-char) ?
))
563 (delete-region (point) (1+ (point)))
564 (setq new
(1- new
))))
565 (set-text-properties beg end properties
)))
570 (if (equal type
"textarea")
571 (1- (line-end-position))
573 (let ((start (point)))
574 (insert (make-string length ?
))
575 (set-text-properties start
(point) properties
)))))
576 (let ((value (buffer-substring-no-properties
577 (eww-beginning-of-field)
578 (eww-end-of-field))))
579 (when (string-match " +\\'" value
)
580 (setq value
(substring value
0 (match-beginning 0))))
581 (plist-put form
:value value
)
582 (when (equal type
"password")
583 ;; Display passwords as asterisks.
584 (let ((start (eww-beginning-of-field)))
585 (put-text-property start
(+ start
(length value
))
586 'display
(make-string (length value
) ?
*))))))))
588 (defun eww-tag-textarea (cont)
589 (let ((start (point))
590 (value (or (cdr (assq :value cont
)) ""))
591 (lines (string-to-number
592 (or (cdr (assq :rows cont
))
594 (width (string-to-number
595 (or (cdr (assq :cols cont
))
601 (when (< (count-lines start
(point)) lines
)
602 (dotimes (i (- lines
(count-lines start
(point))))
604 (setq end
(point-marker))
606 (while (< (point) end
)
608 (let ((pad (- width
(- (point) (line-beginning-position)))))
610 (insert (make-string pad ?
))))
611 (add-face-text-property (line-beginning-position)
612 (point) 'eww-form-text
)
613 (put-text-property (line-beginning-position) (point)
614 'local-map eww-textarea-map
)
616 (put-text-property start
(point) 'eww-form
617 (list :eww-form eww-form
620 :name
(cdr (assq :name cont
))))))
622 (defun eww-tag-input (cont)
623 (let ((type (downcase (or (cdr (assq :type cont
))
627 ((or (equal type
"checkbox")
628 (equal type
"radio"))
629 (eww-form-checkbox cont
))
630 ((equal type
"submit")
631 (eww-form-submit cont
))
632 ((equal type
"hidden")
633 (let ((form eww-form
)
634 (name (cdr (assq :name cont
))))
635 ;; Don't add <input type=hidden> elements repeatedly.
637 (or (not (consp (car form
)))
638 (not (eq (caar form
) 'hidden
))
639 (not (equal (plist-get (cdr (car form
)) :name
)
641 (setq form
(cdr form
)))
643 (nconc eww-form
(list
646 :value
(cdr (assq :value cont
))))))))
648 (eww-form-text cont
)))
649 (unless (= start
(point))
650 (put-text-property start
(1+ start
) 'help-echo
"Input field"))))
652 (defun eww-tag-select (cont)
653 (shr-ensure-paragraph)
654 (let ((menu (list :name
(cdr (assq :name cont
))
660 (when (eq (car elem
) 'option
)
661 (when (cdr (assq :selected
(cdr elem
)))
662 (nconc menu
(list :value
663 (cdr (assq :value
(cdr elem
))))))
664 (let ((display (or (cdr (assq 'text
(cdr elem
))) "")))
665 (setq max
(max max
(length display
)))
667 :value
(cdr (assq :value
(cdr elem
)))
671 (setq options
(nreverse options
))
672 ;; If we have no selected values, default to the first value.
673 (unless (plist-get menu
:value
)
674 (nconc menu
(list :value
(nth 2 (car options
)))))
676 (let ((selected (eww-select-display menu
)))
678 (make-string (- max
(length selected
)) ?
)))
679 (put-text-property start
(point) 'eww-form menu
)
680 (add-face-text-property start
(point) 'eww-form-select
)
681 (put-text-property start
(point) 'keymap eww-select-map
)
682 (shr-ensure-paragraph))))
684 (defun eww-select-display (select)
685 (let ((value (plist-get select
:value
))
687 (dolist (elem select
)
688 (when (and (consp elem
)
689 (eq (car elem
) 'item
)
690 (equal value
(plist-get (cdr elem
) :value
)))
691 (setq display
(plist-get (cdr elem
) :display
))))
694 (defun eww-change-select ()
695 "Change the value of the select drop-down menu under point."
697 (let* ((input (get-text-property (point) 'eww-form
))
698 (properties (text-properties-at (point)))
699 (completion-ignore-case t
)
702 (mapcar (lambda (elem)
704 (eq (car elem
) 'item
)
705 (cons (plist-get (cdr elem
) :display
)
706 (plist-get (cdr elem
) :value
))))
709 (completing-read "Change value: " options nil
'require-match
))
710 (inhibit-read-only t
))
711 (plist-put input
:value
(cdr (assoc-string display options t
)))
713 (eww-update-field display
))))
715 (defun eww-update-field (string)
716 (let ((properties (text-properties-at (point)))
717 (start (eww-beginning-of-field))
718 (end (1+ (eww-end-of-field))))
719 (delete-region start end
)
721 (make-string (- (- end start
) (length string
)) ?
))
722 (set-text-properties start end properties
)
725 (defun eww-toggle-checkbox ()
726 "Toggle the value of the checkbox under point."
728 (let* ((input (get-text-property (point) 'eww-form
))
729 (type (plist-get input
:type
)))
730 (if (equal type
"checkbox")
733 (if (plist-get input
:checked
)
735 (plist-put input
:checked nil
)
736 (eww-update-field "[ ]"))
737 (plist-put input
:checked t
)
738 (eww-update-field "[X]"))))
739 ;; Radio button. Switch all other buttons off.
740 (let ((name (plist-get input
:name
)))
742 (dolist (elem (eww-inputs (plist-get input
:eww-form
)))
743 (when (equal (plist-get (cdr elem
) :name
) name
)
744 (goto-char (car elem
))
745 (if (not (eq (cdr elem
) input
))
747 (plist-put input
:checked nil
)
748 (eww-update-field "[ ]"))
749 (plist-put input
:checked t
)
750 (eww-update-field "[X]")))))
753 (defun eww-inputs (form)
754 (let ((start (point-min))
757 (< start
(point-max)))
758 (when (or (get-text-property start
'eww-form
)
759 (setq start
(next-single-property-change start
'eww-form
)))
760 (when (eq (plist-get (get-text-property start
'eww-form
) :eww-form
)
762 (push (cons start
(get-text-property start
'eww-form
))
764 (setq start
(next-single-property-change start
'eww-form
))))
767 (defun eww-input-value (input)
768 (let ((type (plist-get input
:type
))
769 (value (plist-get input
:value
)))
771 ((equal type
"textarea")
774 (goto-char (point-min))
775 (while (re-search-forward "^ +\n\\| +$" nil t
)
776 (replace-match "" t t
))
779 (if (string-match " +\\'" value
)
780 (substring value
0 (match-beginning 0))
784 "Submit the current form."
786 (let* ((this-input (get-text-property (point) 'eww-form
))
787 (form (plist-get this-input
:eww-form
))
789 (dolist (elem (sort (eww-inputs form
)
791 (< (car o1
) (car o2
)))))
792 (let* ((input (cdr elem
))
793 (input-start (car elem
))
794 (name (plist-get input
:name
)))
797 ((member (plist-get input
:type
) '("checkbox" "radio"))
798 (when (plist-get input
:checked
)
799 (push (cons name
(plist-get input
:value
))
801 ((equal (plist-get input
:type
) "submit")
802 ;; We want the values from buttons if we hit a button if
803 ;; we hit enter on it, or if it's the first button after
804 ;; the field we did hit return on.
805 (when (or (eq input this-input
)
806 (and (not (eq input this-input
))
808 (> input-start
(point))))
810 (push (cons name
(plist-get input
:value
))
813 (push (cons name
(eww-input-value input
))
816 (when (and (consp elem
)
817 (eq (car elem
) 'hidden
))
818 (push (cons (plist-get (cdr elem
) :name
)
819 (plist-get (cdr elem
) :value
))
821 (if (and (stringp (cdr (assq :method form
)))
822 (equal (downcase (cdr (assq :method form
))) "post"))
823 (let ((url-request-method "POST")
824 (url-request-extra-headers
825 '(("Content-Type" .
"application/x-www-form-urlencoded")))
826 (url-request-data (mm-url-encode-www-form-urlencoded values
)))
827 (eww-browse-url (shr-expand-url (cdr (assq :action form
))
831 (if (cdr (assq :action form
))
832 (shr-expand-url (cdr (assq :action form
))
836 (mm-url-encode-www-form-urlencoded values
))))))
838 (defun eww-browse-with-external-browser ()
839 "Browse the current URL with an external browser.
840 The browser to used is specified by the `shr-external-browser' variable."
842 (funcall shr-external-browser eww-current-url
))
844 (defun eww-yank-page-url ()
846 (message eww-current-url
)
847 (kill-new eww-current-url
))