From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yasushi SHOJI Subject: [PATCH] lisp/org.el (org-set-tags): Calculate width of tags with string-width Date: Sat, 12 Oct 2013 20:10:06 +0900 Message-ID: <878uxy20mk.wl@dns1.atmark-techno.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUxJ8-0001Ud-Eq for emacs-orgmode@gnu.org; Sat, 12 Oct 2013 07:24:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUxJ1-0004Ku-59 for emacs-orgmode@gnu.org; Sat, 12 Oct 2013 07:24:30 -0400 Received: from plane.gmane.org ([80.91.229.3]:54481) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUxJ0-0004Kq-Um for emacs-orgmode@gnu.org; Sat, 12 Oct 2013 07:24:23 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VUxIz-0005zQ-9E for emacs-orgmode@gnu.org; Sat, 12 Oct 2013 13:24:21 +0200 Received: from i220-108-3-63.s02.a001.ap.plala.or.jp ([220.108.3.63]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 12 Oct 2013 13:24:21 +0200 Received: from yashi by i220-108-3-63.s02.a001.ap.plala.or.jp with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 12 Oct 2013 13:24:21 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * 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