emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Yasushi SHOJI <yashi@atmark-techno.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] lisp/org.el (org-set-tags): Calculate width of tags with string-width
Date: Sat, 12 Oct 2013 20:10:06 +0900	[thread overview]
Message-ID: <878uxy20mk.wl@dns1.atmark-techno.com> (raw)

* lisp/org.el (org-set-tags): Width of strings presenting on a buffer
should be calculated with `string-width' instead of `length'.

This fixes unaligned tags for the languages with multi-width
characters.
---
Hi,

I just noticed that tags are not aligned when I use Japanese chars for
tags.  This patch should fix it.

Other two usages of `length' in the function are fine since they seem
to be used to find the length of lists.

oh, I also found one trailing white space in the fine.  Please drop
that hunk if you don't want to mix it.

Best,

 lisp/org.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 5ff9969..a6df29d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14556,7 +14556,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
 		       0)
 		  p0 (if (equal (char-before) ?*) (1+ (point)) (point))
 		  tc (+ org-tags-column (if (> org-tags-column 0) (- di) di))
-		  c1 (max (1+ c0) (if (> tc 0) tc (- (- tc) (length tags))))
+		  c1 (max (1+ c0) (if (> tc 0) tc (- (- tc) (string-width tags))))
 		  rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags)))
 	  (replace-match rpl t t)
 	  (and (not (featurep 'xemacs)) c0 indent-tabs-mode (tabify p0 (point)))
@@ -20385,7 +20385,7 @@ If `org-special-ctrl-o' is nil, just call `open-line' everywhere."
     (open-line n))
    ((org-at-table-p)
     (org-table-insert-row))
-   (t    
+   (t
     (open-line n))))
 
 (defun org-return (&optional indent)
-- 
1.8.4.rc3

             reply	other threads:[~2013-10-12 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-12 11:10 Yasushi SHOJI [this message]
2013-11-04 12:12 ` [PATCH] lisp/org.el (org-set-tags): Calculate width of tags with string-width Bastien

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=878uxy20mk.wl@dns1.atmark-techno.com \
    --to=yashi@atmark-techno.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).