From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 GKN2AGvqiWIpmwAAbAwnHQ (envelope-from ) for ; Sun, 22 May 2022 09:46:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8OE8AGvqiWKmDAAAauVa8A (envelope-from ) for ; Sun, 22 May 2022 09:46:51 +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 620DB1591B for ; Sun, 22 May 2022 09:46:50 +0200 (CEST) Received: from localhost ([::1]:52446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsgIb-0002Qc-G0 for larch@yhetil.org; Sun, 22 May 2022 03:46:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsgHQ-0002PY-ER for emacs-orgmode@gnu.org; Sun, 22 May 2022 03:45:36 -0400 Received: from mail-db3eur04olkn081b.outbound.protection.outlook.com ([2a01:111:f400:fe0c::81b]:22146 helo=EUR04-DB3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsgHN-00053C-Vg for emacs-orgmode@gnu.org; Sun, 22 May 2022 03:45:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XARr5kSNcvvkGhpeU2Y2V+ADCeVqxnu1UsT0SzdemBP++xCxJQ85/amSNb7c5klWz0zUVBKYtzUVc3OrdBCKLWbUFKVnjOfh5Ugf0BUINei/zpQwPIb9xfQK3cjfy/R3K7g4A2IgaIJ7dOSYcekxjCIN8iaCQ2d6mXPdhgXHmmochda4WV6Am7GXvJj7ayQtP0cqJSNQzmGxvVyB2Go/z/zymkchj6keHQwzaVlwG4J1I8YmLcERAPRhp6OrPL6uBRaXbtAungWbwmQmUCCmKKTWtn5AcyNE+HbOYgd3gXWtzYgbjnnMX5bxikdvcEkCGsw6QnZ2bbXNB1tlVfIwMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RrSwG3HvGisR5GEV/ayfh8CLDqGZZ9pnR456TY16DoM=; b=ngCe+Fjyh20MhN/r6uF9nrbt+uzUN0icdItCVxGWS/Mif0CLlNw28+mlkLVdaYbZWPUSso5kzGzpR8PvXFSr6w73eGXg4t+QfquCCRHMJo11nKpQtIBJeOGSe5kI8uXUKnzNMKIzUrR8xq4ecOguhYF0gVivG/zJ0Pi5cgYCdl965lpF5DuDEa3O6aUAD0LrCCuTJE8r4BoV7ZbfSUiOYr/qGzu54Mv/ycLlwYbY5QMAoMeYIQ0EeeSi7ox70Q0k/LcA4y0Sl0GNH+rutDUcnd7yMssRZXGnXeX+wbItirx1mti+MVoHkxmyCOna3QvkWqRyqV2URvxj+WRd0JjMwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RrSwG3HvGisR5GEV/ayfh8CLDqGZZ9pnR456TY16DoM=; b=APipkGKWZCcyBS8w6/4bSRRgvYgmS6lPKAcfli1hl9q2HogytBqOkx29PiACSdUUQonSB1JoYseYfdBfW84m/YqndK/61RyMIBQpMvjFOXj1X+YVE4GNckoyhQFFHJ0tiOysma+0WFm7meChDKiHm/smVxrs83qP+v/79gLXz4ebPxYTzhPUOxEmOrtDA4idZWWtUe0EEc+E64CHMuh0vXSEba9aQMolOem7ylJiq1dlOLtpHMM6NnVh6UKUTsvwFG/GHZxERzF1q1xEEPKdrcjm2c1BM7o8AAaN6kZsBYXDDa/7H8fLtgXbfX4eOgba9q6SBudCxwxU3MaCxzpQuQ== Received: from DB6PR0601MB2087.eurprd06.prod.outlook.com (2603:10a6:4:4f::26) by VI1PR06MB5646.eurprd06.prod.outlook.com (2603:10a6:803:d9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14; Sun, 22 May 2022 07:40:28 +0000 Received: from DB6PR0601MB2087.eurprd06.prod.outlook.com ([fe80::cdbe:e542:a1b6:1a2]) by DB6PR0601MB2087.eurprd06.prod.outlook.com ([fe80::cdbe:e542:a1b6:1a2%2]) with mapi id 15.20.5273.022; Sun, 22 May 2022 07:40:28 +0000 User-agent: mu4e 1.6.10; emacs 29.0.50 From: Ignacio Casso To: emacs-orgmode@gnu.org Subject: [BUG] org-copy-subtree in a file with local variables marks buffer as modified [9.5.3 (release_9.5.3-6-gef41f3 @ /home/ignacio/repos/emacs/lisp/org/)] Date: Sun, 22 May 2022 09:08:30 +0200 Message-ID: Content-Type: text/plain X-TMN: [BaG1rbmFNeTm0wuY46EQSecJ87OOExZE] X-ClientProxiedBy: PR1P264CA0028.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19f::15) To DB6PR0601MB2087.eurprd06.prod.outlook.com (2603:10a6:4:4f::26) X-Microsoft-Original-Message-ID: <87czg6817e.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8251cabd-84fb-4dd7-2bc7-08da3bc65747 X-MS-TrafficTypeDiagnostic: VI1PR06MB5646:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ESBww9nRFGlnnZJ02Vru0t5ZfV6w7H6oh0i9hLBJxUYkpsqPz/PXCk0g4MTmTUfWPXqRinzdvKJPodjJMQUqJf9taCnTTAisEMSFP/JmZ0hIv5NNXmtj6Gc+wjFSN8y2YXjroXC91yND/6xCF7cOk80Xf2fSFV5FTNbHNtOehpgPJd4AR9Z4wj/VYxMMJ4JOP3sJolvakAocA9QpwOSfVf2PJFdRuHfBUZt6ZCLrl8i2eyyQaTY4CsjnKgNC9+uBSgsTcKFIDrjfVTpS8NY18JCBqg5xlkmeUo+qT5qi6tJQloDqu5Zdomkkf3b2fDLV8sSopcsQBygAHykV+1NGt5IkU+s78AAGK2tRbYl1WtBjwyfr23aP+O2G5dXMoHQZZD/g2ZfvfyHmcypppRMXmO9aMDVp8lW8W0OOaztKtBh2s4cu8bw6Msli+KZnADepMuYeODh3G8Nqs5+WPWaVWbSDFlYRaOjlauFMLqJMVEZfhYxxrNcgztWCznxYHkqnQDgJ87tgiAwxpHT7eq41gEj2ku3C38rapM/LJbZheyioiawZap73B9acX4EM7s5L3RnD18YOnh0kZZDmXN/9Tw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/06EQbcKdH1WYuUMl4MdFkcl9aK1AeOs/MA1/mlkwEiZTJChnZHDcJPbwUU6?= =?us-ascii?Q?mPIlHwJVbRJfgbfhOCNhURK1yIxnEnU0P6hFsalD6VmTr2HY1MgoKVIUDLSY?= =?us-ascii?Q?sPn2HOi+kfdPskmYwNOpyDuRUVTdg7fcnTgVwerXX9Lvr8oR9Paghg8+b8AU?= =?us-ascii?Q?wgaU4tTYja+tmFWEUlmlyAiDaRAz0jn2FMPu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y8yfpd1aMy57u+5jfvQrKWjFhP5xwdwsWLjqM3GaukghnbLCRGRAKu?= =?us-ascii?Q?CLGD2kwI54koNFLvnFuFE1WOYFLen9ShTr5cHP9fVa4fp76mu74LsKlkdXy7?= =?us-ascii?Q?gEOmmjhl7fBfiFo6gh9nAilNgkGp0vllAnHaXiMkEepWCf5GjWAkc6lknM3F?= =?us-ascii?Q?Dx4Qt6CSJa30X14nzC3zrA/G9pIe9+S6IAhKPYQUBSHbnlCBTjfuCgxsdsIt?= =?us-ascii?Q?aotKoWzxQJmfr80kqehI5gsy7dXA77RU7h8DftWQqv1f2XmjByEsEkvdCF4A?= =?us-ascii?Q?v8vF8Y5cfA+a90eukTG2IjR2YxrStZUTG7eAA1azDwU88w4Qs5vs45L8EANr?= =?us-ascii?Q?3TudoZzRdZR0OcyCu964qOWILv8y8OvF?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 8251cabd-84fb-4dd7-2bc7-08da3bc65747 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0601MB2087.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2022 07:40:28.4097 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR06MB5646 Received-SPF: pass client-ip=2a01:111:f400:fe0c::81b; envelope-from=ignaciocasso@hotmail.com; helo=EUR04-DB3-obe.outbound.protection.outlook.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, SPF_HELO_PASS=-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=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653205610; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=RrSwG3HvGisR5GEV/ayfh8CLDqGZZ9pnR456TY16DoM=; b=dVr8kBI7jnpu+XKLVs3fATntQKHumaxDX8aXkeRDrcHIJdnGI+M5cokasGzfO4QGZkw6e9 X5bfkxzSn5XphzNgtB40xGf9+qPouFlJD62OEU4TMDqUnnkgSAFmq8wHtZLwNzKv/C6Se7 jhh3kPCHgN6r6hxEQx6sOnx/HxZ3RvDehna16u31v5dZjT89hd8+oLZ2yWGagEVQWkDybz zqKMjnMUsEpvFWw93GeA884BPl/B6wOnUNftDi6muJ+VrWwDCXlnNwQkUjjrKCi0bJ0oI9 fPKznGx4CCuieEEn5YxF9S4V2GxHGr4X3YQSNmHtU7uSqUTDeDSkcNYg+Q2NkA== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1653205610; a=rsa-sha256; cv=pass; b=aRbVEa6KWC3rAQSt1UPeV2syYE7hHJqg3Yw4jhl6uyZLRuN6UfM8O20Hmjz2AAdXQ99Snk q+WXTKm0alCkWqIsKLCYgpLC5mrQrVwfqt9Cx6ewSF+8FGdGSOLQnJbSEHdzJYwd9HA+2p JR/iNKomJgKCV3iXliha7mxHvUQ16EbFarAf2vzMp7tCEIR44jJa5QADWgN0f6k4F1HB51 VBsMDAzqrImPNcqv/rnLV1JZlf4siUeh5l0UFcUX+M6q+eF5NXw8hAPHdJJVuAcGyS/4Ju DqCqcbJI6sbzwFCsKCUCwb2jZ6+7K9hdlnd2nhu9hekaLXblr0UqgTAwN5LMVw== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=APipkGKW; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.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.05 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=APipkGKW; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.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: 620DB1591B X-Spam-Score: -5.05 X-Migadu-Scanner: scn1.migadu.com X-TUID: yyOD0HctIZ76 Hello, Copying a subtree with `org-copy-subtree' in an org file with local variables marks the buffer as modified. This is because `org-copy-subtree' calls `org-preserve-local-variables', which deletes local variables, executes some body, and then inserts them again, which results in a modified buffer even if the buffer was not modified before and the body does not modify it either, like in the case of `org-copy-subtree'. What would you think about a change like the following in the definition of `org-preserve-local-variables' to solve the issue? + (let ((modified-before-p) (buffer-modified-p)) ;; current code that deletes local variables + (unless modified-before-p (set-buffer-modified-p nil)) ;; current code that executes body + (let ((modified-after-p (buffer-modified-p))) ;; current code that restores local variables + (unless modified-after-p (set-buffer-modified-p nil)))) Could the current code or my proposed change have any more unintended consequences, for example in the undo tree or mark ring? Sometimes when I undo or jump to the mark, the point moves to the last visible, usually folded headline of the file, even if I had not edited it recently, and I have always assumed that it's because it wants to go to the end of the buffer for some reason I've never been able to come up with or debug. Could that have something to do with this? Best regards, Ignacio Emacs : GNU Emacs 29.0.50 (build 53, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-05-22 Package: Org mode version 9.5.3 (release_9.5.3-6-gef41f3 @ /home/ignacio/repos/emacs/lisp/org/)