Subject: Re: bug#45091: 27.1; M-x org-table-paste-rectangle

From: Naoya Yamashita <[email-masked]>
Date: Sat, 16 Jan 2021 04:33:49 +0900 (JST)

> Okay, your bisect scripts points to one of my commits.
> 
> But I wish it was more automated.  Because I tried quite
> hard and sometimes I _could_ reproduce the problem and
> sometimes I couldn't.  So you could be seeing noise here.
> Maybe you can make your script  do those copy-paste
> operations automatically and reliably?  Then we'd be sure.
> 
> Anyway, I think is might be enough to point to a bug
> that was introduced by my commit, or rather exposed
> by it.  I'll have another look.

Sorry, you're true.  I try to build (semi-)automatically
reproduce step and do bisect with it, I got different commit.

It is 165f7383822086d465519ebe6e4283723923f097 (Update Org to 9.3).

(I wanted to reproduce the problem completely in auto, but the
problem is related to Emacs font-lock and post-command-hook, and
I could not reproduce it with --batch.  If you know how to
partially pass control to Emacs main-loop while running Elisp,
please tell me that.)

## Repro step

1. Prepare below contents.

```latex <~/dev/tmp/taks-file.tex>
-*- mode: latex -*-

| rownames                    |  acq |
| ref-coal-krt-2000-4-s1@4104 | 4104 |
| ref-coal-krt-2000-4-s1@4105 | 4105 |

|------------------------+--------+--------+---------------+---------+---------+-----+------+------|
|                        | 12C12C | 12C14N | 12C14Nz12C12C | d13Cion | d15Nion | N/C | d13C | d15N |
|------------------------+--------+--------+---------------+---------+---------+-----+------+------|
| !cniso-mtx-ogl1-2@4112 |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4113  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4114  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4115  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4116  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4117  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4118  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4119  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4124  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4125  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4126  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4127  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4128  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4129  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4130  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4131  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4132  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4133  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4134  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4135  |        |        |               |         |         |     |      |      |
| cniso-mtx-ogl1-2@4136  |        |        |               |         |         |     |      |      |
|------------------------+--------+--------+---------------+---------+---------+-----+------+------|
```

```sh <~/dev/tmp/bisect-script.sh>
git clean -fdx
make clean
./autogen.sh
./configure --prefix=$HOME/.local/head
make -j6
./src/emacs -Q ~/dev/tmp/taks-file.tex --eval "
  (progn
    (setq truncate-lines t)
    (setq debug-on-error t)
    (require 'org)
    (require 'org-table)
    (orgtbl-mode)
    
    (search-forward \"|\")
    (org-table-copy-region (1+ (org-table-begin)) (- (org-table-end) 2))
    
    (search-forward \"!\")
    
    (global-set-key (kbd \"<f5>\")
      (lambda ()
        (interactive)
        (org-table-paste-rectangle)
        (set-buffer-modified-p nil)
        (condition-case e
            (insert \"text\")
          (error
           (kill-emacs 1)))
        (kill-emacs 0)))
    )" \
2>/dev/null
```

2. Do below command in terminal
```sh
git bisect start emacs-27.1 emacs-26.3
git bisect run ~/dev/tmp/bisect-script.sh
```

3. Wait for build and wake Emacs, then press <f5>.

4. Got commit it has some problem.
(I got bellow bisect log in Magit)
```
Bisect Log (15)
git bisect start 'emacs-27.1' 'emacs-26.3'
git bisect good 38564f8a664347c42f7614d9c91e0d49e4a073e8
git bisect good 825fd4d34165e5edc718a9df93838a410d25ea81
git bisect good 5c5c1b559313d06aab6516ff1b1acf1da3a01c7d
git bisect bad d7cd4ab7d948427104003f1d35cf52a4eac45d0a
git bisect bad 4b2c2faab83fe3b13430b837be7d450b5cd47caf
git bisect good 16ce6dbef279bda70b4d60b4d2d0aff008bfa5f7
git bisect bad 5063e38921de8cb872965abda32bcc6fd8894532
git bisect bad 4c933077157ba409d645f4649c8a3a8e534d53d5
git bisect bad 096be9c4541329af259273fe604dc4f8669fbd8a
git bisect bad 8f2267c87bc96d6301aadeda66b870a61a0433e8
git bisect good 8bea7e9ab4453da71d9766d582089154f31de907
git bisect bad 165f7383822086d465519ebe6e4283723923f097
git bisect good 821de968434d2096bdea67dd24301bf6b517aef1
165f7383822086d465519ebe6e4283723923f097 is the first bad commit
```