From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SLyEHICWymJraQAAbAwnHQ (envelope-from ) for ; Sun, 10 Jul 2022 11:06:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id eHepG4CWymL/qwAAG6o9tA (envelope-from ) for ; Sun, 10 Jul 2022 11:06:08 +0200 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 D6AF9107E7 for ; Sun, 10 Jul 2022 11:06:07 +0200 (CEST) Received: from localhost ([::1]:35650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAStC-00008n-O8 for larch@yhetil.org; Sun, 10 Jul 2022 05:06:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oASsI-000074-BA for emacs-orgmode@gnu.org; Sun, 10 Jul 2022 05:05:12 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:39898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oASsG-00040S-Ax for emacs-orgmode@gnu.org; Sun, 10 Jul 2022 05:05:09 -0400 Received: by mail-wr1-x433.google.com with SMTP id f2so3502103wrr.6 for ; Sun, 10 Jul 2022 02:05:07 -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=BNCzCHa06NAt57fKmcCfYvrmNstdmTKLYBsjThc2mw4=; b=qOcPmFwkMZKsQoGUZAlGthKJYrAw5rQCPJxb7WUTykUFtVoN1PduKdyD8X2LF10q5y lVRjlQ4H9J+y1RA/VJTPB5T5YFjOrjug+Tri0s+aUen+3D1TDIGM6DJEzF4WfJyI0ETb xEHaeSqiliW/c5H7CeWLagcgYIJ0Mmu1BIJsHtEtT9zGeD2WiiCALFR9eMn2LSDl3uzN aCCPno8WimcM4Q7YhLsI4M91Jg7LvbSod8Hw0Be8aq0djDCGAfatqk6pb7IwAXb9A2FU LcNjl5DS/HQ6yIB4XRoL6IY9AzvdioKmah8QDi7r95ydijiE80p9QALDs4eyHTgSiE6+ IbxA== 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=BNCzCHa06NAt57fKmcCfYvrmNstdmTKLYBsjThc2mw4=; b=ij+2eXkWhYI4QO2NziwXG4xfFlhm41NoGIflZKSaRATAYWUfrLJnWwW2y+9gxIyRxx F58vdKCfFdRkl+kYTrzoB6x50e1V3d+ScIvIIJz86xudvtZlHk12NwLp23p8pDf3jA8K c89NxB/2b6viqrMTMSBun4YExggH2VFQ9/VR2Azb6ym5fxGyouMLlu5sluW3GQ55bizV /3jvu64b96utSF8N0W1kALcFI10a38w9h3Ad/uZgbDzIZKlpfCfVCKQM7nqCTi0wqjjG F1NH2EsCueY3/4Vna+J212625y5YeRMSUeS16uIfJwZKqRACuFlJGkmvJDUzXKMX/F+i 84jA== X-Gm-Message-State: AJIora+xVjJzikdaL2IbYXo/ftuVo+S9LTNcawPmS3I1bLpZMrw8QwIM jBEqEmElTse/NTCurGmyx7E= X-Google-Smtp-Source: AGRyM1vWAbsMZGZXK4xjEW+Wk19o6bliMqbGeWVg1NarGeD55+ao51KkDN4OZoZfYtyc8b4IV2X4sA== X-Received: by 2002:a5d:5703:0:b0:21d:6c55:4986 with SMTP id a3-20020a5d5703000000b0021d6c554986mr11911937wrv.455.1657443905321; Sun, 10 Jul 2022 02:05:05 -0700 (PDT) Received: from localhost (sgyl-45-b2-v4wan-164918-cust25.vm6.cable.virginm.net. [82.40.80.26]) by smtp.gmail.com with ESMTPSA id ay38-20020a05600c1e2600b003a2cf1ba9e2sm3508897wmb.6.2022.07.10.02.05.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jul 2022 02:05:04 -0700 (PDT) From: Al Haji-Ali To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] org-agenda-prepare-buffers does not save restrictions In-Reply-To: <874jzr9buw.fsf@localhost> References: <87y1x588rs.fsf@thinkpad.mail-host-address-is-not-set> <87a69k44kr.fsf@localhost> <874jzr9buw.fsf@localhost> Date: Sun, 10 Jul 2022 09:58:48 +0100 Message-ID: <87y1x1xs1j.fsf@thinkpad.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=abdo.haji.ali@gmail.com; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1657443968; 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=BNCzCHa06NAt57fKmcCfYvrmNstdmTKLYBsjThc2mw4=; b=By2udDFsWGIKWhUyJ1nSkk25kz05X5uXo+6H+fq0zcvchqAI33Dd9WDW/FS0vWy+fQdVeX GKFvjcVh6d6urQ9nTiSBH7oStdypP+KtUiw8YXdvdWOfWRXgl8eOfOBRvyZnafJXkrRCr6 61nzUEZuHEQGo5/g3WUWlqkqZyg0mWza1dc9qkjSMqc3VSzWGUwnhcDsnIdOlOA8Aqj1AC vqNql6d3IoXV8O40bcLUu50LeOEwS1js6KjCSDMFZY8esfqiXA6OB/R5Z1cKks7fzDJ4zY 1qaapfm+S04Rw/jQnhtEZNJzf49aIlM3WTsTqIUnVz3X6WR/HCtY5MztHdxv5Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657443968; a=rsa-sha256; cv=none; b=Y0csGrsqNYoMazsZ+7rMLu+Z54SRJKltbdGGK79Vd7pMEDZfK9oEhlaIqCc/orSFA3vh2o wcI91AKIA2GqimvwQGW0NngymzBSf29vOXd8IXry/pl8qT2DRTkRhHE+rZvjLgPLe5p0+B j59eilqpXSXgc/o8tjMHU0sgdRPE0tVa8+lt2jeaFEb9bp8SqCsGn8NhNNbnCksSXluQ4E NwVetO+uleKLKs8hgK842rXn0dKypqwN8O2jSjnWHFyvZt7414yokio4jgnscJVkhfh7b4 ZpvzlF37PU9Flj6JF1FiZRsVOhyESJ+NHO0rAsd2p83/0cNCN3N9orPrc00fmQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qOcPmFwk; 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: -3.95 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qOcPmFwk; 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: D6AF9107E7 X-Spam-Score: -3.95 X-Migadu-Scanner: scn1.migadu.com X-TUID: 7c9V3KluGnm9 --=-=-= Content-Type: text/plain On 09/07/2022, Ihor Radchenko wrote: > Two more comments. Attached is the updated patch. PS: I noticed that the `org-timer.el` example in https://orgmode.org/worg/org-contribute.html has a single space between sentences. Other examples on the page seem fine though. Best regards, -- Al --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=save-restrictions-agenda-buf-v2.patch >From fcaff9b583c46c0d147aaf4c7e3647f689d54894 Mon Sep 17 00:00:00 2001 From: Al Haji-Ali Date: Sun, 10 Jul 2022 09:46:26 +0100 Subject: [PATCH] lisp/org.el: Save restrictions in all agenda file buffers. * lisp/org.el (org-agenda-prepare-buffers): Call `org-with-wide-buffer' for every buffer in the agenda, instead of calling `save-excursion'/'`save-restrictions' just for the current buffer, to save restrictions in all buffers. Use `with-current-buffer' instead of `save-excursion'/'`set-buffer'. TINYCHANGE --- lisp/org.el | 78 +++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 661efeb9c..3d4de5b4f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15031,49 +15031,45 @@ When a buffer is unmodified, it is just killed. When modified, it is saved "Create buffers for all agenda files, protect archived trees and comments." (interactive) (let ((inhibit-read-only t) - (org-inhibit-startup org-agenda-inhibit-startup) - pos) + (org-inhibit-startup org-agenda-inhibit-startup)) (setq org-tag-alist-for-agenda nil org-tag-groups-alist-for-agenda nil) - (save-excursion - (save-restriction - (dolist (file files) - (catch 'nextfile - (if (bufferp file) - (set-buffer file) - (org-check-agenda-file file) - (set-buffer (org-get-agenda-file-buffer file))) - (widen) - (org-set-regexps-and-options 'tags-only) - (setq pos (point)) - (or (memq 'category org-agenda-ignore-properties) - (org-refresh-category-properties)) - (or (memq 'stats org-agenda-ignore-properties) - (org-refresh-stats-properties)) - (or (memq 'effort org-agenda-ignore-properties) - (unless org-element-use-cache - (org-refresh-effort-properties))) - (or (memq 'appt org-agenda-ignore-properties) - (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime)) - (setq org-todo-keywords-for-agenda - (append org-todo-keywords-for-agenda org-todo-keywords-1)) - (setq org-done-keywords-for-agenda - (append org-done-keywords-for-agenda org-done-keywords)) - (setq org-todo-keyword-alist-for-agenda - (append org-todo-keyword-alist-for-agenda org-todo-key-alist)) - (setq org-tag-alist-for-agenda - (org--tag-add-to-alist - org-tag-alist-for-agenda - org-current-tag-alist)) - ;; Merge current file's tag groups into global - ;; `org-tag-groups-alist-for-agenda'. - (when org-group-tags - (dolist (alist org-tag-groups-alist) - (let ((old (assoc (car alist) org-tag-groups-alist-for-agenda))) - (if old - (setcdr old (org-uniquify (append (cdr old) (cdr alist)))) - (push alist org-tag-groups-alist-for-agenda))))) - (goto-char pos))))) + (dolist (file files) + (catch 'nextfile + (with-current-buffer + (if (bufferp file) + file + (org-check-agenda-file file) + (org-get-agenda-file-buffer file)) + (org-with-wide-buffer + (org-set-regexps-and-options 'tags-only) + (or (memq 'category org-agenda-ignore-properties) + (org-refresh-category-properties)) + (or (memq 'stats org-agenda-ignore-properties) + (org-refresh-stats-properties)) + (or (memq 'effort org-agenda-ignore-properties) + (unless org-element-use-cache + (org-refresh-effort-properties))) + (or (memq 'appt org-agenda-ignore-properties) + (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime)) + (setq org-todo-keywords-for-agenda + (append org-todo-keywords-for-agenda org-todo-keywords-1)) + (setq org-done-keywords-for-agenda + (append org-done-keywords-for-agenda org-done-keywords)) + (setq org-todo-keyword-alist-for-agenda + (append org-todo-keyword-alist-for-agenda org-todo-key-alist)) + (setq org-tag-alist-for-agenda + (org--tag-add-to-alist + org-tag-alist-for-agenda + org-current-tag-alist)) + ;; Merge current file's tag groups into global + ;; `org-tag-groups-alist-for-agenda'. + (when org-group-tags + (dolist (alist org-tag-groups-alist) + (let ((old (assoc (car alist) org-tag-groups-alist-for-agenda))) + (if old + (setcdr old (org-uniquify (append (cdr old) (cdr alist)))) + (push alist org-tag-groups-alist-for-agenda))))))))) (setq org-todo-keywords-for-agenda (org-uniquify org-todo-keywords-for-agenda)) (setq org-todo-keyword-alist-for-agenda -- 2.25.1 --=-=-=--