emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Yasushi SHOJI <yashi@atmark-techno.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [RFC] ox-ascii.el: fixing variable width character handling
Date: Fri, 03 Jan 2014 10:34:08 +0100	[thread overview]
Message-ID: <87ob3te7e7.fsf@gmail.com> (raw)
In-Reply-To: <8738l5sdni.wl@dns1.atmark-techno.com> (Yasushi SHOJI's message of "Fri, 03 Jan 2014 16:55:13 +0900")

Hello,

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

> Ok here is new one.  I've been using for a while.  Hope it works for
> others.

Thank you. It looks mostly good, but I cannot apply it on top of master
branch. Could you rebase and send an updated version?

> * lisp/ox-ascii.el (org-ascii--current-text-width): Convert `length'
>   to `string-width'.
>   (org-ascii--build-title): Likewise.
>   (org-ascii--build-toc): Likewise.
>   (org-ascii--list-listings): Likewise.
>   (org-ascii--list-tables): Likewise.
>   (org-ascii-template--document-title): Likewise.
>   (org-ascii-inner-template): Likewise.
>   (org-ascii-format-inlinetask-default): Likewise.
>   (org-ascii-format-inlinetask-default):Likewise.
>   (org-ascii-item): Likewise.
>   (org-ascii--table-cell-width): Likewise.
>   (org-ascii-table-cell): Likewise.
>   (org-ascii--current-text-width): Likewise.

The usual format is

  (org-ascii--build-title, org-ascii--build-toc, ...): Likewise.

IOW, you don't need a new line for each function.

> -		 (let ((struct (org-element-property :structure parent-item))
> -		       (beg-item (org-element-property :begin parent-item)))
> +		 (let* ((struct (org-element-property :structure parent-item))
> +			(beg-item (org-element-property :begin parent-item))
> +			(tag (org-list-get-tag beg-item struct))
> +			(bullet (org-list-get-bullet beg-item struct)))

Since you don't use these variables below, you can skip both tag and
bullet binding.

>  		   (+ (- (org-list-get-ind beg-item struct)
>  			 (org-list-get-ind
>  			  (org-list-get-top-point struct) struct))
> -		      (length (org-ascii--checkbox parent-item info))
> -		      (length
> +		      (string-width (or (org-ascii--checkbox parent-item info) ""))
> +		      (string-width
>  		       (or (org-list-get-tag beg-item struct)
> -			   (org-list-get-bullet beg-item struct)))))))))))))
> +			   (org-list-get-bullet beg-item struct)
> +			   ""))))))))))))


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2014-01-03  9:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-10 10:40 [RFC] ox-ascii.el: fixing variable width character handling Yasushi SHOJI
2013-11-10 13:09 ` Nicolas Goaziou
2014-01-03  7:55   ` Yasushi SHOJI
2014-01-03  9:34     ` Nicolas Goaziou [this message]
2014-01-04 11:18       ` Yasushi SHOJI
2014-01-04 19:34         ` Nicolas Goaziou
2014-01-16 15:25         ` Nicolas Goaziou

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=87ob3te7e7.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yashi@atmark-techno.com \
    /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).