From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id caI/OOzttWACNAEAgWs5BA (envelope-from ) for ; Tue, 01 Jun 2021 10:21:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 8G4sM+zttWBUVwAA1q6Kng (envelope-from ) for ; Tue, 01 Jun 2021 08:21:00 +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 C62CE13FDB for ; Tue, 1 Jun 2021 10:20:59 +0200 (CEST) Received: from localhost ([::1]:33634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnzdx-0006Gz-OC for larch@yhetil.org; Tue, 01 Jun 2021 04:20:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnzdP-0006Gc-P1 for emacs-orgmode@gnu.org; Tue, 01 Jun 2021 04:20:24 -0400 Received: from mout01.posteo.de ([185.67.36.65]:54223) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnzdM-0007AU-Ip for emacs-orgmode@gnu.org; Tue, 01 Jun 2021 04:20:23 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 9F91E240028 for ; Tue, 1 Jun 2021 10:20:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.eu; s=2017; t=1622535616; bh=IYLwZ0CUIkxq//BKW60AZ4ww2qFFqS5ijlH1+5jxxoM=; h=Subject:To:From:Date:From; b=lTmjzo38/bUp5iaYBflPc6Ck9YnDiGZSpmHGyeRIo1jp+kaNTaqiOYLZ8ijG9epE5 dT28eywhv8qvceCKnDX2TpkPyni6d2chXTq6CHLMYRorh5GPDmVDlGZtl860uqUa3s XpVvWrCZWNpGPusVi+N0Opm/jk9XC9tDTyW0grg8m17KZg3Y5K9yeSAfpo4x2QN8wH mEFm3JGbbHqJUDI/4FbUScVZKcDA/AHYmjvae3C+aD/yoigX18KW1nIzq8AlXNs1dp fNo6ICCKwFFgrEq+530xAteBvUF5DXJS0/XEMW1uKGiXoQhEC3GGpjysDP7GmtwU/R u77A4JX8Dl3yA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FvQ7z6tJ6z9rxP; Tue, 1 Jun 2021 10:20:15 +0200 (CEST) Subject: Re: [PATCH] source blocks mangled when edited To: Michael Gauland , emacs-orgmode@gnu.org References: <9e9ac180-7b77-3e04-87e4-7d1e9e02856e@posteo.eu> <2000f8ce-0f6a-91e0-f764-e65f3cc46937@gmail.com> <09ce8454-430d-733d-64c4-562f0180ab60@posteo.eu> <0dd1fbfe-8718-af8b-dbab-2818d504590d@gmail.com> From: =?UTF-8?Q?S=c3=a9bastien_Miquel?= Message-ID: <2699cddd-69b1-0f46-47bb-0b450873ea7c@posteo.eu> Date: Tue, 1 Jun 2021 08:20:15 +0000 MIME-Version: 1.0 In-Reply-To: <0dd1fbfe-8718-af8b-dbab-2818d504590d@gmail.com> Content-Type: multipart/mixed; boundary="------------1EA8EDE6E831B11936354BDF" Content-Language: fr Received-SPF: pass client-ip=185.67.36.65; envelope-from=sebastien.miquel@posteo.eu; helo=mout01.posteo.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sebastien.miquel@posteo.eu Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622535660; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=xZBE7GhwEyOpugIOI/X1aQKhOG0a7CfAyNpxBtnN0X0=; b=pKLcoh4jkzCP7twK+FuEy0+HDiwsom74QOs0XOsDr94nbTZNUTBHS1VJxschhCh/Ti5C0E N4DVj03eIoRG5SqrHF+rA2SEn1ZW7avb1s2oerGgj/MSsssGVBrSAa8nheCaLNkP5LO+WY JMj0MqFeUeLx9C5IsZ6xbT3nrUNLQSb75t6q4zEvZsUKNaq1u2gQh8ltSceYiK7ZoygRzk uxwsLEISbAdLwVhyAQjAVL0+qhBQGNP99Vr5O2N3Flq8tPpSNN7Y1d9ejVAitRgQl0BZ1v /MrJA6DTdvBwtjPb3vkT78ZEt7QXfwmZkcs7iYF2Q8o2hm+mrrK1anVsq71tuA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622535660; a=rsa-sha256; cv=none; b=o51E2AzPtGECHXAFiX8kOYjDXq6wzdsx1mmm767Tht36Xeytmo2mC/BdD7PQ7/qwa4LLy0 3k2uSI9QgujYQEQYtJ4jhud6EyRlGf6vcrWTidWVJT/J0F7AStgLoP/ROuogtPrdWWV+t3 F7rKuJXMrLP8UlzuWIb3TCIXUL+wqvkBnZ/wSzVGty53DYkpyGSoOxPuonMdLHQ1r9MQQF 8c/9tNPApkJN4qelTDHF8/tjFbq6iu/mKePYLhOI6lkXk2LVTzSEbLhXjuDK0y1PmDhaEy FTNKmRzIb/UfvLj17rwVu5y/jzllDJwNXPIYX+34EVmTdyyEoOoMLInLViL2dg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=lTmjzo38; dmarc=pass (policy=none) header.from=posteo.eu; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.13 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=lTmjzo38; dmarc=pass (policy=none) header.from=posteo.eu; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: C62CE13FDB X-Spam-Score: -3.13 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3Oit7ijUmvIi This is a multi-part message in MIME format. --------------1EA8EDE6E831B11936354BDF Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Michael Gauland writes: > This is all the*trace-output* buffer shows: > > ====================================================================== > 1 -> (replace-buffer-contents #) > 1 <- replace-buffer-contents: nil Indeed, the `replace-buffer-contents` call is failing. I've been able to reproduce with earlier versions of emacs 26.1. With later versions of emacs 26, the problem goes away. It seems earlier versions of `replace-buffer-contents` are not quite reliable. It was patched prior to 27.1 and the new documentation string makes some guarantees of correctness, so let's just change the minimal version to 27.1. Thank you for the report. Regards, -- Sébastien Miquel X-Woof-Bug: confirmed --------------1EA8EDE6E831B11936354BDF Content-Type: text/x-patch; charset=UTF-8; name="0001-org-src.el-Use-replace-buffer-contents-only-for-emac.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-org-src.el-Use-replace-buffer-contents-only-for-emac.pa"; filename*1="tch" >From 8ebdbc5eca92de4429d3994a3663d8aa3b9877fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= Date: Tue, 1 Jun 2021 08:56:48 +0200 Subject: [PATCH] org-src.el: Use `replace-buffer-contents' only for emacs >= 27 * lisp/org-src.el: Use `replace-buffer-contents' only for emacs >= 27. It was introduced in emacs 26.1, but earlier versions made no guarantees of correctness. --- lisp/org-src.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 79f002e56..4698c6dd2 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -1199,12 +1199,12 @@ Throw an error if there is no such buffer." ;; insert new contents. (delete-overlay overlay) (let ((expecting-bol (bolp))) - (if (version< emacs-version "26.1") + (if (version< emacs-version "27.1") (progn (delete-region beg end) (insert (with-current-buffer write-back-buf (buffer-string)))) (save-restriction (narrow-to-region beg end) - (replace-buffer-contents write-back-buf) + (replace-buffer-contents write-back-buf 0.1 nil) (goto-char (point-max)))) (when (and expecting-bol (not (bolp))) (insert "\n"))) (kill-buffer write-back-buf) @@ -1246,13 +1246,13 @@ Throw an error if there is no such buffer." (undo-boundary) (goto-char beg) (let ((expecting-bol (bolp))) - (if (version< emacs-version "26.1") + (if (version< emacs-version "27.1") (progn (delete-region beg end) (insert (with-current-buffer write-back-buf (buffer-string)))) (save-restriction (narrow-to-region beg end) - (replace-buffer-contents write-back-buf) + (replace-buffer-contents write-back-buf 0.1 nil) (goto-char (point-max)))) (when (and expecting-bol (not (bolp))) (insert "\n"))))) (when write-back-buf (kill-buffer write-back-buf)) -- 2.31.1 --------------1EA8EDE6E831B11936354BDF--