From mboxrd@z Thu Jan 1 00:00:00 1970 From: Herbert Euler Subject: Two patches against exporting as ascii Date: Fri, 13 Jun 2008 20:17:33 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K78Do-0001BY-NM for emacs-orgmode@gnu.org; Fri, 13 Jun 2008 08:17:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K78Dn-0001AA-Az for emacs-orgmode@gnu.org; Fri, 13 Jun 2008 08:17:36 -0400 Received: from [199.232.76.173] (port=44740 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K78Dn-0001A2-0J for emacs-orgmode@gnu.org; Fri, 13 Jun 2008 08:17:35 -0400 Received: from bay0-omc1-s21.bay0.hotmail.com ([65.54.246.93]:10142) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K78Dn-0004ej-40 for emacs-orgmode@gnu.org; Fri, 13 Jun 2008 08:17:35 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Two patches are attached below, to polish some behaviors of exporting as ascii. They are made in GNU Emacs' source tree. The first one fixes the length of toc underline in the exported text. In multibyte context, using `length' makes the underline shorter than the toc name. The second one makes exporting as ascii regard the value of `fill-column'. Since normally the text is filled with M-q, which adjusts the text according to its value, I think replacing the fixed value 80 with `fill-column' can generate more pretty ascii text. Regards, Guanpeng Xu diff -c -r1.4 org-exp.el *** org-exp.el 15 May 2008 03:31:34 -0000 1.4 --- org-exp.el 14 Jun 2008 00:10:47 -0000 *************** *** 1673,1679 **** (if org-export-with-toc (progn (push (concat (nth 3 lang-words) "\n") thetoc) ! (push (concat (make-string (length (nth 3 lang-words)) ?=) "\n") thetoc) (mapc '(lambda (line) (if (string-match org-todo-line-regexp line) --- 1673,1679 ---- (if org-export-with-toc (progn (push (concat (nth 3 lang-words) "\n") thetoc) ! (push (concat (make-string (string-width (nth 3 lang-words)) ?=) "\n") thetoc) (mapc '(lambda (line) (if (string-match org-todo-line-regexp line) *************** *** 1847,1853 **** (defun org-insert-centered (s &optional underline) "Insert the string S centered and underline it with character UNDERLINE." ! (let ((ind (max (/ (- 80 (string-width s)) 2) 0))) (insert (make-string ind ?\ ) s "\n") (if underline (insert (make-string ind ?\ ) --- 1847,1853 ---- (defun org-insert-centered (s &optional underline) "Insert the string S centered and underline it with character UNDERLINE." ! (let ((ind (max (/ (- fill-column (string-width s)) 2) 0))) (insert (make-string ind ?\ ) s "\n") (if underline (insert (make-string ind ?\ ) 2008-06-14 Guanpeng Xu * org/org-exp.el (org-export-as-ascii): Use `string-width' to compute correct width for multibyte strings. (org-insert-centered): Regard the value of `fill-column'. _________________________________________________________________ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx