From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: eww Date: Mon, 01 Jul 2013 18:48:25 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87k3l96gna.fsf@lifelogs.com> References: <87d2rkb1pi.fsf@fleche.redhat.com> <87fvwfa3ev.fsf@fleche.redhat.com> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1372718931 30240 80.91.229.3 (1 Jul 2013 22:48:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Jul 2013 22:48:51 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 02 00:48:49 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Utmts-0003ST-R1 for ged-emacs-devel@m.gmane.org; Tue, 02 Jul 2013 00:48:49 +0200 Original-Received: from localhost ([::1]:40251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utmts-0000gK-H4 for ged-emacs-devel@m.gmane.org; Mon, 01 Jul 2013 18:48:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utmtl-0000g3-Nu for emacs-devel@gnu.org; Mon, 01 Jul 2013 18:48:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Utmth-0004d8-MO for emacs-devel@gnu.org; Mon, 01 Jul 2013 18:48:41 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:43047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utmth-0004d2-FM for emacs-devel@gnu.org; Mon, 01 Jul 2013 18:48:37 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Utmtg-0003FN-52 for emacs-devel@gnu.org; Tue, 02 Jul 2013 00:48:36 +0200 Original-Received: from pool-72-93-34-251.bstnma.east.verizon.net ([72.93.34.251]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Jul 2013 00:48:36 +0200 Original-Received: from tzz by pool-72-93-34-251.bstnma.east.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Jul 2013 00:48:36 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 102 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pool-72-93-34-251.bstnma.east.verizon.net X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:wLIzMidmdNh8LjZSNGv1jPtcZLw= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161433 Archived-At: --=-=-= Content-Type: text/plain On Thu, 20 Jun 2013 11:01:47 +0200 Lars Magne Ingebrigtsen wrote: LMI> Ted Zlatanov writes: >> Let me know if you're planning to implement this or not (so I can do it, >> if not you). LMI> Sure, go ahead. :-) I'm not sure I understand all the buffer magic eww does, so here's an attempt to provide `eww-view-source' under `v' (right now it just calls `debug' on the data). If I edebug `eww-view-source' it has the right data, but I think something is getting lost in translation because the data doesn't show up when I actually hit `v'. If you or someone else know what I've missed, please let me know. It's probably something really simple... Thanks Ted --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=eww-view-source.patch === modified file 'lisp/net/eww.el' --- lisp/net/eww.el 2013-06-28 07:54:42 +0000 +++ lisp/net/eww.el 2013-07-01 22:42:27 +0000 @@ -100,6 +100,7 @@ (defvar eww-home-url nil) (defvar eww-start-url nil) (defvar eww-contents-url nil) +(defvar eww-source-code nil) ;;;###autoload (defun eww (url) @@ -200,11 +201,12 @@ (defun eww-display-html (charset url) (unless (eq charset 'utf8) (decode-coding-region (point) (point-max) charset)) - (let ((document + (let ((source-code (buffer-substring (point) (point-max))) + (document (list 'base (list (cons 'href url)) (libxml-parse-html-region (point) (point-max))))) - (eww-setup-buffer) + (eww-setup-buffer source-code) (setq eww-current-url url) (eww-update-header-line-format) (let ((inhibit-read-only t) @@ -296,7 +298,7 @@ (defun eww-display-raw (charset) (let ((data (buffer-substring (point) (point-max)))) - (eww-setup-buffer) + (eww-setup-buffer data) (let ((inhibit-read-only t)) (insert data)) (goto-char (point-min)))) @@ -308,11 +310,12 @@ (shr-put-image data nil)) (goto-char (point-min)))) -(defun eww-setup-buffer () +(defun eww-setup-buffer (&optional source-code) (pop-to-buffer (get-buffer-create "*eww*")) (let ((inhibit-read-only t)) (remove-overlays) (erase-buffer)) + (set (make-local-variable 'eww-source-code) source-code) (unless (eq major-mode 'eww-mode) (eww-mode))) @@ -334,6 +337,7 @@ (define-key map "t" 'eww-top-url) (define-key map "&" 'eww-browse-with-external-browser) (define-key map "d" 'eww-download) + (define-key map "v" 'eww-view-source) (define-key map "w" 'eww-copy-page-url) (define-key map "C" 'url-cookie-list) @@ -391,6 +395,13 @@ (setq eww-history nil) (kill-buffer (current-buffer))) +(defun eww-view-source () + "View the page source code." + (interactive) + (if eww-source-code + (debug eww-source-code) + (error "No source code available"))) + (defun eww-back-url () "Go to the previously displayed page." (interactive) --=-=-=--