emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Export to ascii fails
@ 2011-01-14 12:36 Valentin Wüstholz
  2011-01-19  9:57 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Valentin Wüstholz @ 2011-01-14 12:36 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

Hi,

I ran into a bug with the ascii export. Exporting the attached org
file to ascii fails (see the attached backtrace). The failure seems to
be related to the 'H:10' option.

I had a look at the code and the following patch seemed to alleviate the issue:

------------------------------ lisp/org-ascii.el ------------------------------
index 99facb1..25cdf12 100644
@@ -637 +637 @@ publishing directory."
-  (let (char (n (- level umax 1)) (ind 0))
+  (let (char (n (- level 1)) (ind 0))
@@ -655 +655 @@ publishing directory."
-      (setq char (nth (- umax level) (reverse org-export-ascii-underline)))
+      (setq char (nth n (reverse org-export-ascii-underline)))

This will however still fail, if (length org-export-ascii-underline) <= n.

Best regards,

Valentin

[-- Attachment #2: bug.org --]
[-- Type: application/octet-stream, Size: 46 bytes --]

#+OPTIONS: H:10


Title


* A

* B


[-- Attachment #3: backtrace --]
[-- Type: application/octet-stream, Size: 5474 bytes --]

Debugger entered--Lisp error: (wrong-type-argument integerp nil)
  make-string(4 nil)
  (insert title "\n" (make-string (string-width title) char) "\n")
  (if (> level umax) (progn (insert ... ... " " title "\n") (catch ... ...) (setq org-ascii-current-indentation ...)) (if (or ... ...) (insert "\n")) (setq char (nth ... ...)) (unless org-export-with-tags (if ... ...)) (if org-export-with-section-numbers (setq title ...)) (insert title "\n" (make-string ... char) "\n") (setq org-ascii-current-indentation (quote ...)))
  (let (char (n ...) (ind 0)) (if (> level umax) (progn ... ... ...) (if ... ...) (setq char ...) (unless org-export-with-tags ...) (if org-export-with-section-numbers ...) (insert title "\n" ... "\n") (setq org-ascii-current-indentation ...)))
  org-ascii-level-start(1 #("A " 0 1 (target "sec-1" fontified t)) 10 ("" #("*  B " 0 1 (fontified t target "sec-2") 3 4 (fontified t target "sec-2")) ""))
  (cond ((string-match "^\\(\\*+\\)[ 	]+\\(.*\\)" line) (setq first-heading-pos ...) (setq level ... txt ...) (org-ascii-level-start level txt umax lines)) ((and org-export-with-tables ...) (if ... ...) (setq table-buffer ...) (when ... ... ...)) (t (if ... ...) (setq line ...) (if ... ...) (if ... ... ...) (insert line "\n")))
  (while (setq line (pop lines)) (when (and link-buffer ...) (org-export-ascii-push-links ...) (setq link-buffer nil)) (setq wrap nil) (setq line (org-html-expand-for-ascii line)) (while (string-match org-bracket-link-analytic-regexp++ line) (setq path ... link ... type ... desc0 ... desc ...) (if ... ... ... ... ...)) (when custom-times (setq line ...)) (cond (... ... ... ...) (... ... ... ...) (t ... ... ... ... ...)))
  (let* ((opt-plist ...) (region-p ...) (rbeg ...) (rend ...) (subtree-p ...) (level-offset ...) (opt-plist ...) (org-current-export-dir ...) (org-current-export-file buffer-file-name) (custom-times org-display-custom-times) (org-ascii-current-indentation ...) (level 0) line txt (umax nil) (umax-toc nil) (case-fold-search nil) (bfname ...) (filename ...) (filename ...) (buffer ...) (org-levels-open ...) (odd org-odd-levels-only) (date ...) (author ...) (title ...) (email ...) (language ...) (quote-re0 ...) (todo nil) (lang-words nil) (region ...) (lines ...) thetoc have-headings first-heading-pos table-open table-buffer link-buffer link type path desc desc0 rpl wrap fnc) (let (...) (org-unmodified ...)) (setq org-min-level (org-get-min-level lines level-offset)) (setq org-last-level org-min-level) (org-init-section-numbers) (setq lang-words (or ... ...)) (set-buffer buffer) (erase-buffer) (fundamental-mode) (org-install-letbind) (mapc (lambda ... ...) org-export-plist-vars) (org-set-local (quote org-odd-levels-only) odd) (setq umax (if arg ... org-export-headline-levels)) (setq umax-toc (if ... ... umax)) (unless body-only (when ... ... ...) (if ... ...) (cond ... ... ...) (if ... ...) (unless ... ...)) (if (and org-export-with-toc ...) (progn ... ... ... ...)) (org-init-section-numbers) (while (setq line ...) (when ... ... ...) (setq wrap nil) (setq line ...) (while ... ... ...) (when custom-times ...) (cond ... ... ...)) (org-export-ascii-push-links (nreverse link-buffer)) (normal-mode) (when thetoc (goto-char ...) (if ... ... ...) (mapc ... thetoc) (or ... ...)) (goto-char (point-min)) (let (beg end) (while ... ... ... ... ...)) (let (beg end) (goto-char ...) (while ... ... ... ... ...) (goto-char ...) (while ... ... ... ...)) (run-hooks (quote org-export-ascii-final-hook)) (or to-buffer (save-buffer)) (goto-char (point-min)) (or (org-export-push-to-kill-ring "ASCII") (message "Exporting... done")) (if (eq to-buffer ...) (prog1 ... ...) (current-buffer)))
  org-export-as-ascii(nil)
  call-interactively(org-export-as-ascii)
  (if (and bg (nth 2 ass) (not ...) (not ...)) (let (...) (set-process-sentinel p ...) (message "Background process \"%s\": started" p)) (if subtree-p (progn ... ...)) (call-interactively (nth 1 ass)) (when (and bpos ...) (let ... ... ... ... ...)))
  (let* ((bg ...) subtree-p (help "[t]   insert the export option template\n[v]   limit export to visible part of outline tree\n[1]   only export the current subtree\n[SPC] publish enclosing subtree (with LaTeX_CLASS or EXPORT_FILE_NAME prop)\n\n[a/n/u] export as ASCII/Latin-1/UTF-8         [A/N/U] to temporary buffer\n\n[h] export as HTML      [H] to temporary buffer   [R] export region\n[b] export as HTML and open in browser\n\n[l] export as LaTeX     [L] to temporary buffer\n[p] export as LaTeX and process to PDF            [d] ... and open PDF file\n\n[D] export as DocBook   [V] export as DocBook, process to PDF, and open\n\n[j] export as TaskJuggler                         [J] ... and open\n\n[m] export as Freemind mind map\n[x] export as XOXO\n[g] export using Wes Hardaker's generic exporter\n\n[i] export current file as iCalendar file\n[I] export all agenda files as iCalendar files   [c] ...as one combined file\n\n[F] publish current file          [P] publish current project\n[X] publish a project...          [E] publish every projects") (cmds ...) r1 r2 ass (cpos ...) (cbuf ...) bpos) (save-excursion (save-window-excursion ... ... ... ... ... ... ...)) (and bpos (goto-char bpos)) (setq r2 (if ... ... r1)) (unless (setq ass ...) (error "No command associated with key %c" r1)) (if (and bg ... ... ...) (let ... ... ...) (if subtree-p ...) (call-interactively ...) (when ... ...)))
  org-export(nil)
  call-interactively(org-export nil nil)

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please 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] 3+ messages in thread

* Re: [BUG] Export to ascii fails
  2011-01-14 12:36 [BUG] Export to ascii fails Valentin Wüstholz
@ 2011-01-19  9:57 ` Carsten Dominik
  2011-01-19 12:02   ` Valentin Wüstholz
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2011-01-19  9:57 UTC (permalink / raw)
  To: Valentin Wüstholz; +Cc: emacs-orgmode

Fixed, thanks.

- Carsten

On Jan 14, 2011, at 1:36 PM, Valentin Wüstholz wrote:

> Hi,
>
> I ran into a bug with the ascii export. Exporting the attached org
> file to ascii fails (see the attached backtrace). The failure seems to
> be related to the 'H:10' option.
>
> I had a look at the code and the following patch seemed to alleviate  
> the issue:
>
> ------------------------------ lisp/org-ascii.el  
> ------------------------------
> index 99facb1..25cdf12 100644
> @@ -637 +637 @@ publishing directory."
> -  (let (char (n (- level umax 1)) (ind 0))
> +  (let (char (n (- level 1)) (ind 0))
> @@ -655 +655 @@ publishing directory."
> -      (setq char (nth (- umax level) (reverse org-export-ascii- 
> underline)))
> +      (setq char (nth n (reverse org-export-ascii-underline)))
>
> This will however still fail, if (length org-export-ascii-underline)  
> <= n.
>
> Best regards,
>
> Valentin
> <bug.org><backtrace>_______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: [BUG] Export to ascii fails
  2011-01-19  9:57 ` Carsten Dominik
@ 2011-01-19 12:02   ` Valentin Wüstholz
  0 siblings, 0 replies; 3+ messages in thread
From: Valentin Wüstholz @ 2011-01-19 12:02 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Thanks! I tried it out and it doesn't quite work yet. The following
change seems to do the trick:

------------------------------ lisp/org-ascii.el ------------------------------
index 01106c3..f9094a1 100644
@@ -655,3 +655,2 @@ publishing directory."
-      (setq char (or (nth (max (- umax level) 0)
-			  (reverse org-export-ascii-underline))
-		     (last org-export-ascii-underline)))	
+      (setq char (or (nth (- level 1) org-export-ascii-underline)
+		     (car (last org-export-ascii-underline))))

Best regards,

Valentin


On Wed, Jan 19, 2011 at 10:57 AM, Carsten Dominik
<carsten.dominik@gmail.com> wrote:
> Fixed, thanks.
>
> - Carsten

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

end of thread, other threads:[~2011-01-19 12:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14 12:36 [BUG] Export to ascii fails Valentin Wüstholz
2011-01-19  9:57 ` Carsten Dominik
2011-01-19 12:02   ` Valentin Wüstholz

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