unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#66982: 30.0.50; Cannot delete bookmark of inaccessible remote file
@ 2023-11-07 10:18 Liu Hui
  2023-11-08  8:40 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Hui @ 2023-11-07 10:18 UTC (permalink / raw)
  To: 66982

Recipe:

1. Save the following text as the test bookmark file

;;;; Emacs Bookmark Format Version 1;;;; -*- coding: utf-8-emacs;
mode: lisp-data -*-
;;; This format is meant to be slightly human-readable;
;;; nevertheless, you probably don't want to edit it.
;;; -*- End Of Bookmark File Format Version Stamp -*-
(("test" (filename . "/ssh:192.168.0.100:~/") (front-context-string)
 (rear-context-string . "g-style=literal\n") (position . 68)
 (last-modified 25595 64776 373828 978000)))

2. emacs -Q --eval '(setq bookmark-default-file xxx)' -f list-bookmarks

3. press d, then x.

However, the bookmark cannot be deleted because Emacs hangs or displays
tramp error message/popup window after several seconds.





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

* bug#66982: 30.0.50; Cannot delete bookmark of inaccessible remote file
  2023-11-07 10:18 bug#66982: 30.0.50; Cannot delete bookmark of inaccessible remote file Liu Hui
@ 2023-11-08  8:40 ` Michael Albinus
  2023-11-10  4:29   ` Liu Hui
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2023-11-08  8:40 UTC (permalink / raw)
  To: Liu Hui; +Cc: 66982

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

Liu Hui <liuhui1610@gmail.com> writes:

Hi,

> Recipe:
>
> 1. Save the following text as the test bookmark file
>
> ;;;; Emacs Bookmark Format Version 1;;;; -*- coding: utf-8-emacs;
> mode: lisp-data -*-
> ;;; This format is meant to be slightly human-readable;
> ;;; nevertheless, you probably don't want to edit it.
> ;;; -*- End Of Bookmark File Format Version Stamp -*-
> (("test" (filename . "/ssh:192.168.0.100:~/") (front-context-string)
>  (rear-context-string . "g-style=literal\n") (position . 68)
>  (last-modified 25595 64776 373828 978000)))
>
> 2. emacs -Q --eval '(setq bookmark-default-file xxx)' -f list-bookmarks
>
> 3. press d, then x.
>
> However, the bookmark cannot be deleted because Emacs hangs or displays
> tramp error message/popup window after several seconds.

Thank you for the recipe, I can reproduce the problem. It happens,
because in `bookmark--remove-fringe-mark' there is a call of
`expand-file-name', which blocks if a remote file is not reachable.

Could you pls check the appended patch? It fixes your recipe for me, and
shouldn't harm other use cases.

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 522 bytes --]

diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 10ff2f5ebbf..71d76cb4291 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -511,6 +511,8 @@ bookmark--remove-fringe-mark
 See user option `bookmark-fringe-mark'."
   (let ((filename (cdr (assq 'filename bm)))
         (pos (cdr (assq 'position bm)))
+        ;; Don't expand file names for non-existing remote connections.
+        (non-essential t)
         overlays found temp)
     (when (and pos filename)
       (setq filename (expand-file-name filename))

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

* bug#66982: 30.0.50; Cannot delete bookmark of inaccessible remote file
  2023-11-08  8:40 ` Michael Albinus
@ 2023-11-10  4:29   ` Liu Hui
  2023-11-10 10:24     ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Hui @ 2023-11-10  4:29 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 66982

Michael Albinus <michael.albinus@gmx.de> 于2023年11月8日周三 16:40写道:

> Thank you for the recipe, I can reproduce the problem. It happens,
> because in `bookmark--remove-fringe-mark' there is a call of
> `expand-file-name', which blocks if a remote file is not reachable.
>
> Could you pls check the appended patch? It fixes your recipe for me, and
> shouldn't harm other use cases.

Thank you! I confirm it works.

BTW, I find binding non-essential to t fixes a similar problem caused
by abbreviate/expand-file-name on remote files:

1. save the following text to file A:

;;; -*- coding: utf-8; mode: lisp-data -*-
(("/ssh:192.168.0.100:~/a.txt" . 282))

2. emacs -Q --eval '(setq save-place-file <file A>)' -f save-place-mode


diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index 590c55d2609..2dda3b4d44b 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -156,7 +156,8 @@ save-place-abbreviate-file-names
   :set (lambda (sym val)
          (set-default sym val)
          (or save-place-loaded (save-place-load-alist-from-file))
-         (let ((fun (if val #'abbreviate-file-name #'expand-file-name)))
+         (let ((non-essential t)
+               (fun (if val #'abbreviate-file-name #'expand-file-name)))
            (setq save-place-alist
                  (cl-delete-duplicates
                   (cl-loop for (k . v) in save-place-alist





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

* bug#66982: 30.0.50; Cannot delete bookmark of inaccessible remote file
  2023-11-10  4:29   ` Liu Hui
@ 2023-11-10 10:24     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2023-11-10 10:24 UTC (permalink / raw)
  To: Liu Hui; +Cc: 66982-done

Version: 30.1

Liu Hui <liuhui1610@gmail.com> writes:

Hi,

>> Could you pls check the appended patch? It fixes your recipe for me, and
>> shouldn't harm other use cases.
>
> Thank you! I confirm it works.

Thanks for the feedback.

> BTW, I find binding non-essential to t fixes a similar problem caused
> by abbreviate/expand-file-name on remote files:

Indeed. I've pushed the change for bookmark.el and saveplace.el to
master, closing the bug.

Best regards, Michael.





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

end of thread, other threads:[~2023-11-10 10:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07 10:18 bug#66982: 30.0.50; Cannot delete bookmark of inaccessible remote file Liu Hui
2023-11-08  8:40 ` Michael Albinus
2023-11-10  4:29   ` Liu Hui
2023-11-10 10:24     ` Michael Albinus

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).