emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* bug#45915: 27.1.91; deletechar distorts org-table
       [not found] <20210116.170134.789950463868688311.tkk@misasa.okayama-u.ac.jp>
@ 2021-01-31  2:54 ` Tak Kunihiro
  2021-04-28  6:03   ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Tak Kunihiro @ 2021-01-31  2:54 UTC (permalink / raw)
  To: 45915; +Cc: tkk

I confirm that there still is following problem on 27.1.91.
Could someone take a look and show me work around?

> I am using emacs 27.1 with orgtbl-mode.  On certain condition, typing
> <deletechar> distorts alighment of a table.  Then, typing <up> moves
> previous line but far right position.
>
> |   | rownames |     |   | rownames |
> | / | <l>      |     | / | <l>      |
> |---+----------| ->  |---+----------|
> | / | a        |     |  | a        |
>
> Here is a recipe to reproduce the glitch started from emcas -Q.  I
> hope that together with bug#45091, this would be fixed before 27.2.
>
> 1. Create a buffer with (text-mode) and yank following table.
>
> |   | rownames |
> | / | <l>      |
> |---+----------|
> |   | 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 <S-return>.
> 5. Hit <deletechar>.
> 6. Hit <up>.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#45915: 27.1.91; deletechar distorts org-table
  2021-01-31  2:54 ` bug#45915: 27.1.91; deletechar distorts org-table Tak Kunihiro
@ 2021-04-28  6:03   ` Bastien
  2021-04-28  8:36     ` bug#45915: 27.2; " Tak Kunihiro
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2021-04-28  6:03 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: tkk, 45915

Tak Kunihiro <homeros.misasa@gmail.com> writes:

> 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?

See https://orgmode.org/org.html#Installation on how to install
using Org’s git repository if you want to try the latest version.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#45915: 27.2; deletechar distorts org-table
  2021-04-28  6:03   ` Bastien
@ 2021-04-28  8:36     ` Tak Kunihiro
  2021-10-11  0:45       ` bug#45915: 29.0.50; " Tak Kunihiro
  0 siblings, 1 reply; 9+ messages in thread
From: Tak Kunihiro @ 2021-04-28  8:36 UTC (permalink / raw)
  To: 45915

>> 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 <deletechar> distorts alignment of
> a table.  Then, typing <up> moves point to previous line but far
> right position (column 14 instead of column 2).
> 
> |   | rownames |     |   | rownames |
> | / | <l>      |     | / | <l>      |
> |---+----------| ->  |---+----------|
> | / | 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 |
> | / | <l>      |
> |---+----------|
> |   | 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 <S-return>.
> 5. Hit <deletechar>.
> 6. Hit <up>.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#45915: 29.0.50; deletechar distorts org-table
  2021-04-28  8:36     ` bug#45915: 27.2; " Tak Kunihiro
@ 2021-10-11  0:45       ` Tak Kunihiro
  2021-12-07  8:43         ` bug#45915: 28.0.90; " Tak Kunihiro
  0 siblings, 1 reply; 9+ messages in thread
From: Tak Kunihiro @ 2021-10-11  0:45 UTC (permalink / raw)
  To: 45915; +Cc: tkk

I confirm that there is still problem with org-table
on Emacs 29.0.50 with org-version 9.5.
I created a function to produce the problem as shown below.
Can you try again?

(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 |
| / | <l>      |
|---+----------|
|   | 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-<return>.")
  (sit-for 2)
  (execute-kbd-macro (kbd "S-<return>"))
  (message "I will hit <delete>.")
  (sit-for 2)
  (execute-kbd-macro (kbd "<delete>"))
  (message "I will call previous-line.")
  (sit-for 2)
  (call-interactively 'previous-line))
;;; (call-interactively 'emacs-bug-reproduce-45915)


>>> 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 <deletechar> distorts alignment of
>> a table.  Then, typing <up> moves point to previous line but far
>> right position (column 14 instead of column 2).
>> 
>> |   | rownames |     |   | rownames |
>> | / | <l>      |     | / | <l>      |
>> |---+----------| ->  |---+----------|
>> | / | 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 |
>> | / | <l>      |
>> |---+----------|
>> |   | 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 <S-return>.
>> 5. Hit <deletechar>.
>> 6. Hit <up>.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#45915: 28.0.90; deletechar distorts org-table
  2021-10-11  0:45       ` bug#45915: 29.0.50; " Tak Kunihiro
@ 2021-12-07  8:43         ` Tak Kunihiro
  2021-12-19 12:53           ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Tak Kunihiro @ 2021-12-07  8:43 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: tkk, 45915

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 |
| / | <l>      |
|---+----------|
|   | 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-<return>.")
  (sit-for 2)
  (execute-kbd-macro (kbd "S-<return>"))
  (message "I will hit <delete>.")
  (sit-for 2)
  (execute-kbd-macro (kbd "<delete>"))
  (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 <deletechar> distorts alignment of
>>> a table.  Then, typing <up> moves point to previous line but far
>>> right position (column 14 instead of column 2).
>>> 
>>> |   | rownames |     |   | rownames |
>>> | / | <l>      |     | / | <l>      |
>>> |---+----------| ->  |---+----------|
>>> | / | 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 |
>>> | / | <l>      |
>>> |---+----------|
>>> |   | 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 <S-return>.
>>> 5. Hit <deletechar>.
>>> 6. Hit <up>.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#45915: 28.0.90; deletechar distorts org-table
  2021-12-07  8:43         ` bug#45915: 28.0.90; " Tak Kunihiro
@ 2021-12-19 12:53           ` Ihor Radchenko
  2021-12-29  6:28             ` Tak Kunihiro
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2021-12-19 12:53 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: tkk, 45915

[-- Attachment #1: Type: text/plain, Size: 309 bytes --]

Tak Kunihiro <homeros.misasa@gmail.com> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-table.el-Fix-orgtbl-mode-not-remapping-delete-ke.patch --]
[-- Type: text/x-diff, Size: 1090 bytes --]

From 7b1a7d43e090292b6bd821c65a644f8c599b2044 Mon Sep 17 00:00:00 2001
Message-Id: <7b1a7d43e090292b6bd821c65a644f8c599b2044.1639918362.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
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-B04B83694C85@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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#45915: 28.0.90; deletechar distorts org-table
  2021-12-19 12:53           ` Ihor Radchenko
@ 2021-12-29  6:28             ` Tak Kunihiro
  2022-04-30  4:00               ` Ihor Radchenko
  2022-04-30  4:00               ` Ihor Radchenko
  0 siblings, 2 replies; 9+ messages in thread
From: Tak Kunihiro @ 2021-12-29  6:28 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Tak Kunihiro, tkk, 45915

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 <yantar92@gmail.com> writes:

> Tak Kunihiro <homeros.misasa@gmail.com> 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.yantar92@gmail.com>
> From: Ihor Radchenko <yantar92@gmail.com>
> 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-B04B83694C85@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))




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#45915: 28.0.90; deletechar distorts org-table
  2021-12-29  6:28             ` Tak Kunihiro
@ 2022-04-30  4:00               ` Ihor Radchenko
  2022-04-30  4:00               ` Ihor Radchenko
  1 sibling, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2022-04-30  4:00 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: tkk, 45915

Tak Kunihiro <homeros.misasa@gmail.com> 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, <delete> 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 |
| / | <l>      |
|---+----------|
|   | 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-<return>.")
  (sit-for 2)
  (execute-kbd-macro (kbd "S-<return>"))
  (message "I will hit <delete>.")
  (sit-for 2)
  ;;  (execute-kbd-macro (kbd "<delete>"))
  (delete-char 1)
  (message "I will call previous-line.")
  (sit-for 2)
  (call-interactively 'previous-line))

Best,
Ihor




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#45915: 28.0.90; deletechar distorts org-table
  2021-12-29  6:28             ` Tak Kunihiro
  2022-04-30  4:00               ` Ihor Radchenko
@ 2022-04-30  4:00               ` Ihor Radchenko
  1 sibling, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2022-04-30  4:00 UTC (permalink / raw)
  To: Tak Kunihiro; +Cc: tkk, 45915

Tak Kunihiro <homeros.misasa@gmail.com> 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, <delete> 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 |
| / | <l>      |
|---+----------|
|   | 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-<return>.")
  (sit-for 2)
  (execute-kbd-macro (kbd "S-<return>"))
  (message "I will hit <delete>.")
  (sit-for 2)
  ;;  (execute-kbd-macro (kbd "<delete>"))
  (delete-char 1)
  (message "I will call previous-line.")
  (sit-for 2)
  (call-interactively 'previous-line))

Best,
Ihor




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-04-30  4:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210116.170134.789950463868688311.tkk@misasa.okayama-u.ac.jp>
2021-01-31  2:54 ` bug#45915: 27.1.91; deletechar distorts org-table Tak Kunihiro
2021-04-28  6:03   ` Bastien
2021-04-28  8:36     ` bug#45915: 27.2; " Tak Kunihiro
2021-10-11  0:45       ` bug#45915: 29.0.50; " Tak Kunihiro
2021-12-07  8:43         ` bug#45915: 28.0.90; " Tak Kunihiro
2021-12-19 12:53           ` Ihor Radchenko
2021-12-29  6:28             ` Tak Kunihiro
2022-04-30  4:00               ` Ihor Radchenko
2022-04-30  4:00               ` Ihor Radchenko

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).