unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70019: 30.0.50; bookmark-set: fringe icon (again)
@ 2024-03-26 20:30 Dani Moncayo
  2024-03-27 10:52 ` Dani Moncayo
  2024-04-19  5:19 ` bug#70019: [PATCH] Fix two bugs in removing bookmark fringe marks (bug#70019) Karl Fogel
  0 siblings, 2 replies; 8+ messages in thread
From: Dani Moncayo @ 2024-03-26 20:30 UTC (permalink / raw)
  To: 70019

Recipe from "emacs -Q":

1. Open the Emacs manual [C-h r].
2. Set a named bookmark in some line of the *info* node [C-x r m f o o RET].
3. Go to another *info* node and repeat step #2 there (with the same
bookmark name).

When I do this, I still see a "bookmark" icon in the fringe of the
first *info* node (wrong, since the bookmark now refers to another
place).

Also, if I delete the bookmark (from the "*Bookmark List*" buffer), I
still see the icons in the fringe on both *info* nodes.

--
Dani Moncayo

In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.18.0) of 2024-03-26 built on C11-Q8YAKWONJX0
Repository revision: 351d98535dc10f8338b8a418e331cc0af488087b
Repository branch: master
Windowing system distributor 'Microsoft Corporation', version 11.0.12010000
System Description: Ubuntu 23.10

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70019: 30.0.50; bookmark-set: fringe icon (again)
  2024-03-26 20:30 bug#70019: 30.0.50; bookmark-set: fringe icon (again) Dani Moncayo
@ 2024-03-27 10:52 ` Dani Moncayo
  2024-03-27 12:48   ` Eli Zaretskii
  2024-04-19  5:19 ` bug#70019: [PATCH] Fix two bugs in removing bookmark fringe marks (bug#70019) Karl Fogel
  1 sibling, 1 reply; 8+ messages in thread
From: Dani Moncayo @ 2024-03-27 10:52 UTC (permalink / raw)
  To: 70019

Another misbehavior I see:

1. Open some *info* manual and set a named bookmark there.  E.g. [C-h
r C-x r m f o o RET].
2. Kill the *info* buffer and open it again: [C-x k RET C-h r].

When I do that, I don't see the bookmark icon in the fringe (wrong).
But I _do_ see the icon if I _jump_ to the bookmark: [C-x r b f o o RET]

-- 
Dani Moncayo





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70019: 30.0.50; bookmark-set: fringe icon (again)
  2024-03-27 10:52 ` Dani Moncayo
@ 2024-03-27 12:48   ` Eli Zaretskii
  2024-03-27 20:45     ` Karl Fogel
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2024-03-27 12:48 UTC (permalink / raw)
  To: Dani Moncayo, Karl Fogel, Juri Linkov; +Cc: 70019

> From: Dani Moncayo <dmoncayo@gmail.com>
> Date: Wed, 27 Mar 2024 11:52:02 +0100
> 
> Another misbehavior I see:
> 
> 1. Open some *info* manual and set a named bookmark there.  E.g. [C-h
> r C-x r m f o o RET].
> 2. Kill the *info* buffer and open it again: [C-x k RET C-h r].
> 
> When I do that, I don't see the bookmark icon in the fringe (wrong).
> But I _do_ see the icon if I _jump_ to the bookmark: [C-x r b f o o RET]

Karl and Juri, would you please look into these two issues regarding
bookmarks in Info buffers?

Thanks.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70019: 30.0.50; bookmark-set: fringe icon (again)
  2024-03-27 12:48   ` Eli Zaretskii
@ 2024-03-27 20:45     ` Karl Fogel
  2024-04-06  9:15       ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Karl Fogel @ 2024-03-27 20:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70019, Juri Linkov, Dani Moncayo

On 27 Mar 2024, Eli Zaretskii wrote:
>> From: Dani Moncayo <dmoncayo@gmail.com>
>> Date: Wed, 27 Mar 2024 11:52:02 +0100
>> 
>> Another misbehavior I see:
>> 
>> 1. Open some *info* manual and set a named bookmark there. 
>> E.g. [C-h
>> r C-x r m f o o RET].
>> 2. Kill the *info* buffer and open it again: [C-x k RET C-h r].
>> 
>> When I do that, I don't see the bookmark icon in the fringe 
>> (wrong).
>> But I _do_ see the icon if I _jump_ to the bookmark: [C-x r b f 
>> o o RET]
>
>Karl and Juri, would you please look into these two issues 
>regarding
>bookmarks in Info buffers?

Okay; I'll try to look into it this weekend.  Thank you for 
calling this to our attention.

Best regards,
-Karl





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70019: 30.0.50; bookmark-set: fringe icon (again)
  2024-03-27 20:45     ` Karl Fogel
@ 2024-04-06  9:15       ` Eli Zaretskii
  2024-04-18  9:03         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2024-04-06  9:15 UTC (permalink / raw)
  To: Karl Fogel; +Cc: 70019, juri, dmoncayo

> From: Karl Fogel <kfogel@red-bean.com>
> Cc: Dani Moncayo <dmoncayo@gmail.com>,  Juri Linkov <juri@linkov.net>,
>   70019@debbugs.gnu.org
> Date: Wed, 27 Mar 2024 15:45:55 -0500
> 
> On 27 Mar 2024, Eli Zaretskii wrote:
> >> From: Dani Moncayo <dmoncayo@gmail.com>
> >> Date: Wed, 27 Mar 2024 11:52:02 +0100
> >> 
> >> Another misbehavior I see:
> >> 
> >> 1. Open some *info* manual and set a named bookmark there. 
> >> E.g. [C-h
> >> r C-x r m f o o RET].
> >> 2. Kill the *info* buffer and open it again: [C-x k RET C-h r].
> >> 
> >> When I do that, I don't see the bookmark icon in the fringe 
> >> (wrong).
> >> But I _do_ see the icon if I _jump_ to the bookmark: [C-x r b f 
> >> o o RET]
> >
> >Karl and Juri, would you please look into these two issues 
> >regarding
> >bookmarks in Info buffers?
> 
> Okay; I'll try to look into it this weekend.  Thank you for 
> calling this to our attention.

Any progress there?





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70019: 30.0.50; bookmark-set: fringe icon (again)
  2024-04-06  9:15       ` Eli Zaretskii
@ 2024-04-18  9:03         ` Eli Zaretskii
  2024-04-18 17:12           ` Karl Fogel
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2024-04-18  9:03 UTC (permalink / raw)
  To: kfogel; +Cc: 70019, dmoncayo, juri

Ping!  Karl, any progress here?

> Cc: 70019@debbugs.gnu.org, juri@linkov.net, dmoncayo@gmail.com
> Date: Sat, 06 Apr 2024 12:15:50 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Karl Fogel <kfogel@red-bean.com>
> > Cc: Dani Moncayo <dmoncayo@gmail.com>,  Juri Linkov <juri@linkov.net>,
> >   70019@debbugs.gnu.org
> > Date: Wed, 27 Mar 2024 15:45:55 -0500
> > 
> > On 27 Mar 2024, Eli Zaretskii wrote:
> > >> From: Dani Moncayo <dmoncayo@gmail.com>
> > >> Date: Wed, 27 Mar 2024 11:52:02 +0100
> > >> 
> > >> Another misbehavior I see:
> > >> 
> > >> 1. Open some *info* manual and set a named bookmark there. 
> > >> E.g. [C-h
> > >> r C-x r m f o o RET].
> > >> 2. Kill the *info* buffer and open it again: [C-x k RET C-h r].
> > >> 
> > >> When I do that, I don't see the bookmark icon in the fringe 
> > >> (wrong).
> > >> But I _do_ see the icon if I _jump_ to the bookmark: [C-x r b f 
> > >> o o RET]
> > >
> > >Karl and Juri, would you please look into these two issues 
> > >regarding
> > >bookmarks in Info buffers?
> > 
> > Okay; I'll try to look into it this weekend.  Thank you for 
> > calling this to our attention.
> 
> Any progress there?
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70019: 30.0.50; bookmark-set: fringe icon (again)
  2024-04-18  9:03         ` Eli Zaretskii
@ 2024-04-18 17:12           ` Karl Fogel
  0 siblings, 0 replies; 8+ messages in thread
From: Karl Fogel @ 2024-04-18 17:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70019, dmoncayo, juri

On 18 Apr 2024, Eli Zaretskii wrote:
>Ping!  Karl, any progress here?

Reproduced now.  Working on diagnosis and fix.

Best regards,
-Karl





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#70019: [PATCH] Fix two bugs in removing bookmark fringe marks (bug#70019)
  2024-03-26 20:30 bug#70019: 30.0.50; bookmark-set: fringe icon (again) Dani Moncayo
  2024-03-27 10:52 ` Dani Moncayo
@ 2024-04-19  5:19 ` Karl Fogel
  1 sibling, 0 replies; 8+ messages in thread
From: Karl Fogel @ 2024-04-19  5:19 UTC (permalink / raw)
  To: Emacs Developers; +Cc: 70019, Dani Moncayo

[-- Attachment #1: Type: text/plain, Size: 309 bytes --]

I'd appreciate some review on this patch.  I've no prior 
experience with fringe mark code (someone else added fringe mark 
support to bookmark.el).

This should fix bug#70019 and a separate-but-sort-of-related bug.

I'll wait at least a few days for comments/review before 
committing.

Best regards,
-Karl


[-- Attachment #2: Fix two bugs in removing bookmark fringe marks (bug#70019) --]
[-- Type: text/plain, Size: 2768 bytes --]

From a7c9618efdd423134990c22d62513eac50ab98e3 Mon Sep 17 00:00:00 2001
From: Karl Fogel <kfogel@red-bean.com>
Date: Thu, 18 Apr 2024 23:49:29 -0500
Subject: [PATCH] Fix two bugs in removing bookmark fringe marks

This fixes bug#70019 and a separate fringe-mark removal bug that
affected bookmarks in Info "dir" nodes.

* lisp/bookmark.el (bookmark--remove-fringe-mark): Fix bug#70019 by
temporarily widening in order to ensure we fetch the right overlays.
Also, don't tamper with the filename as received from the bookmark
object, since we will compare the received filename against one
generated dynamically by the same means (`bookmark-buffer-file-name')
to determine whether or not we're in the right buffer.
---
 lisp/bookmark.el | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index bf2357207d8..5d01fe24991 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -515,15 +515,30 @@ bookmark--remove-fringe-mark
         (non-essential t)
         overlays found temp)
     (when (and pos filename)
-      (setq filename (abbreviate-file-name (expand-file-name filename)))
       (dolist (buf (buffer-list))
         (with-current-buffer buf
           (when (equal filename
                        (ignore-errors (bookmark-buffer-file-name)))
             (setq overlays
                   (save-excursion
-                    (goto-char pos)
-                    (overlays-in (pos-bol) (1+ (pos-bol)))))
+                    (save-restriction
+                      ;; Suppose bookmark "foo" was earlier set at
+                      ;; location X in a file, but now the file is
+                      ;; narrowed such that X is outside the restriction.
+                      ;; Then the `goto-char' below would go to the
+                      ;; wrong place and thus the wrong overlays would
+                      ;; be fetched.  This is why we temporarily `widen'
+                      ;; before fetching.
+                      ;;
+                      ;; (This circumstance can easily arise when a
+                      ;; bookmark was set on Info node X but now the
+                      ;; "*info*" buffer is showing some other node Y,
+                      ;; with X and Y physically located in the same
+                      ;; file, as is often the case with Info nodes.
+                      ;; See bug #70019, for example.)
+                      (widen)
+                      (goto-char pos)
+                      (overlays-in (pos-bol) (1+ (pos-bol))))))
             (while (and (not found) (setq temp (pop overlays)))
               (when (eq 'bookmark (overlay-get temp 'category))
                 (delete-overlay (setq found temp))))))))))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-19  5:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 20:30 bug#70019: 30.0.50; bookmark-set: fringe icon (again) Dani Moncayo
2024-03-27 10:52 ` Dani Moncayo
2024-03-27 12:48   ` Eli Zaretskii
2024-03-27 20:45     ` Karl Fogel
2024-04-06  9:15       ` Eli Zaretskii
2024-04-18  9:03         ` Eli Zaretskii
2024-04-18 17:12           ` Karl Fogel
2024-04-19  5:19 ` bug#70019: [PATCH] Fix two bugs in removing bookmark fringe marks (bug#70019) Karl Fogel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).