From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#75354: (29.4; eww buffer is not displayed correctly when used from bookmark-jump ) Date: Wed, 08 Jan 2025 13:52:32 +0000 Message-ID: <87sept5s67.fsf@posteo.net> References: <87zfk6eekc.fsf@posteo.net> <87h669vjm9.fsf@posteo.net> <8634ht4fkd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28482"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Thierry Volpiatto , 75354@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 08 14:47:21 2025 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 1tVWP3-0007F7-9v for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Jan 2025 14:47:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVWOo-0003MP-NX; Wed, 08 Jan 2025 08:47:06 -0500 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 1tVWOl-0003JM-Ev for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2025 08:47:03 -0500 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 1tVWOl-0002pm-5p for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2025 08:47:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=VMHANjIdKMeORx1nF/3xFSfzOXRpSC7dh/L1iRtaYbo=; b=O1ZvJIX2ZEcn7DnTAjqCGpgnTodAsYOxd9rEAWOE9LohRFNLGb+nJ7So/ObA37aLTB06Wr+MtCEIGKWz+vrr3E4yPxnwggaStspUpQPlgFOf0ujL+PTVAMDbQn4ZuE4XwRInKppgyMOh3J3z6RW0/Ap2Wn4hmEtOYVtgqDiquIw+flh1SMcWNxTP6bP/kzdggWuU7BHzgN6f8vJibDvGoIuqMAXvo/0+WpoTD2RHk5KX3ycZSRVUkWrh9SlowHZDBccBViy9Me4EcpxTvyScDlAaPgChVV2HKEQn81JeVsYnc4Vs2EQ6NuyC1wFlXFM7EwY8nPQqsiNNJKgz3iwu/Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVWOk-0003hy-0L for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2025 08:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Jan 2025 13:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75354 X-GNU-PR-Package: emacs Original-Received: via spool by 75354-submit@debbugs.gnu.org id=B75354.173634398814205 (code B ref 75354); Wed, 08 Jan 2025 13:47:01 +0000 Original-Received: (at 75354) by debbugs.gnu.org; 8 Jan 2025 13:46:28 +0000 Original-Received: from localhost ([127.0.0.1]:46494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVWOC-0003h2-4Y for submit@debbugs.gnu.org; Wed, 08 Jan 2025 08:46:28 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:60649) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tVWO8-0003gV-Ox for 75354@debbugs.gnu.org; Wed, 08 Jan 2025 08:46:26 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 478F7240103 for <75354@debbugs.gnu.org>; Wed, 8 Jan 2025 14:46:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1736343977; bh=1PIlMjHRkY0hdffewNvd4l08joQ1LZF5iMKU0IEfvLc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=UuFeEHimK+hxMgjDzZ2vmmPFP9S3XTVJExGAFygVul0CThvF1T0hl5eS4TcGNTFHH U/GUD+jipzq8CRWaHnMFD7jEFJysWjDsUKSvWvg4TYytJLFQYw7tZJ/itFKZCZvMgk ODw98INPrjgo39rXDj7vjLorZcKYGmbg8nRD3jRFym4m+6gSQyBgRe1K6oAOnNXAGU H6SPta0m1tq9/Ydcue9Q7M1xuNdS8vUbK9fI5NLFRJw8ATwbOu+2+C+IJtVgPVo7a9 H9lq0LffFOHdnJILt1h191q6HWGn+Mwv728wiDmnlKxAr+NawkFmUiGQUwoRsx1BeH lyix+eu/liqxQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YSq2H6nrXz6tvt; Wed, 8 Jan 2025 14:46:15 +0100 (CET) In-Reply-To: <8634ht4fkd.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 08 Jan 2025 15:10:10 +0200") 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:298779 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Thierry Volpiatto >> Date: Wed, 08 Jan 2025 07:40:30 +0000 >>=20 >> I could fix the problem by modifying bookmark--jump-via: > > Thanks. > > This is contrary to what you originally wrote (with which I agree): Yes, after deeper search I found that `bookmark--jump-via` is behaving like this AFAIU: - It calls the handler which creates a new buffer related to bookmark. - It then displays the current-buffer (the one before jumping to bmk) in a window according to DISPLAY-FUNCTION and make the bookmark buffer curren= t. This approach is OK as long as the handler fn doesn't try do do one part of the job (window handling) itself, which is not the case at least with eww and w3m. It is as well counter intuitive, DISPLAY-FUNCTION should be called on the buffer generated by bookmark and not the contrary, so this change makes the code simpler and easier to understand. > By contrast, the change you propose now will affect all the uses of > bookmarks, everywhere, Yes, this is intended, in addition of fixing eww, it fixes w3m and also the quit function of eww (actually broken). > which is riskier, given how many different variants of bookmark usage > are out there. Tested here on many different kinds of bookmarks and work as expected unlike the current code. > Why did you change your mind about the preferred way of fixing this? Because I couldn't find a way to fix this correctly by modifying only the handler, thus the change would need to be done on each other handlers which behave unexpectedly. Here is the latest patch attached. Thanks. =2D-=20 Thierry --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Handle-correctly-DISPLAY-FUNCTION-arg-in-bookmark-ju.patch Content-Transfer-Encoding: quoted-printable From=20b4d99152212744ab1d90c67641cd41576e6e13f3 Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto Date: Wed, 8 Jan 2025 10:45:55 +0100 Subject: [PATCH] Handle correctly DISPLAY-FUNCTION arg in bookmark--jump-via This fix bug #75354 where when jumping to a eww bmk to other window (or frame) the buffer is displayed both in other window and current window. Previously bookmark--jump-via was calling DISPLAY-FUNCTION on the current-buffer from the new buffer created by bookmark handler (e.g. eww) now DISPLAY-FUNCTION is called on the new buffer from the current buffer (winconf is saved when calling handler). In addition to make eww bookmarks displayed properly, this fix as well w3m bookmarks and as a side effect fix the eww quit function which restore properly winconf after quitting (previously leaving two windows open). =2D-- lisp/bookmark.el | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 0048330e790..248620fbda4 100644 =2D-- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1256,33 +1256,34 @@ Useful for example to unhide text in `outline-mode'= .") =20 (defun bookmark--jump-via (bookmark-name-or-record display-function) "Handle BOOKMARK-NAME-OR-RECORD, then call DISPLAY-FUNCTION. =2DDISPLAY-FUNCTION is called with the current buffer as argument. +DISPLAY-FUNCTION is called with the new buffer as argument. =20 After calling DISPLAY-FUNCTION, set window point to the point specified by BOOKMARK-NAME-OR-RECORD, if necessary, run `bookmark-after-jump-hook', and then show any annotations for this bookmark." =2D (bookmark-handle-bookmark bookmark-name-or-record) =2D ;; Store `point' now, because `display-function' might change it. =2D (let ((point (point))) =2D (save-current-buffer =2D (funcall display-function (current-buffer))) =2D (let ((win (get-buffer-window (current-buffer) 0))) =2D (if win (set-window-point win point)))) =2D ;; FIXME: we used to only run bookmark-after-jump-hook in =2D ;; `bookmark-jump' itself, but in none of the other commands. =2D (when bookmark-fringe-mark =2D (let ((overlays (overlays-in (pos-bol) (1+ (pos-bol)))) =2D temp found) =2D (while (and (not found) (setq temp (pop overlays))) =2D (when (eq 'bookmark (overlay-get temp 'category)) =2D (setq found t))) =2D (unless found =2D (bookmark--set-fringe-mark)))) =2D (run-hooks 'bookmark-after-jump-hook) =2D (if bookmark-automatically-show-annotations + (let (buf) + (save-window-excursion + (bookmark-handle-bookmark bookmark-name-or-record) + (setq buf (current-buffer))) + (let ((point (with-current-buffer buf (point)))) + (funcall display-function buf) + (when-let ((win (get-buffer-window buf 0))) + (set-window-point win point))) + ;; FIXME: we used to only run bookmark-after-jump-hook in + ;; `bookmark-jump' itself, but in none of the other commands. + (when bookmark-fringe-mark + (let ((overlays (overlays-in (pos-bol) (1+ (pos-bol)))) + temp found) + (while (and (not found) (setq temp (pop overlays))) + (when (eq 'bookmark (overlay-get temp 'category)) + (setq found t))) + (unless found + (bookmark--set-fringe-mark)))) + (run-hooks 'bookmark-after-jump-hook) + (when bookmark-automatically-show-annotations ;; if there is an annotation for this bookmark, ;; show it in a buffer. =2D (bookmark-show-annotation bookmark-name-or-record))) + (bookmark-show-annotation bookmark-name-or-record)))) =20 =20 ;;;###autoload =2D-=20 2.34.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmd+gyATHHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvk9OsC/9eSZanNyjM/pxGDb3pd17SEICJtXFj dAOzPfslKmGnt3a1AK5Kdv4TUK/qgCbNI5217jzHZ9YU4rhaiB66MOwpqdm17z5C TUDQaJq2M4wUtKjnnyB29iHeHIMOutlui8oH5zvrQDaIdds3RU29x9fCHIJkgOxN xO8wdWDTsbPAmm/8RffXoL8IVbU2x2/XZ80a9M5xxYEDb2hjK0q0ag0vsGKrwHua L/ZkrFZ+FCznRNgy0PrBPGrGHAZbT3vqQKTZu+1aOgpjfxBStJHKrSp/0EsNx/8Z Z+zvtLGmALqiPnleO2NWvpkzwExAN1462ZRv35UD0Yp1VWrH0f5nig6calzmWXdy 0QL0WVykJS/HhVfLe174arUoaECz819ps9zEJTszAUep+xoOWMFS+f2+MPm6ChOJ 84CvrFnGykEZeguZoMGc5D3PmrOdrIraXEv6nhv7edfOe52cFLrerO67gJ0R4dIH NIJTa2B+iFkm+20VlvLJdo2oCZBGcanX+zA= =YLLo -----END PGP SIGNATURE----- --==-=-=--