From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: [elpa] externals/org 46da64c 4/6: org-persist.el: Fix `add-hook' priority argument Date: Wed, 20 Oct 2021 21:38:26 +0800 Message-ID: <87cznzddf1.fsf@localhost> References: <20211019125722.17993.60001@vcs0.savannah.gnu.org> <20211019125725.EA9CF209AA@vcs0.savannah.gnu.org> <875yttgm3h.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20091"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 20 15:38:32 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mdBnb-0004yB-NG for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Oct 2021 15:38:31 +0200 Original-Received: from localhost ([::1]:59874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdBnZ-0000iF-06 for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Oct 2021 09:38:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdBmF-0007Fa-Fo for emacs-devel@gnu.org; Wed, 20 Oct 2021 09:37:08 -0400 Original-Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:36755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdBmD-0007CT-TX for emacs-devel@gnu.org; Wed, 20 Oct 2021 09:37:07 -0400 Original-Received: by mail-pf1-x42c.google.com with SMTP id m26so2995838pff.3 for ; Wed, 20 Oct 2021 06:37:05 -0700 (PDT) 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=RJbPWBPb/hTNf2NH4fyKQrJLoNlprGVwjEgNY7j+3Tk=; b=KwaAk89Jj6REG/t75j44oKaefHJZg7F0+D8tAjNXBM+IXoDLrO2ExqbjIoyZloS9Zq uUBi2YJNzs2Tr88EB2+EPYCqpHLIqx1YlD/1BVykRt73XQp/+lWNywpUaB8iIgFKmVP+ ZhxLjKVyD9vHzK6QPsLllI+IyL/r0vepUAKfvXObkpqkci1Ao49DWmBcH3q5Ta131T/9 yQj/aJB+zN/REVMzimkawGV6JhzhJyvVZq75DIqqcEIzNLRjQr+b1aOlUcdCsUnVU4UM WoxBuvcr6Nwliqj+1S3IYGl+UzqnVkvYClRdDPxrgJEpykDC4UDZrBmwd5/rG6kyh7yU AdRA== 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=RJbPWBPb/hTNf2NH4fyKQrJLoNlprGVwjEgNY7j+3Tk=; b=R70CPaTGD8J/mhhhjc11QNfuYtMoeeH9Of8OVQ/oui2aJvHVdqKgX7g1eufEg9OA09 nomvzLSY+z6nkmZDozyzItOPu5Jiqx66FwV+LOYng/7mQO2mw0jn2DOCNlXMn4WylAvc Ky47T9nOEq5hgV3s1W+Y9mGYq6Z8MGhQcmZbHmH+2ZagQlf3xMEKfl3o++rMztpd2aqK 5OZxkn41dqnVAtUaOtI6pPPgWTFyZnKO7bkB3n22Xh9VI7ouJ7qBaqQX8nS3aWs27LnL HXcz87B5eOHl/7mT4IRT2RQ5laR+iJYh1Q9l2PQ/99lZRHbbefMJ8Xm9oHVUdrpNHz28 F1NA== X-Gm-Message-State: AOAM5323DUDS0WHZWR2lZ1UZcS/QvtIhzS3CY47TklHbvUFQE2Gi9slc s4/wuFL/yhX56dt+Y+Q5NwY= X-Google-Smtp-Source: ABdhPJw+y6GWUsi51c8fj7WMjWhMXH7LHj3W90ygMg/HT20f5dBoE8EE4ic0mgMsBbKLnSv69NbAog== X-Received: by 2002:a05:6a00:15c8:b0:44d:9f7e:ece2 with SMTP id o8-20020a056a0015c800b0044d9f7eece2mr6604035pfu.86.1634737024244; Wed, 20 Oct 2021 06:37:04 -0700 (PDT) Original-Received: from localhost ([103.125.234.161]) by smtp.gmail.com with ESMTPSA id c25sm2678297pfn.159.2021.10.20.06.37.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 06:37:03 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=yantar92@gmail.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:277447 Archived-At: Stefan Monnier writes: >> The idea behind 100 is related to Org usage. We save buffer-local >> `org-element--cache' to files. It needs to be done _after_ all the >> possible changes in Org buffers are made. If any hook changes an Org >> buffer after `org-persist-write-all', the saved value will become >> invalid. I am not sure what can be a reasonable DEPTH value in such >> case. Can it be something like 1? Looking through Emacs code base, I >> can mostly see non-nil values as DEPTH argument. So, maybe 90? 91? > > The value should be chosen in accordance with other possibly > interfering functions. > IOW you need for the functions to agree on a numbering-convention. > Since there is no such convention yet for your functions, you get to > define it. > > So you can chose, for example 42 and from then on all function that need > to come before `org-persist-write-all` simply have to refrain from > using a value higher than 42. Thanks for the clarification. After more thinking and reading the manual, I have found that kill-emacs-hook and kill-buffer-hook generally run after the buffer is saved. So, I do not need to worry about something outside Org changing the file contents. Depth 0 is good enough given that I put add-hook calls in correct order. Best, Ihor