From: Ihor Radchenko <yantar92@posteo.net>
To: Fabio Natali <me@fabionatali.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Issue with org-persist and Tramp
Date: Fri, 10 Nov 2023 09:26:58 +0000 [thread overview]
Message-ID: <87r0ky0xi5.fsf@localhost> (raw)
In-Reply-To: <87ttpvgjg5.fsf@fabionatali.com>
[-- Attachment #1: Type: text/plain, Size: 578 bytes --]
Fabio Natali <me@fabionatali.com> writes:
> On 2023-11-09, 12:17 +0000, Ihor Radchenko <yantar92@posteo.net> wrote:
>> May I know what
>> (file-remote-p "/ssh:<remote-machine>:/home/user/test.org")
>> (with appropriate <remote-machine>) returns on your side?
>
> Hi Ihor,
>
> Sure, no particular reason to obfuscate the remote address, it's
> actually a LAN IP. The above function returns "/ssh:192.168.1.100:". Is
> that the kind of output one should be expecting? Anything wrong about
> it?
Nothing wrong. Just me missing one code branch.
What about the attached patch?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-org-persist-normalize-associated-Avoid-TRAMP-conn.patch --]
[-- Type: text/x-patch, Size: 2450 bytes --]
From 73e2fc687b966f3c12b87dd40c90cdc6b9f440fc Mon Sep 17 00:00:00 2001
Message-ID: <73e2fc687b966f3c12b87dd40c90cdc6b9f440fc.1699608346.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 8 Nov 2023 19:58:42 +0200
Subject: [PATCH v2] org-persist--normalize-associated: Avoid TRAMP connection
for remote files
* lisp/org-persist.el (org-persist--normalize-associated): Never try
to store inode association for remote TRAMP files.
Reported-by: Fabio Natali <me@fabionatali.com>
Link: https://orgmode.org/list/87jzqthdge.fsf@fabionatali.com
---
lisp/org-persist.el | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index 81edcf6f2..bdc6006b6 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -614,9 +614,14 @@ (defun org-persist--normalize-associated (associated)
(unless (stringp associated)
(setq associated (cadr associated)))
(let* ((rtn `(:file ,associated))
- (inode (and (fboundp 'file-attribute-inode-number)
- (file-attribute-inode-number
- (file-attributes associated)))))
+ (inode (and
+ ;; Do not store :inode for remote files - it may
+ ;; be time-consuming on slow connections or even
+ ;; fail completely when ssh connection is closed.
+ (not (file-remote-p associated))
+ (fboundp 'file-attribute-inode-number)
+ (file-attribute-inode-number
+ (file-attributes associated)))))
(when inode (plist-put rtn :inode inode))
rtn))
((or (pred bufferp) `(:buffer ,_))
@@ -634,6 +639,10 @@ (defun org-persist--normalize-associated (associated)
(or (buffer-base-buffer associated)
associated)))
(setq inode (when (and file
+ ;; Do not store :inode for remote files - it may
+ ;; be time-consuming on slow connections or even
+ ;; fail completely when ssh connection is closed.
+ (not (file-remote-p associated))
(fboundp 'file-attribute-inode-number))
(file-attribute-inode-number
(file-attributes file))))
--
2.42.0
[-- Attachment #3: Type: text/plain, Size: 224 bytes --]
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2023-11-10 9:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 13:58 Issue with org-persist and Tramp Fabio Natali
2023-11-07 21:08 ` Antonio Carlos Padoan Junior
2023-11-08 8:56 ` Fabio Natali
2023-11-08 9:25 ` Ihor Radchenko
2023-11-08 17:40 ` Fabio Natali
2023-11-08 18:01 ` Ihor Radchenko
2023-11-08 21:30 ` Fabio Natali
2023-11-09 12:17 ` Ihor Radchenko
2023-11-09 13:11 ` Fabio Natali
2023-11-10 9:26 ` Ihor Radchenko [this message]
2023-11-10 11:13 ` Fabio Natali
2023-11-10 11:26 ` Fabio Natali
2023-11-11 9:48 ` Fabio Natali
2023-11-11 11:06 ` Ihor Radchenko
2023-11-11 19:38 ` Fabio Natali
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r0ky0xi5.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=me@fabionatali.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.