From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: [bug, ox-ascii][PATCH] description list and long links Date: Wed, 28 Jan 2015 01:30:19 +0100 Message-ID: <87twzbsq5g.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGGWj-0003xQ-H5 for emacs-orgmode@gnu.org; Tue, 27 Jan 2015 19:30:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGGWg-0007Wg-6m for emacs-orgmode@gnu.org; Tue, 27 Jan 2015 19:30:37 -0500 Received: from plane.gmane.org ([80.91.229.3]:45356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGGWf-0007WZ-P8 for emacs-orgmode@gnu.org; Tue, 27 Jan 2015 19:30:33 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YGGWb-0006oF-51 for emacs-orgmode@gnu.org; Wed, 28 Jan 2015 01:30:29 +0100 Received: from 102.201.133.37.dynamic.jazztel.es ([37.133.201.102]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Jan 2015 01:30:29 +0100 Received: from rasmus by 102.201.133.37.dynamic.jazztel.es with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Jan 2015 01:30:29 +0100 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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, Consider the following example: --8<---------------cut here---------------start------------->8--- (with-temp-buffer (require 'ox-ascii) (insert "- [[http://www.npr.org/blogs/monkeysee/2009/03/a_very_long_url_makes_a_very_s.html][A label with a long link]] :: Lorem ipsum dolor sit amet, consectetur adipiscing elit\n") (org-ascii-export-as-ascii nil nil nil t)) --8<---------------cut here---------------end--------------->8--- With output: --8<---------------cut here---------------start------------->8--- [A label with a long link]: Lorem ipsum dolor sit amet, consectetur adipiscing elit [A label with a long link] http://www.npr.org/blogs/monkeysee/2009/03/a_very_long_url_makes_a_very_s.html --8<---------------cut here---------------end--------------->8--- The reason for the wrong formatting is that org-ascii--current-text-width takes that there's is like -28 characters left for lorem ipsum... It does that because it counts link and label. The patch fixes this by only counting the length of the label. I'm not really familiar with the ascii backend, so let me know if there's any obvious deficits that I have overlooked. Otherwise I push it. —Rasmus -- Evidence suggests Snowden used a powerful tool called monospaced fonts --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ox-ascii.el-Bug-in-description-list-formatting.patch >From 7b6a8730de6f5ec57f5d45af57c3c9f90f389fef Mon Sep 17 00:00:00 2001 From: Rasmus Date: Wed, 28 Jan 2015 01:10:56 +0100 Subject: [PATCH] ox-ascii.el: Bug in description-list formatting * ox-ascii.el (org-ascii--current-text-width): Consider length of label for links. --- lisp/ox-ascii.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index e294fab..cd239f9 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -624,8 +624,11 @@ INFO is a plist used as a communication channel." (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))))))))))))) + (let ((tag (or (org-list-get-tag beg-item struct) + (org-list-get-bullet beg-item struct)))) + (if (string-match org-bracket-link-analytic-regexp tag) + (match-string 4 tag) + tag))))))))))))) (defun org-ascii--current-justification (element) "Return expected justification for ELEMENT's contents. -- 2.2.2 --=-=-=--