emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Two patches against exporting as ascii
@ 2008-06-13 12:17 Herbert Euler
  2008-06-13 14:02 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Herbert Euler @ 2008-06-13 12:17 UTC (permalink / raw)
  To: emacs-orgmode


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

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

* Re: Two patches against exporting as ascii
  2008-06-13 12:17 Two patches against exporting as ascii Herbert Euler
@ 2008-06-13 14:02 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2008-06-13 14:02 UTC (permalink / raw)
  To: Herbert Euler; +Cc: emacs-orgmode

These are good proposals, I am accepting the patch, thanks.

- Carsten
On Jun 13, 2008, at 2:17 PM, Herbert Euler wrote:

>
> 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
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2008-06-13 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-13 12:17 Two patches against exporting as ascii Herbert Euler
2008-06-13 14:02 ` Carsten Dominik

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