emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] lisp/org.el (org-set-tags): Calculate width of tags with string-width
@ 2013-10-12 11:10 Yasushi SHOJI
  2013-11-04 12:12 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Yasushi SHOJI @ 2013-10-12 11:10 UTC (permalink / raw)
  To: emacs-orgmode

* 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

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

* Re: [PATCH] lisp/org.el (org-set-tags): Calculate width of tags with string-width
  2013-10-12 11:10 [PATCH] lisp/org.el (org-set-tags): Calculate width of tags with string-width Yasushi SHOJI
@ 2013-11-04 12:12 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2013-11-04 12:12 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

Hi Yasushi,

Yasushi SHOJI <yashi@atmark-techno.com> writes:

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

Applied in master, thanks.

(I added TINYCHANGE at the end of your commit by mistake, I didn't
realize you signed the FSF papers -- sorry for that.)

-- 
 Bastien

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

end of thread, other threads:[~2013-11-04 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-12 11:10 [PATCH] lisp/org.el (org-set-tags): Calculate width of tags with string-width Yasushi SHOJI
2013-11-04 12:12 ` Bastien

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).