From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuchen Pei Newsgroups: gmane.emacs.bugs Subject: bug#51176: eww switch buffer by title Date: Thu, 14 Oct 2021 10:48:08 +1100 Message-ID: <87a6jc4hc7.fsf@ypei.me> References: <87v9214j6g.fsf@ypei.me> <87lf2x6t11.fsf@gnus.org> <87fst53ytg.fsf@ypei.me> <871r4p6q5n.fsf@gnus.org> <871r4oyjm1.fsf@mail.linkov.net> <875yu050sz.fsf@gnus.org> <875yu0x256.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3592"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.13; emacs 27.2 Cc: Lars Ingebrigtsen , 51176@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 14 01:49:11 2021 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 1manzi-0000lu-WD for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Oct 2021 01:49:11 +0200 Original-Received: from localhost ([::1]:34722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1manzh-0002lZ-UY for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Oct 2021 19:49:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1manza-0002iM-FG for bug-gnu-emacs@gnu.org; Wed, 13 Oct 2021 19:49:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1manza-0000Zp-6W for bug-gnu-emacs@gnu.org; Wed, 13 Oct 2021 19:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1manza-0001TU-5j for bug-gnu-emacs@gnu.org; Wed, 13 Oct 2021 19:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuchen Pei Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Oct 2021 23:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51176 X-GNU-PR-Package: emacs Original-Received: via spool by 51176-submit@debbugs.gnu.org id=B51176.16341689065620 (code B ref 51176); Wed, 13 Oct 2021 23:49:02 +0000 Original-Received: (at 51176) by debbugs.gnu.org; 13 Oct 2021 23:48:26 +0000 Original-Received: from localhost ([127.0.0.1]:33977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1manz0-0001SZ-4N for submit@debbugs.gnu.org; Wed, 13 Oct 2021 19:48:26 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:42363) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1manyv-0001SE-UY for 51176@debbugs.gnu.org; Wed, 13 Oct 2021 19:48:25 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id AA6F93201AF0; Wed, 13 Oct 2021 19:48:15 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 13 Oct 2021 19:48:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ypei.me; h= references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; s=fm2; bh=BvpAsdl16swzo+Tayhv46e1jIi 3DGw+TfR3iYma9LI4=; b=PcFJTNAsO7IFCUnB8Y9ogV3M2/xZD94i/ttIXMOVs6 BxfTmwOzI3kRMUno95oNw/txHPYpEZcVQq/Mg5rhRJ7yq/qwitOJfVCyptv9IgjW 1YuhDVwGPqmfPELPxdBNiFhcPAnFKRoyvvuJhehFU4pCYLdLTOUfZwPY+ApUlgNS VjFFrFVp2JzFMSeqQbFOL9wBX7Jx+T9SC4S8kr4kHZyI0YGXDPTWLuQvzmuyf7aW UITYu7gJyCJIXzXRKLG44nkpWS0Gpuhe0EqPtpdvxCXG2Xk1Yx82AKd8PEl7l52n eYcZldKg2zeIeaIMipl+PnI8Hx+bbGVVcezea1/q5HQg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=BvpAsd l16swzo+Tayhv46e1jIi3DGw+TfR3iYma9LI4=; b=YZZeH58Jla3wWkeDPGkdj1 VNJp4wfJY1Bnf1MuSBgcAuw2IRz26I5pcZp9R7kigu8WUBx5v4I1fovyX4nx9yLa HlbScqLN8DAzglTd3IguCuB4gNuIt9yXHPe9AygSUPrtlVzFyqzKb0QDJJxTrL2i W3wTV706Ai+olShcCacgxJqWgJ9RysfsA4lHKL2qmiNd3u5bVMSW4d7EH4PABtv2 biZk7uB6eLJISvncsDIHYtuXj6icqp0AknGaJrIPVjS450KaCZzy2ct0pR6NVdpT FPez5cu1/JAwKLrU6R6lUuT7iM4AIqPpQzsdwZS8PCNURcj1KWZLeQYoEMVCsKVg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdduuddgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvufgjfffkgggtsehgtderredtredtnecuhfhrohhmpegjuhgthhgv nhcurfgvihcuoehhiheshihpvghirdhmvgeqnecuggftrfgrthhtvghrnhepkedtfffhle eigfehueevieeuueekvdfgveegheeiudeuffdvgfejleeijeevheetnecuffhomhgrihhn peihphgvihdrmhgvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhephhhiseihphgvihdrmhgv X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Oct 2021 19:48:13 -0400 (EDT) In-reply-to: <875yu0x256.fsf@mail.linkov.net> 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" Xref: news.gmane.io gmane.emacs.bugs:217189 Archived-At: --=-=-= Content-Type: text/plain; format=flowed Juri Linkov writes: >>>> I think in that case, perhaps it would make more sense to >>>> just rename >>>> the eww buffer to have the title in the buffer name? Then >>>> the normal >>>> buffer switching commands would work automatically. >>> >>> In Info, forking commands (such as 'Info-follow-nearest-node >>> FORK') >>> create a new buffer with the Info node name in its buffer >>> name, e.g. >>> *info-TITLE*. So instead of current *eww*<2>, eww could use >>> the same >>> format *eww-TITLE*, or uniquify-like angle brackets >>> *eww*. >> >> Yup, that's what I meant. The wrinkle here is that we don't >> know the >> title until we've fetched the HTML, so the buffer has to be >> renamed >> after rendering. > > I see. Then maybe in the existing hook `eww-after-render-hook'? > This is > the standard way to customize buffer renaming, e.g. I have a lot > of such > (add-hook 'occur-hook 'occur-rename-buffer) for customizing > different modes. On a related note, I also have a function defined in a similar fashion switching to a shell buffer by prompts. Are people interested in having this as well? I don't see a shell hook like eww-after-render-hook that can achieve this though. (defun get-comint-prompt () (save-excursion ;; more useful than (beginning-of-line) to move past sticky part (forward-line 0) (let ((end ;; font-lock-face should be comint-highlight-prompt (next-single-char-property-change (point) 'font-lock-face))) (buffer-substring-no-properties (point) end)))) (defun shell-switch-by-prompt (prompt-and-buffer) "Switches to a shell with selected prompt." (interactive (list (let ((com-table)) (dolist (buffer (buffer-list)) (with-current-buffer buffer (when (equal major-mode 'shell-mode) (add-to-list 'com-table (concat (get-comint-prompt) (propertize (concat " " (buffer-name)) 'invisible t)))))) (completing-read "Shell prompt: " com-table)))) (string-match "^.* \\(.*\\)$" prompt-and-buffer) (switch-to-buffer (match-string 1 prompt-and-buffer))) -- Best, Yuchen PGP Key: 47F9 D050 1E11 8879 9040 4941 2126 7E93 EF86 DFD0 <https://ypei.me/assets/ypei-pubkey.txt> --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIEEARYIACkWIQRH+dBQHhGIeZBASUEhJn6T74bf0AUCYWdwOAscaGlAeXBlaS5t ZQAKCRAhJn6T74bf0GELAQDtc0I6YOGZWuZHcKXuCjVoAudrmLlCxr3yXki+OGTE 2wEA0JsgI193+2uz44O40phEKDQrw+co7lwFcNQasaoI0go= =+Hjw -----END PGP SIGNATURE----- --=-=-=--