Subject: bug#42487: 26.3; org-mode; Found a bug when typing Korean in org-table!

From: Chanhee Jeong <[email-masked]>
Date: Fri, 18 Sep 2020 03:06:37 +0000

Thank you for the advice!

Indeed, (setq org-table-auto-blank-field nil) does fix my problems – no more disappearing Korean characters!

Adding the said line in my .emacs works for me, but I believe adding a line in .emacs doesn’t count as a bug fix… (am I right?)

I think it’s a problem arising from Korean input method and org-table input method. Both are excellent codes but I guess org-table was written without consideration of a language other than English.

I did some research and in org-table.el, function orgtbl-self-insert-command seem to be related, though I’m not sure where the problem begins…

I’m appending the function definition (although I’m sure you’ll have no problem finding it)

(defun orgtbl-self-insert-command (N)
  "Like `self-insert-command', use overwrite-mode for whitespace in tables.
If the cursor is in a table looking at whitespace, the whitespace is
overwritten, and the table is not marked as requiring realignment."
  (interactive "p")
  (if (and (org-at-table-p)
              (or
               (and org-table-auto-blank-field
                     (member last-command
                                '(orgtbl-hijacker-command-100
                                   orgtbl-hijacker-command-101
                                   orgtbl-hijacker-command-102
                                   orgtbl-hijacker-command-103
                                   orgtbl-hijacker-command-104
                                   orgtbl-hijacker-command-105
                                   yas/expand))
                     (org-table-blank-field))
               t)
              (eq N 1)
              (looking-at "[^|\n]* \\( \\)|"))
      (let (org-table-may-need-update)
           (delete-region (match-beginning 1) (match-end 1))
           (self-insert-command N))
    (setq org-table-may-need-update t)
    (let* (orgtbl-mode
              a
              (cmd (or (key-binding
                          (or (and (listp function-key-map)
                                      (setq a (assoc last-input-event function-key-map))
                                      (cdr a))
                                (vector last-input-event)))
                         'self-insert-command)))
      (call-interactively cmd)
      (if (and org-self-insert-cluster-for-undo
                  (eq cmd 'self-insert-command))
             (if (not (eq last-command 'orgtbl-self-insert-command))
                 (setq org-self-insert-command-undo-counter 1)
               (if (>= org-self-insert-command-undo-counter 20)
                     (setq org-self-insert-command-undo-counter 1)
                 (and (> org-self-insert-command-undo-counter 0)
                        buffer-undo-list
                        (not (cadr buffer-undo-list)) ; remove nil entry
                        (setcdr buffer-undo-list (cddr buffer-undo-list)))
                 (setq org-self-insert-command-undo-counter
                         (1+ org-self-insert-command-undo-counter))))))))

The if statement seem to be t for Korean input for some reason… Could you take another look into it please?

Thank you very much

Sincerely,

Chanhee Jeong
[email-masked]<mailto:[email-masked]>
[email-masked]<mailto:[email-masked]>

보낸 사람: Bastien<mailto:[email-masked]>
보낸 날짜: 2020년 9월 6일 일요일 오후 5:18
받는 사람: Chanhee Jeong<mailto:[email-masked]>
참조: Eli Zaretskii<mailto:[email-masked]>; [email-masked]<mailto:[email-masked]>
제목: Re: bug#42487: 26.3; org-mode; Found a bug when typing Korean in org-table!

Chanhee Jeong <[email-masked]> writes:

> Please refer to: https://giphy.com/gifs/Ln3lQrKDQIZf5RHCsM

Thanks for taking the time to provide an image, that's useful.

Can you try setting this:

(setq org-table-auto-blank-field nil)

Do you still have disappearing cells?

--
 Bastien