From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenjiro NAKAYAMA Newsgroups: gmane.emacs.bugs Subject: bug#16236: 24.3.50; [PATCH] eww: eww-history-mode fixup. Date: Sun, 29 Dec 2013 00:00:52 +0900 Message-ID: <87ha9tdnq3.fsf@dhcp-193-97.nrt.redhat.com> References: <87bo06n1gx.fsf@dhcp-193-97.nrt.redhat.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1388242939 9662 80.91.229.3 (28 Dec 2013 15:02:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Dec 2013 15:02:19 +0000 (UTC) To: 16236@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 28 16:02:24 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1VwvPC-0001GR-VZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Dec 2013 16:02:23 +0100 Original-Received: from localhost ([::1]:52484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwvPC-0004Vz-GM for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Dec 2013 10:02:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwvP2-0004Vn-MY for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 10:02:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwvOu-0001W5-0c for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 10:02:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwvOt-0001Vl-UI for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 10:02:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VwvOt-0006Jz-NF for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2013 10:02:03 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87bo06n1gx.fsf@dhcp-193-97.nrt.redhat.com> Resent-From: Kenjiro NAKAYAMA Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Dec 2013 15:02:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16236 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org, 16236@debbugs.gnu.org Original-Received: via spool by 16236-submit@debbugs.gnu.org id=B16236.138824286524160 (code B ref 16236); Sat, 28 Dec 2013 15:02:03 +0000 Original-Received: (at 16236) by debbugs.gnu.org; 28 Dec 2013 15:01:05 +0000 Original-Received: from localhost ([127.0.0.1]:48584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VwvNv-0006Hb-GI for submit@debbugs.gnu.org; Sat, 28 Dec 2013 10:01:04 -0500 Original-Received: from mail-pd0-f180.google.com ([209.85.192.180]:37513) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VwvNs-0006H5-Fd for 16236@debbugs.gnu.org; Sat, 28 Dec 2013 10:01:01 -0500 Original-Received: by mail-pd0-f180.google.com with SMTP id q10so9985871pdj.11 for <16236@debbugs.gnu.org>; Sat, 28 Dec 2013 07:00:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:from:to:subject:date:message-id:mime-version :content-type; bh=VwxSk5/5IsEeEE5mG5+UvxWqXAA9m/ZwHUaGy1Flis0=; b=BHBBeDS6koLLT0G1wKBWJvxrhQjpGTmZLOGS8KZ50J6qtgqSWmNKU4wL1NjZIWovHS YO4yGxHtIt4ZSLNFhcauYKXnhJEqfkfTheY6dZoqw+vSULV87Cw0s6dGk1BsJXu3rRFQ 1HiArc58mOHt0cSpFj7JbrGP3quH0VtJCxtqzJkJIsYK+VlcfLMdIdibLW00dxaoEP0w Udqus7fyMh/hDhqXl+nN1/s374+DCrQVOFN59BYjNrb198ennaiGkqHWg1pVRp485h1m c+EBQYqvdyzIYKkthSToN9EyCbIkdu5FCjdwH2U0vL7FAW5FbuoZbesZkuerELBAYGsM DWuw== X-Received: by 10.68.217.129 with SMTP id oy1mr57911918pbc.23.1388242859221; Sat, 28 Dec 2013 07:00:59 -0800 (PST) Original-Received: from dhcp-193-97.nrt.redhat.com (nat-pool-nrt-t1.redhat.com. [66.187.238.10]) by mx.google.com with ESMTPSA id qf7sm90802132pac.14.2013.12.28.07.00.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Dec 2013 07:00:58 -0800 (PST) User-agent: mu4e 0.9.9.6pre2; emacs 24.3.50.1 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82688 Archived-At: Since current eww-history does not work well, I fixed. Please review and install it to the official tree if appreciated. Signed-off-by: Kenjiro NAKAYAMA * net/eww.el (eww-list-histories,eww-history-browse): Fixup. (eww-history-quit): Delete and use quit-window. (eww-history-kill): Delete, because it doesn't work well and not necessary. (eww-history-mode-map): Delete some keys and add easy-menu. --- lisp/net/eww.el | 90 +++++++++++++++++++++++---------------------------------- 1 file changed, 36 insertions(+), 54 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 25309d1..2fc30b7 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1282,32 +1282,30 @@ Differences in #targets are ignored." (interactive) (when (null eww-history) (error "No eww-histories are defined")) - (set-buffer (get-buffer-create "*eww history*")) - (eww-history-mode) - (let ((inhibit-read-only t) - (domain-length 0) - (title-length 0) - url title format start) - (erase-buffer) - (dolist (history eww-history) - (setq start (point)) - (setq domain-length (max domain-length (length (plist-get history :url)))) - (setq title-length (max title-length (length (plist-get history :title)))) - ) - (setq format (format "%%-%ds %%-%ds" title-length domain-length) - header-line-format - (concat " " (format format "Title" "URL"))) - - (dolist (history eww-history) - (setq url (plist-get history :url)) - (setq title (plist-get history :title)) - (insert (format format title url)) - (insert "\n") - (put-text-property start (point) 'eww-history history) - ) - (goto-char (point-min))) - (pop-to-buffer "*eww history*") - ) + (let ((eww-history-trans eww-history)) + (set-buffer (get-buffer-create "*eww history*")) + (eww-history-mode) + (let ((inhibit-read-only t) + (domain-length 0) + (title-length 0) + url title format start) + (erase-buffer) + (dolist (history eww-history-trans) + (setq start (point)) + (setq domain-length (max domain-length (length (plist-get history :url)))) + (setq title-length (max title-length (length (plist-get history :title))))) + (setq format (format "%%-%ds %%-%ds" title-length domain-length) + header-line-format + (concat " " (format format "Title" "URL"))) + (dolist (history eww-history-trans) + (setq start (point)) + (setq url (plist-get history :url)) + (setq title (plist-get history :title)) + (insert (format format title url)) + (insert "\n") + (put-text-property start (1+ start) 'eww-history history)) + (goto-char (point-min))) + (pop-to-buffer "*eww history*"))) (defun eww-history-browse () "Browse the history under point in eww." @@ -1315,39 +1313,23 @@ Differences in #targets are ignored." (let ((history (get-text-property (line-beginning-position) 'eww-history))) (unless history (error "No history on the current line")) - (eww-history-quit) - (pop-to-buffer "*eww*") - (eww-browse-url (plist-get history :url)))) - -(defun eww-history-quit () - "Kill the current buffer." - (interactive) - (kill-buffer (current-buffer))) - -(defvar eww-history-kill-ring nil) - -(defun eww-history-kill () - "Kill the current history." - (interactive) - (let* ((start (line-beginning-position)) - (history (get-text-property start 'eww-history)) - (inhibit-read-only t)) - (unless history - (error "No history on the current line")) - (forward-line 1) - (push (buffer-substring start (point)) eww-history-kill-ring) - (delete-region start (point)) - (setq eww-history (delq history eww-history)) - )) + (quit-window) + (eww-restore-history history))) (defvar eww-history-mode-map (let ((map (make-sparse-keymap))) (suppress-keymap map) - (define-key map "q" 'eww-history-quit) - (define-key map [(control k)] 'eww-history-kill) + (define-key map "q" 'quit-window) (define-key map "\r" 'eww-history-browse) - (define-key map "n" 'next-error-no-select) - (define-key map "p" 'previous-error-no-select) +;; (define-key map "n" 'next-error-no-select) +;; (define-key map "p" 'previous-error-no-select) + + (easy-menu-define nil map + "Menu for `eww-history-mode-map'." + '("Eww History" + ["Exit" quit-window t] + ["Browse" eww-history-browse + :active (get-text-property (line-beginning-position) 'eww-history)])) map)) (define-derived-mode eww-history-mode nil "eww history" -- 1.8.3.1 Kenjiro