bug#45915: 28.0.90; deletechar distorts org-table

2022-06-18 Thread Ihor Radchenko
Ihor Radchenko  writes:

> To clarify, I haven't applied the patch onto Org upstream.
> Before the patch, the table is distorted because of an omission in Org.
> After the patch, the table is distorted only using your reproducer
> specifically, and the issue appears to be on Emacs side.

I now applied the patch onto main via 65e19a081.

This should solve part of the problem.
The remaining part should be solved on Emacs side (AFAIU).

Best,
Ihor





bug#45915: 28.0.90; deletechar distorts org-table

2022-05-23 Thread Ihor Radchenko
Tak Kunihiro  writes:

> I still see the problem with GNU Emacs 29.0.50 (build 8,
> x86_64-apple-darwin21.5.0, NS appkit-2113.50 Version 12.4 (Build 21F79))
> of 2022-05-23 with org-version 9.5.3.
>
> I create org-tables and revise these everyday.  On duplication of a
> cell, I hit S- often. The problem occurs, with my use case, once
> in 5 minutes. IOW point moves unexpectedly once in 5 minutes.

To clarify, I haven't applied the patch onto Org upstream.
Before the patch, the table is distorted because of an omission in Org.
After the patch, the table is distorted only using your reproducer
specifically, and the issue appears to be on Emacs side.

Best,
Ihor





bug#45915: 28.0.90; deletechar distorts org-table

2022-05-23 Thread Tak Kunihiro
Dear Ihor,

> However, this (delete-char 1) somehow deletes 2!! chars instead of
> 1. This should be some tricky Emacs issue (bug?). In any case, I am
> not ready to dig into what is going on in Emacs. I do not think that
> such problem is going to appear during normal Emacs usage. At least, I
> was unable to reproduce it by other means than your reproducer
> function.
>
> To illustrate the issue, one can use the following version of the
> reproducer. Feel free to report this to Emacs upstream.

(defun emacs-bug-reproduce-45915 ()
  "Reproduce bug#45915."
  ;; (gnus-read-ephemeral-emacs-bug-group 45915)
  (interactive)
  (with-current-buffer (get-buffer-create "*temp buffer*")
(erase-buffer)
(require 'org)
(orgtbl-mode 1)
(insert (format "emacs-version: %s, org-version: %s\n" emacs-version 
org-version))
(insert "|   | rownames |
| / |   |
|---+--|
|   | a|"))
  (switch-to-buffer-other-window "*temp buffer*")
  (execute-kbd-macro (kbd "M-< C-n C-n C-n C-n C-f C-f"))
  (message "I will hit S-.")
  (sit-for 2)
  (execute-kbd-macro (kbd "S-"))
  (message "I will hit .")
  (sit-for 2)
  ;;  (execute-kbd-macro (kbd ""))
  (delete-char 1)
  (message "I will call previous-line.")
  (sit-for 2)
  (call-interactively 'previous-line))

I still see the problem with GNU Emacs 29.0.50 (build 8,
x86_64-apple-darwin21.5.0, NS appkit-2113.50 Version 12.4 (Build 21F79))
of 2022-05-23 with org-version 9.5.3.

I create org-tables and revise these everyday.  On duplication of a
cell, I hit S- often. The problem occurs, with my use case, once
in 5 minutes. IOW point moves unexpectedly once in 5 minutes.

I think that there is an issue in `org-table-copy-down'. However, I
cannot tell what specifically is not good.

Is this issue of Emacs instead of Org?





bug#45915: 28.0.90; deletechar distorts org-table

2022-04-29 Thread Ihor Radchenko
Tak Kunihiro  writes:

> Thank you for the patch.  I applied the patch to org-table.el on Emacs
> 28.0.90.
>
> And I still see the problem there.  Is the problem solved by the patch
> on your environment?

The problem was solved on my side, but _not_ using your reproducer
explicitly. If I save the buffer from your reproducer as a file and
later open in, the patch does solve the problem. However, when I run the
reproducer as is, a similar-looking problem emerges.

Using your reproducer, something very strange is going on.
With the patch,  is correctly mapped to org-delete-char, which
calls (delete-char 1) at some point. However, this (delete-char 1)
somehow deletes 2!! chars instead of 1. This should be some tricky Emacs
issue (bug?). In any case, I am not ready to dig into what is going on
in Emacs. I do not think that such problem is going to appear during
normal Emacs usage. At least, I was unable to reproduce it by other
means than your reproducer function.

To illustrate the issue, one can use the following version of the
reproducer. Feel free to report this to Emacs upstream.

(defun emacs-bug-reproduce-45915 ()
  "Reproduce bug#45915."
  ;; (gnus-read-ephemeral-emacs-bug-group 45915)
  (interactive)
  (with-current-buffer (get-buffer-create "*temp buffer*")
(erase-buffer)
(require 'org)
(orgtbl-mode 1)
(insert (format "emacs-version: %s, org-version: %s\n" emacs-version 
org-version))
(insert "|   | rownames |
| / |   |
|---+--|
|   | a|"))
  (switch-to-buffer-other-window "*temp buffer*")
  (execute-kbd-macro (kbd "M-< C-n C-n C-n C-n C-f C-f"))
  (message "I will hit S-.")
  (sit-for 2)
  (execute-kbd-macro (kbd "S-"))
  (message "I will hit .")
  (sit-for 2)
  ;;  (execute-kbd-macro (kbd ""))
  (delete-char 1)
  (message "I will call previous-line.")
  (sit-for 2)
  (call-interactively 'previous-line))

Best,
Ihor





bug#45915: 28.0.90; deletechar distorts org-table

2022-04-29 Thread Ihor Radchenko
Tak Kunihiro  writes:

> Thank you for the patch.  I applied the patch to org-table.el on Emacs
> 28.0.90.
>
> And I still see the problem there.  Is the problem solved by the patch
> on your environment?

The problem was solved on my side, but _not_ using your reproducer
explicitly. If I save the buffer from your reproducer as a file and
later open in, the patch does solve the problem. However, when I run the
reproducer as is, a similar-looking problem emerges.

Using your reproducer, something very strange is going on.
With the patch,  is correctly mapped to org-delete-char, which
calls (delete-char 1) at some point. However, this (delete-char 1)
somehow deletes 2!! chars instead of 1. This should be some tricky Emacs
issue (bug?). In any case, I am not ready to dig into what is going on
in Emacs. I do not think that such problem is going to appear during
normal Emacs usage. At least, I was unable to reproduce it by other
means than your reproducer function.

To illustrate the issue, one can use the following version of the
reproducer. Feel free to report this to Emacs upstream.

(defun emacs-bug-reproduce-45915 ()
  "Reproduce bug#45915."
  ;; (gnus-read-ephemeral-emacs-bug-group 45915)
  (interactive)
  (with-current-buffer (get-buffer-create "*temp buffer*")
(erase-buffer)
(require 'org)
(orgtbl-mode 1)
(insert (format "emacs-version: %s, org-version: %s\n" emacs-version 
org-version))
(insert "|   | rownames |
| / |   |
|---+--|
|   | a|"))
  (switch-to-buffer-other-window "*temp buffer*")
  (execute-kbd-macro (kbd "M-< C-n C-n C-n C-n C-f C-f"))
  (message "I will hit S-.")
  (sit-for 2)
  (execute-kbd-macro (kbd "S-"))
  (message "I will hit .")
  (sit-for 2)
  ;;  (execute-kbd-macro (kbd ""))
  (delete-char 1)
  (message "I will call previous-line.")
  (sit-for 2)
  (call-interactively 'previous-line))

Best,
Ihor





bug#45915: 28.0.90; deletechar distorts org-table

2021-12-28 Thread Tak Kunihiro
Dear Ihor

Thank you for the patch.  I applied the patch to org-table.el on Emacs
28.0.90.

And I still see the problem there.  Is the problem solved by the patch
on your environment?

Tak

Ihor Radchenko  writes:

> Tak Kunihiro  writes:
>
>> I confirm that there still is the problem with org-table on Emacs
>> 28.0.90 pretest with org-version 9.5.1.
>>
>> Here is a recipe to reproduce the problem.  I still have to stick to
>> 26.3.
>
> I was able to reproduce. Can you try the attached fix?
>
> Best,
> Ihor
>
> From 7b1a7d43e090292b6bd821c65a644f8c599b2044 Mon Sep 17 00:00:00 2001
> Message-Id: 
> <7b1a7d43e090292b6bd821c65a644f8c599b2044.1639918362.git.yanta...@gmail.com>
> From: Ihor Radchenko 
> Date: Sun, 19 Dec 2021 20:49:54 +0800
> Subject: [PATCH] org-table.el: Fix orgtbl-mode not remapping delete key
>
> * lisp/org-table.el (orgtbl-setup): Remap `delete-forward-char' in
> addition to `deleta-char'.  The former is called in Emacs >26.
>
> Fixes 
> https://orgmode.org/list/1ad1b9b7-5a15-4f86-9274-b04b83694...@misasa.okayama-u.ac.jp
> ---
>  lisp/org-table.el | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lisp/org-table.el b/lisp/org-table.el
> index 1546cd563..0560e32a1 100644
> --- a/lisp/org-table.el
> +++ b/lisp/org-table.el
> @@ -5290,6 +5290,7 @@ (defun orgtbl-setup ()
>(org-remap orgtbl-mode-map
>'self-insert-command 'orgtbl-self-insert-command
>'delete-char 'org-delete-char
> + 'delete-forward-char 'org-delete-char
>'delete-backward-char 'org-delete-backward-char)
>(org-defkey orgtbl-mode-map "|" 'org-force-self-insert))
>  t))





bug#45915: 28.0.90; deletechar distorts org-table

2021-12-19 Thread Ihor Radchenko
Tak Kunihiro  writes:

> I confirm that there still is the problem with org-table on Emacs
> 28.0.90 pretest with org-version 9.5.1.
>
> Here is a recipe to reproduce the problem.  I still have to stick to
> 26.3.

I was able to reproduce. Can you try the attached fix?

Best,
Ihor

>From 7b1a7d43e090292b6bd821c65a644f8c599b2044 Mon Sep 17 00:00:00 2001
Message-Id: <7b1a7d43e090292b6bd821c65a644f8c599b2044.1639918362.git.yanta...@gmail.com>
From: Ihor Radchenko 
Date: Sun, 19 Dec 2021 20:49:54 +0800
Subject: [PATCH] org-table.el: Fix orgtbl-mode not remapping delete key

* lisp/org-table.el (orgtbl-setup): Remap `delete-forward-char' in
addition to `deleta-char'.  The former is called in Emacs >26.

Fixes https://orgmode.org/list/1ad1b9b7-5a15-4f86-9274-b04b83694...@misasa.okayama-u.ac.jp
---
 lisp/org-table.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 1546cd563..0560e32a1 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -5290,6 +5290,7 @@ (defun orgtbl-setup ()
   (org-remap orgtbl-mode-map
 		 'self-insert-command 'orgtbl-self-insert-command
 		 'delete-char 'org-delete-char
+ 'delete-forward-char 'org-delete-char
 		 'delete-backward-char 'org-delete-backward-char)
   (org-defkey orgtbl-mode-map "|" 'org-force-self-insert))
 t))
-- 
2.32.0



bug#45915: 28.0.90; deletechar distorts org-table

2021-12-07 Thread Tak Kunihiro
I confirm that there still is the problem with org-table on Emacs
28.0.90 pretest with org-version 9.5.1.

Here is a recipe to reproduce the problem.  I still have to stick to
26.3.

 1. emacs -Q
 2. (defun emacs-bug-reproduce-45915 () ...)
 3. (call-interactively 'emacs-bug-reproduce-45915)

(defun emacs-bug-reproduce-45915 ()
  "Reproduce bug#45915."
  ;; (gnus-read-ephemeral-emacs-bug-group 45915)
  (interactive)
  (with-current-buffer (get-buffer-create "*temp buffer*")
(erase-buffer)
(require 'org)
(orgtbl-mode 1)
(insert (format "emacs-version: %s, org-version: %s\n" emacs-version 
org-version))
(insert "|   | rownames |
| / |   |
|---+--|
|   | a|"))
  (switch-to-buffer-other-window "*temp buffer*")
  (execute-kbd-macro (kbd "M-< C-n C-n C-n C-n C-f C-f"))
  (message "I will hit S-.")
  (sit-for 2)
  (execute-kbd-macro (kbd "S-"))
  (message "I will hit .")
  (sit-for 2)
  (execute-kbd-macro (kbd ""))
  (message "I will call previous-line.")
  (sit-for 2)
  (call-interactively 'previous-line))

> I confirm that there is still problem with org-table
> on Emacs 29.0.50 with org-version 9.5.
>
 I confirm that there still is following problem on 27.1.91.
 Could someone take a look and show me work around?
>>> 
>>> I cannot reproduce this with latest Org stable version 9.4.5.
>>> 
>>> Can you try again and report?
>>
>> I downloaded Org 9.4.5 and reproduced the problem on 26.3, 27.2,
>> and 28.0.50. Here is a recipe again.
>>
>>> On certain condition, typing  distorts alignment of
>>> a table.  Then, typing  moves point to previous line but far
>>> right position (column 14 instead of column 2).
>>> 
>>> |   | rownames | |   | rownames |
>>> | / |   | | / |   |
>>> |---+--| ->  |---+--|
>>> | / | a| |  | a|
>>> 
>>> Here is a recipe to reproduce the glitch started from emcas -Q. 
>>> 
>>> 1. Create a buffer with (text-mode) and yank following table.
>>> 
>>> |   | rownames |
>>> | / |   |
>>> |---+--|
>>> |   | a|
>>> 
>>> 2. (progn (require 'org) (call-interactively 'orgtbl-mode))
>>> 3. Move point to the first column and the third line with letter 'a'.
>>> 4. Hit .
>>> 5. Hit .
>>> 6. Hit .