emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Taiki SUGAWARA <buzz.taiki@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Aligning table is incorrect when containing japanese character
Date: Wed, 3 Feb 2010 03:58:30 +0900	[thread overview]
Message-ID: <73f97e501002021058k6f2942c5t73fba841fd080373@mail.gmail.com> (raw)

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

Hi,

When I align table containing japanese character as following steps:

  1. insert following table to buffer.
        | 日本語      |   |
        | foo bar baz |   |
  2. move cursor to top-left corner of table.

  3. Hit Tab, Tab

Aligning table is incorrect as following:
        | 日本語   |   |
        | foo bar baz |   |

I think, `org-table-justify-field-maybe' should use string width
instead of buffer's point distance.

I wrote attached patch to use string width. Would you review it?

Regards,
Taiki

[-- Attachment #2: org-table.el.patch --]
[-- Type: application/octet-stream, Size: 570 bytes --]

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 49c59e3..17327af 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -817,7 +817,7 @@ Optional argument NEW may specify text to replace the current field content."
 	    (progn
 	      (setq s (match-string 1)
 		    o (match-string 0)
-		    l (max 1 (- (match-end 0) (match-beginning 0) 3))
+		    l (max 1 (- (string-width o) 3))
 		    e (not (= (match-beginning 2) (match-end 2))))
 	      (setq f (format (if num " %%%ds %s" " %%-%ds %s")
 			      l (if e "|" (setq org-table-may-need-update t) ""))

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2010-02-02 18:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 18:58 Taiki SUGAWARA [this message]
2010-02-03  6:23 ` Aligning table is incorrect when containing japanese character Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=73f97e501002021058k6f2942c5t73fba841fd080373@mail.gmail.com \
    --to=buzz.taiki@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).