From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [RFC] ox-ascii.el: fixing variable width character handling Date: Fri, 03 Jan 2014 10:34:08 +0100 Message-ID: <87ob3te7e7.fsf@gmail.com> References: <87zjpcsfoq.wl@dns1.atmark-techno.com> <87vc00768z.fsf@gmail.com> <8738l5sdni.wl@dns1.atmark-techno.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vz18e-00008R-Eb for emacs-orgmode@gnu.org; Fri, 03 Jan 2014 04:34:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vz18Y-0001Te-KZ for emacs-orgmode@gnu.org; Fri, 03 Jan 2014 04:33:56 -0500 Received: from mail-ee0-x22c.google.com ([2a00:1450:4013:c00::22c]:33025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vz18Y-0001T3-DJ for emacs-orgmode@gnu.org; Fri, 03 Jan 2014 04:33:50 -0500 Received: by mail-ee0-f44.google.com with SMTP id b57so6629264eek.31 for ; Fri, 03 Jan 2014 01:33:49 -0800 (PST) In-Reply-To: <8738l5sdni.wl@dns1.atmark-techno.com> (Yasushi SHOJI's message of "Fri, 03 Jan 2014 16:55:13 +0900") 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: Yasushi SHOJI Cc: emacs-orgmode@gnu.org Hello, Yasushi SHOJI 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