From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.bugs Subject: bug#22244: [PATCH] New command eww-switch-to-buffer Date: Thu, 4 Feb 2016 01:31:43 -0500 Message-ID: <20160204063143.GA13606@holos> References: <87r3i9xesi.fsf@web.de> <87bn9dhy3h.fsf@gnus.org> <87r3i8ajcv.fsf@web.de> <87lh8gn62i.fsf@gnus.org> <87bn8vp9ym.fsf@web.de> <871t8v679a.fsf@gnus.org> <87oabzkuei.fsf@udel.edu> <871t8uzh8b.fsf@gnus.org> <20160203025711.GA11066@holos> <87powdnrp4.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1454567551 13243 80.91.229.3 (4 Feb 2016 06:32:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Feb 2016 06:32:31 +0000 (UTC) Cc: 22244@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 04 07:32:14 2016 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 1aRDSf-0000oH-6d for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Feb 2016 07:32:13 +0100 Original-Received: from localhost ([::1]:39862 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRDSb-0000yR-Gj for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Feb 2016 01:32:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRDSX-0000yM-Mq for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 01:32:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRDSU-0003UI-GN for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 01:32:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRDSU-0003UA-Bi for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 01:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aRDSU-0007xe-4Z for bug-gnu-emacs@gnu.org; Thu, 04 Feb 2016 01:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mark Oteiza Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Feb 2016 06:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22244 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 22244-submit@debbugs.gnu.org id=B22244.145456751230587 (code B ref 22244); Thu, 04 Feb 2016 06:32:02 +0000 Original-Received: (at 22244) by debbugs.gnu.org; 4 Feb 2016 06:31:52 +0000 Original-Received: from localhost ([127.0.0.1]:58830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRDSK-0007xG-Ib for submit@debbugs.gnu.org; Thu, 04 Feb 2016 01:31:52 -0500 Original-Received: from mail-yk0-f176.google.com ([209.85.160.176]:33748) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRDSJ-0007x5-CQ for 22244@debbugs.gnu.org; Thu, 04 Feb 2016 01:31:51 -0500 Original-Received: by mail-yk0-f176.google.com with SMTP id z13so36598857ykd.0 for <22244@debbugs.gnu.org>; Wed, 03 Feb 2016 22:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=tHFFqOVyrCXLZBimbMj3iIH8H99UgWKuix2fQ1qSfec=; b=OthWM+hGJ7l6dYkuAk5eb0MnaSJjXvI/iQ0U2T4Q8qmitMmaJYVL/fCXMIe5D2Vnzl cA6f9p8Fba6vpBHcY0lNZYd5RUX4finpd/LotomzbNCa9eFcjw613kyAUdtAjwp7w91L IyoFoEIWmJdW/mjtMZljeLXtyRl+cHbgd3f30puSCUGngM8exEPoH5kQ0G2XrNEdvs5O bUuFw+67y+gKEwLkq4tJrKtY/q1dM+bgM/HvHKuAxFqn2xWoEna299jUVTls1TmeBdYo 8WeR2Llkxp1K/a3avwc48OIugMLPwHK4KXzZmnObqlb6Np+AuHjXgJlvz9Z1IYcGgtV5 ZteA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=tHFFqOVyrCXLZBimbMj3iIH8H99UgWKuix2fQ1qSfec=; b=c7pWl2pubP/rUgtUAzKwp4XR2sTWpMGm3vbbWLoEJaB0Qisf+GoT8aY7N8zc2Amu/G 1IY8bjNfOxvFbplEttihCVS43DC8O65R2mASO6mSpKGJ5e/jqiTSUvxmOtjwgLo7L8lb EvdBOmPWN5qqgInbyYk/f6mSbptThDBn6C7PxbX51mywv4LH8hNv0qFbCTNU/bRw/Sc2 2GSTRvSUVGvmBFuHJae81qebYQGo/dlwe94KfHxQXP377KNsQhTV05zwlgRAtgGaYwv9 J6BVu6V1yf3my/h9nTSx1SvoIEWU8+/N4Xsq4kiRZ6keH2PcMAVso+AAYQicCe7wW5lU E+EQ== X-Gm-Message-State: AG10YOTyM8aaFZRstN/pVEwZpE2au4k3gf86Eq4yrAYJqsup6pyXnPDlp7GwrXCYKZLfkIVX X-Received: by 10.37.96.65 with SMTP id u62mr2851516ybb.78.1454567505776; Wed, 03 Feb 2016 22:31:45 -0800 (PST) Original-Received: from holos.localdomain (pool-96-227-83-242.phlapa.fios.verizon.net. [96.227.83.242]) by smtp.gmail.com with ESMTPSA id c126sm6136993ywa.52.2016.02.03.22.31.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Feb 2016 22:31:44 -0800 (PST) Original-Received: by holos.localdomain (Postfix, from userid 1000) id A5A76696E3; Thu, 4 Feb 2016 01:31:43 -0500 (EST) Content-Disposition: inline In-Reply-To: <87powdnrp4.fsf@gnus.org> User-Agent: Mutt/1.5.24+53 (b315c4d4ede7) (2015-08-30) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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:112391 Archived-At: * doc/misc/eww.texi: Document eww-switch-to-buffer and its keybinding * etc/NEWS: Mention new command * lisp/net/eww.el (eww-mode-map): Bind eww-switch-to-buffer to "s" (eww-mode-map): Add menu item (eww-switch-to-buffer): New command --- On 04/02/16 at 01:18pm, Lars Ingebrigtsen wrote: > Mark Oteiza writes: > > > I don't, but I was thinking more like "S but in the minibuffer". Where the > > buffer names in erc are meaningful, in eww they are not so much (at > > least in my case where I'm usually using clone-buffer to make more eww > > buffers). So the completion candidates might be the buffer urls, titles, or > > instead just showing annotations like so: > > That sounds pretty cool... Alternatively we could give the eww buffers > better names (based on URLs or titles). That may be a handful, though. > > Could you send a patch for this new command against the trunk (including > documentation)? Hopefully covered everything. "s" seemed a sensible bind. doc/misc/eww.texi | 6 +++++- etc/NEWS | 5 +++++ lisp/net/eww.el | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 0e9bedb..afb1caf 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -164,12 +164,16 @@ You can view stored bookmarks with @kbd{B} (@code{eww-list-bookmarks}). This will open the bookmark buffer @file{*eww bookmarks*}. +@findex eww-switch-to-buffer @findex eww-list-buffers +@kindex s @kindex S @cindex Multiple Buffers To get summary of currently opened EWW buffers, press @kbd{S} (@code{eww-list-buffers}). The @file{*eww buffers*} buffer allows you -to quickly kill, flip through and switch to specific EWW buffer. +to quickly kill, flip through and switch to specific EWW buffer. To +switch EWW buffers through a minibuffer prompt, press @kbd{s} +(@code{eww-switch-to-buffer}). @findex eww-browse-with-external-browser @vindex shr-external-browser diff --git a/etc/NEWS b/etc/NEWS index 3150432..faf49b0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -52,6 +52,11 @@ in these situations. * Changes in Specialized Modes and Packages in Emacs 25.2 +** eww + ++++ +*** A new `s' command for switching to another eww buffer via the minibuffer. + +++ ** The commands that add ChangeLog entries now prefer a VCS root directory for the ChangeLog file, if none already exists. Customize diff --git a/lisp/net/eww.el b/lisp/net/eww.el index cb23127..5a50877 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -689,6 +689,7 @@ the like." (define-key map "R" 'eww-readable) (define-key map "H" 'eww-list-histories) (define-key map "E" 'eww-set-character-encoding) + (define-key map "s" 'eww-switch-to-buffer) (define-key map "S" 'eww-list-buffers) (define-key map "F" 'eww-toggle-fonts) (define-key map [(meta C)] 'eww-toggle-colors) @@ -712,6 +713,7 @@ the like." ["View page source" eww-view-source] ["Copy page URL" eww-copy-page-url t] ["List histories" eww-list-histories t] + ["Switch to buffer" eww-switch-to-buffer t] ["List buffers" eww-list-buffers t] ["Add bookmark" eww-add-bookmark t] ["List bookmarks" eww-list-bookmarks t] @@ -1498,6 +1500,24 @@ If CHARSET is nil then use UTF-8." (eww-reload nil 'utf-8) (eww-reload nil charset))) +(defun eww-switch-to-buffer () + "Prompt for an EWW buffer to display in the selected window." + (interactive) + (let ((completion-extra-properties + '(:annotation-function (lambda (buf) + (with-current-buffer buf + (format " %s" (eww-current-url))))))) + (switch-to-buffer + (read-buffer "Switch to EWW buffer: " + (cl-loop for buf in (nreverse (buffer-list)) + if (with-current-buffer buf (derived-mode-p 'eww-mode)) + return buf) + t + (lambda (bufn) + (with-current-buffer + (if (consp bufn) (cdr bufn) (get-buffer bufn)) + (derived-mode-p 'eww-mode))))))) + (defun eww-toggle-fonts () "Toggle whether to use monospaced or font-enabled layouts." (interactive) -- 2.7.0