From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#65914: Exclude current buffer from eww-switch-to-buffer Date: Fri, 15 Sep 2023 05:05:23 -0700 Message-ID: References: <87y1ha1he8.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20115"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65914@debbugs.gnu.org To: James Thomas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 15 14:06:31 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qh7ah-0004yt-3b for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Sep 2023 14:06:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qh7aS-0004h2-Of; Fri, 15 Sep 2023 08:06:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh7a8-0004bB-I0 for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 08:06:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qh7a8-0007aM-A6 for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 08:05:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qh7aE-0005uY-AV for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 08:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Sep 2023 12:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65914 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65914-submit@debbugs.gnu.org id=B65914.169477954122678 (code B ref 65914); Fri, 15 Sep 2023 12:06:02 +0000 Original-Received: (at 65914) by debbugs.gnu.org; 15 Sep 2023 12:05:41 +0000 Original-Received: from localhost ([127.0.0.1]:42305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh7Zt-0005ti-69 for submit@debbugs.gnu.org; Fri, 15 Sep 2023 08:05:41 -0400 Original-Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]:42360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh7Zo-0005tM-Qu for 65914@debbugs.gnu.org; Fri, 15 Sep 2023 08:05:39 -0400 Original-Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-500bbe3ef0eso2478135e87.1 for <65914@debbugs.gnu.org>; Fri, 15 Sep 2023 05:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694779524; x=1695384324; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=waRYSJD1MfSxz20SGcjIzM6G3mVrYiLZx0Nx4rkFuaw=; b=O/HgMQTR30OX+sIF0SvbjV2Gn/ugwLCRpT7oBTygP8/roiCB7+NOSzPqQjiRpdNq+4 iV1vtmIUW3PeqCX7sGnFmyXgORWx2pS9I+sfbdiXHxM9zO3pBf9HgqtDMFsRJQGt6lX4 rMTk6F8cjgZ/H1+z3xUkD/G0zhOS9YYHZIc9s6jzaW7/bqKSr7weH4qJMtNu7zUJZfck 3/apP+YRbTuBYBxufnsai6eHvEy457glYqKo63wYWvqHZERfxN4pbbmg8krlgpqzxKeR q67ozXzCnPcMK9y5fU/hjEnIg+bTqWgeMda/TJ4f2da9gbtVVORXyHCI8pPpw6qTLcBl 0Z6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694779524; x=1695384324; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=waRYSJD1MfSxz20SGcjIzM6G3mVrYiLZx0Nx4rkFuaw=; b=pub6/HhKWHa/Jl1DAnYYDUIkiQMu5638/NKhJ7hC92r6T2BthL8kpx4VF61GQatzDl f06/fFdfn6uaPYALxX+vfmHCexFiefNckBOI3UrYWQ1oBlTffgA4y74OZPPdbmRgAZJp vd+Nbj/OkLhtLP8p24+y/rG2WxRF7EVcFT5ehdkFARKARd3olGXrCIKRRE4KNR1I25VE nkdbnX+DPNhWk04gqYJjvEMDr2tuVk+OxYSdDrI0jLBQmLZ/y+im0gJx7CMZgSk7DUUr S5ceAe6U9/X0hAr9zjVf3a3WWK7a82UStMA11Izq7R825GkIqa9YmHCcXEWgkrHPRPE9 F14w== X-Gm-Message-State: AOJu0YxxLHJghwmk2KqVPuiSs9KArwRqH8z2ITRjswKSPog4v9aggnTI 1MbyopT+c+KQLf9rXkU/xIJARYBh7rf9n60RPTfzeOFr X-Google-Smtp-Source: AGHT+IFDC69Tq8Ioy3auK0L3UxfYkf5RWQPpVVa1OpOXoXtnAtssYTIK1LZKQLouL3Jx8Xm1tq77VCODsKoO1RtsqkY= X-Received: by 2002:a05:6512:33c8:b0:502:e235:20c7 with SMTP id d8-20020a05651233c800b00502e23520c7mr757740lfg.20.1694779524400; Fri, 15 Sep 2023 05:05:24 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 15 Sep 2023 05:05:23 -0700 In-Reply-To: <87y1ha1he8.fsf@gmx.net> (James Thomas's message of "Wed, 13 Sep 2023 16:15:03 +0530") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270519 Archived-At: James Thomas writes: > Tags: patch, notabug [BTW, we typically don't use the "notabug" for patches.] > This patch excludes the current buffer from the completion list of the > above command. The main motivation is avoiding one cycling keystroke in > icomplete. > > For eg. a use-case of cycling visits between the last 3 visited eww > buffers: > Currently (to visit each buffer in succession), after pressing s, one > would have to cycle thrice in icomplete before pressing C-j. With this > patch, it would only need to be done twice (a mnemonic to remember the > number of times to cycle could be 'the last 2 *other* buffers' rather > than 'the last 3 buffers' it is currently). > > Moreover, if you remember that the target eww buffer was the last n-th > buffer you opened, you may now simply cycle n times. Eg. n is 1 for the > previous buffer. Thanks, I would like to install this patch. Could you please send the patch as an attachment instead? We prefer that patches are created with a command like `git format-patch -1'. Please also include: - The bug number of this bug in the commit message, like so: Bug#65914 - A ChangeLog entry, as described in the CONTRIBUTE file. That would make it easier for us to review and install this patch. Thanks in advance. > * lisp/net/eww.el (eww-switch-to-buffer): > > diff --git a/lisp/net/eww.el b/lisp/net/eww.el > index 4ddda216afc..e43ef2bfe8b 100644 > --- a/lisp/net/eww.el > +++ b/lisp/net/eww.el > @@ -2062,7 +2062,8 @@ eww-switch-to-buffer > (let ((completion-extra-properties > '(:annotation-function (lambda (buf) > (with-current-buffer buf > - (format " %s" (eww-current-url))))))) > + (format " %s" (eww-current-url)))))) > + (curbuf (current-buffer))) > (pop-to-buffer-same-window > (read-buffer "Switch to EWW buffer: " > (cl-loop for buf in (nreverse (buffer-list)) > @@ -2070,9 +2071,10 @@ eww-switch-to-buffer > return buf) > t > (lambda (bufn) > - (with-current-buffer > - (if (consp bufn) (cdr bufn) (get-buffer bufn)) > - (derived-mode-p 'eww-mode))))))) > + (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn))) > + (and (with-current-buffer bufn > + (derived-mode-p 'eww-mode)) > + (not (eq bufn curbuf)))))))) > > (defun eww-toggle-fonts () > "Toggle whether to use monospaced or font-enabled layouts." > > --