From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sKJjKxQCv2FvygAAgWs5BA (envelope-from ) for ; Sun, 19 Dec 2021 10:57:40 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id SF09JxQCv2E2QgAAB5/wlQ (envelope-from ) for ; Sun, 19 Dec 2021 09:57:40 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5903D1CC0C for ; Sun, 19 Dec 2021 10:57:40 +0100 (CET) Received: from localhost ([::1]:50136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myswl-0001Fy-Ir for larch@yhetil.org; Sun, 19 Dec 2021 04:57:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mysuI-00004r-GV for emacs-orgmode@gnu.org; Sun, 19 Dec 2021 04:55:07 -0500 Received: from [2a00:1450:4864:20::129] (port=34350 helo=mail-lf1-x129.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mysuG-0001UD-Po for emacs-orgmode@gnu.org; Sun, 19 Dec 2021 04:55:06 -0500 Received: by mail-lf1-x129.google.com with SMTP id br40so12407066lfb.1 for ; Sun, 19 Dec 2021 01:55:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=13TKkBaQa7tdu6hLFSq/gAu4h+5PRbGkYqnYPvpY12k=; b=MAIfydtVbqrJRY29p1tH2fCLossvHF8Ah2bUDeS8KMaItdC2fUbYwYZNfjBZ8FJdZv LjcJxTIiUY84Hbv1HzJ57b5z1BbPVME9s0uZbNt2BMHpf1lcZjG0gh6W7xiqWO8g169R h97L5dNTxnBs3tQRnNOJu+bO72iJUW/YVZ93sRKnyWqLfYCrptYe2hLwepyAgYN3c2Q7 8I/Ib8FZUJXr9OWkRtREp9X1pYtPxAAe3ukfpWj9RgfuBJzHFTXa4ssnIA67zjA7Zi/n LeVYe4iG8sbel9UdOmbErBlxnq9haBD1G+pKvERm+oFhE0SIaSy6hEs05fBxzFkGrTNJ u7OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=13TKkBaQa7tdu6hLFSq/gAu4h+5PRbGkYqnYPvpY12k=; b=aG+3+GHcaX8FrY1ev248Am3uSV7iq8vE+mMXfjwQMjfDB7MM3ratpI+Gqnx/bdTSva hOsuvrCD4TGlgBIgaAwhvanRVNrGjPe2iEeUBtD8oz8Hy7UQkDvaOC+imSpZq68QzLq5 DvRgjCN/HK4sjNiJD55tMrk9CWrdo9akryPeq9xiQbN1z4WFYyGyo6Tnud8hn7Ws2T2l NvH/W5gFEhKYcf+k80+bTXlqdMXgFf/dVA7f7II5nZt5DUmThw7QzCKIOw1JgdF58/V4 NSHXQdN2L2qMbKRnP/UKiBDu6d/qoAlgvq2niNRxzYs/A71nRVNnfnCyPYI0IBAVOyfN 1ulw== X-Gm-Message-State: AOAM531khqmCtjZ2KqOT+W3Cb/dZvJgM1HzgSnDjFMAja4djYm8OI8Ut i0/Gz29kWBh/FUsFjzwog2U= X-Google-Smtp-Source: ABdhPJxqYchUYh2slazclqkz4G32WILaubtSaQa5p7qi3oaGvg3L0c+6dK1cSo0II5eLADCIJcqczA== X-Received: by 2002:a05:6512:3a86:: with SMTP id q6mr10866174lfu.249.1639907702999; Sun, 19 Dec 2021 01:55:02 -0800 (PST) Received: from localhost ([158.255.2.9]) by smtp.gmail.com with ESMTPSA id t4sm2002141lfe.220.2021.12.19.01.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Dec 2021 01:55:02 -0800 (PST) From: Ihor Radchenko To: Lele Gaifax Subject: Re: org-persist cache for remote files In-Reply-To: <87k0g2ylsx.fsf@metapensiero.it> References: <87o87kb64s.fsf@yandex.com> <87tuhcfc3n.fsf@localhost> <87czo0nqw4.fsf@yandex.com> <87o87kchi2.fsf@localhost> <8735owawla.fsf@yandex.com> <87lf2oc9sv.fsf@localhost> <87ee8fncmw.fsf@yandex.com> <87fssvdfxj.fsf@localhost> <87wnk3c58c.fsf@metapensiero.it> <87bl1eilt6.fsf@localhost> <87ilvmqujm.fsf@metapensiero.it> <87y24i2dv1.fsf@localhost> <87ee6aq8sg.fsf@metapensiero.it> <87lf0i2cnq.fsf@localhost> <87k0g2ylsx.fsf@metapensiero.it> Date: Sun, 19 Dec 2021 17:56:26 +0800 Message-ID: <87bl1csyt1.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::129 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=yantar92@gmail.com; helo=mail-lf1-x129.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1639907860; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=13TKkBaQa7tdu6hLFSq/gAu4h+5PRbGkYqnYPvpY12k=; b=eAcgR4MU7or9wDSjRorbXxZ/XpZvLIGwpa7XWyONft4REkWYtEEXnFtFOkLGnFAu/eW+CS hanTU2e/xsvhPa/p2DRj8XPHZ6pCHN+Zw9E/U+SaiuxE/u/UihoE9aj0oWBg2qAG0gwLIV Ocp41HELysPzpvrl2P/O4ntiD4qiwu7n9t6FKUyy37PGqWlm29bnuKbsbqP2EG0aKhq4s5 SpHAwmm0NUJPqkuqYN7wkJlZURKFpxg+gi+w07gtWVysg3kx/YccufRhMH2mrzLmpWuzWQ AKci8jIcFveJr2zt+a/MdJ3vYyLdw3A8gDSQv6ZrisSIhFQyVGAUziIyjalHEg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1639907860; a=rsa-sha256; cv=none; b=nY2hrwndKetrUYX3nfrESzzzZBUEgyJhsYePK4ELUycoGlZWLfyKoSkQ3uh5JQvehU46q9 A8t7qcMmuMcl0/3/Oto+tvs+xrzXUNBXxaXDeeFE/u2i2E4CD5nwzOTNjQ3atZmoApkSk7 ZFeju6G1444bJ1L5o3uSk+/hgTlDu/5G5dYz1JkVB4iL5ktU0eWMNtM71tjb+gpFHCainm +EbEfg6kC8CQWA2SzVn/sS8dfYP4AoIlgGIox7onYup2lW25TWn0Ra9EmO5CNSlCdNOJQe tTGdc988Np0GeXMMlU2zRvVY2izgworZJMj2tSxvbLahNoi6gq7DDcu4cuRG7g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=MAIfydtV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.71 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=MAIfydtV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 5903D1CC0C X-Spam-Score: -5.71 X-Migadu-Scanner: scn0.migadu.com X-TUID: U09cnYSmNDFx --=-=-= Content-Type: text/plain Lele Gaifax writes: > I couldn't test yet, but I saw a couple of other glitches, sorry for not > noticing first. Thanks for the proof reading. I updated the patch accordingly. Best, Ihor --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-persist.el-Customise-persistence-of-data-for-rem.patch >From 557e7cec6dd22b09468b82650feed2020f97d781 Mon Sep 17 00:00:00 2001 Message-Id: <557e7cec6dd22b09468b82650feed2020f97d781.1639907677.git.yantar92@gmail.com> From: Ihor Radchenko Date: Sat, 18 Dec 2021 22:14:24 +0800 Subject: [PATCH] org-persist.el: Customise persistence of data for remote files * lisp/org-persist.el (org-persist-remote-files): New defcustom defining strategy for persisting data associated with remote files. Separate strategy is necessary to avoid unexpected password prompts while garbage collecting the cache: remote files may require server login. (org-persist-gc): Decide whether to store remote file data according to `org-persist-remote-files'. Reported in https://list.orgmode.org/87bl1eilt6.fsf@localhost/T/#u --- lisp/org-persist.el | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 90f9a3bc9..8e8ecc196 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -57,6 +57,23 @@ (defcustom org-persist-directory (expand-file-name :group 'org-persist :type 'directory) +(defcustom org-persist-remote-files 100 + "Whether to keep persistent data for remote files. + +When this variable is nil, never save persistent data associated with +remote files. When `t', always keep the data. When a number, keep up +to that number persistent values for remote files. When +`check-existence', contact remote server containing the file and only +keep the data when the file exists on the server. + +Note that setting value to `check-existence' will require logging in +to remote servers. Emacs may show multiple password prompts." + :group 'org-persist + :type '(choice (const :tag "Never" nil) + (const :tag "Always" t) + (number :tag "Up to X files") + (const :tag "Check if exist on remote" 'check-existence))) + (defvar org-persist-index-file "index" "File name used to store the data index.") @@ -287,15 +304,26 @@ (defun org-persist-read-all-buffer () (defun org-persist-gc () "Remove stored data for not existing files or unregistered variables." - (let (new-index) + (let (new-index (remote-files-num 0)) (dolist (index org-persist--index) - (let ((file (plist-get index :path)) - (persist-file (when (plist-get index :persist-file) - (org-file-name-concat - org-persist-directory - (plist-get index :persist-file))))) + (let* ((file (plist-get index :path)) + (file-remote (when file (file-remote-p file))) + (persist-file (when (plist-get index :persist-file) + (org-file-name-concat + org-persist-directory + (plist-get index :persist-file))))) (when (and file persist-file) - (if (file-exists-p file) + (when (and file-remote persist-file) + (cl-incf remote-files-num)) + (if (if (not file-remote) + (file-exists-p file) + (pcase org-persist-remote-files + ('t t) + ('check-existence + (file-exists-p file)) + ((pred #'numberp) + (<= org-persist-remote-files remote-files-num)) + (_ nil))) (push index new-index) (when (file-exists-p persist-file) (delete-file persist-file) -- 2.32.0 --=-=-=--