Re: [PATCH] source blocks mangled when edited

2021-06-27 Thread Nicolas Goaziou
Hello, Sébastien Miquel writes: > 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. I

Re: [PATCH] source blocks mangled when edited

2021-06-01 Thread Sébastien Miquel
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

Re: source blocks mangled when edited

2021-05-31 Thread Michael Gauland
On 31/05/21 9:42 pm, Sébastien Miquel wrote: > There must be an issue with the `replace-buffer-contents` calls. Can > you call `trace-function` on `replace-buffer-contents` and trigger the > behaviour again to see what it returns ? > This is all the *trace-output* buffer shows:

Re: source blocks mangled when edited

2021-05-31 Thread Sébastien Miquel
Michael Gauland writes: I didn't instrument the functions, but found that there are two places that test '(if (version< emacs-version "26.1"...'. If I change that to use "version<=", the problem goes away (I'm still running 26.1). I don't know whether this is the right fix (the underlying

Re: source blocks mangled when edited

2021-05-31 Thread Michael Gauland
On 31/05/21 8:15 pm, Sébastien Miquel wrote: > The relevant functions are `org-edit-src-exit` and perhaps > `org-src--contents-for-write-back`. > > Can you instrument these functions to see what's happening ? Is > `org-src--contents-for-write-back` populating the buffer correctly ? > Does the

Re: source blocks mangled when edited

2021-05-31 Thread Sébastien Miquel
Hi Michael, Michael Gauland writes: The file has two identical source blocks. The first generally behaves fine, though some lines get extra indentation. The second suffers more serious distortions. For example, the first line changes from "digraph G {" to "aph G {". I'm unable to reproduce

Re: source blocks mangled when edited

2021-05-31 Thread Michael Gauland
On 31/05/21 4:21 pm, Samuel Wales wrote: > idk if this will help as you probably know all of it already. butg > you asked for any help so here goes. i run maint, not master or any > emacs versions. weird that you are missing 3 cols? Switching to the maint branch didn't change anything, but I

Re: source blocks mangled when edited

2021-05-30 Thread Samuel Wales
idk if this will help as you probably know all of it already. butg you asked for any help so here goes. i run maint, not master or any emacs versions. weird that you are missing 3 cols? === here are notes on my workaround which wfm in the meantime if you are willing to do the same thing. i

source blocks mangled when edited

2021-05-30 Thread Michael Gauland
I've stared having trouble editing source blocks.    When I use C-c ' to edit block, the editing behaves as expected, but when I C-c ' to return to the main org file, the code is altered in strange ways.  I've had trouble coming up with a really small example, but the attached file seems to