emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ox-html, top-row-p
@ 2015-12-12 23:36 Fabrice Popineau
  2015-12-13  9:31 ` Fabrice Popineau
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2015-12-12 23:36 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

Hi,

I get an error in ox-html.el with the latest org-mode when exporting tables
to html :

Debugger entered--Lisp error: (void-variable top-row-p)
  (cond (top-row-p "<tr class=\"tr-top\">") (bottom-row-p "<tr
class=\"tr-bottom\">") (t (if (= (mod row-number 2) 1) "<tr
class=\"tr-odd\">" "<tr class=\"tr-even\">")))
  eval((cond (top-row-p "<tr class=\"tr-top\">") (bottom-row-p "<tr
class=\"tr-bottom\">") (t (if (= (mod row-number 2) 1) "<tr
class=\"tr-odd\">" "<tr class=\"tr-even\">"))) t)
  org-html-table-row((table-row (:type standard :begin 1784 :end 1898
:contents-begin 1785 :contents-end 1897 :post-blank 0 :post-affiliated 1784
:parent ...))

Can anybody confirm or is something wrong on my side ?

Greetings,

Fabrice

[-- Attachment #2: Type: text/html, Size: 1127 bytes --]

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

* Re: ox-html, top-row-p
  2015-12-12 23:36 ox-html, top-row-p Fabrice Popineau
@ 2015-12-13  9:31 ` Fabrice Popineau
  2015-12-14 22:49   ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2015-12-13  9:31 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

Hi,

So the problem is due to lexical binding (I am using emacs 25 devel branch).
The following variables can't be dynamically bound anymore in ox-html:
row-number, rowgroup-number, start-rowgroup-p, end-rowgroup-p,
top-row-p, bottom-row-p
.
There are 2 options :
- declare them with defvar
- pass them to eval as an environment.
Here is a patch for the second option, but I wonder if the first one
wouldn't be better.

diff --git a/vendor/org-mode/lisp/ox-html.el
b/vendor/org-mode/lisp/ox-html.el
index 6affac4..4e56ab3 100644
--- a/vendor/org-mode/lisp/ox-html.el
+++ b/vendor/org-mode/lisp/ox-html.el
@@ -3336,10 +3336,22 @@ communication channel."
        ;; Begin a rowgroup?
        (when start-rowgroup-p (car rowgroup-tags))
        ;; Actual table row.
-       (concat "\n" (eval (car (plist-get info :html-table-row-tags)) t)
+       (concat "\n" (eval (car (plist-get info :html-table-row-tags))
+                         `((row-number . ,row-number)
+                           (rowgroup-number . ,rowgroup-number)
+                           (start-rowgroup-p . ,start-rowgroup-p)
+                           (end-rowgroup-p . , end-rowgroup-p)
+                           (top-row-p . ,top-row-p)
+                           (bottom-row-p . ,bottom-row-p)))
               contents
               "\n"
-              (eval (cdr (plist-get info :html-table-row-tags)) t))
+              (eval (cdr (plist-get info :html-table-row-tags))
+                    `((row-number . ,row-number)
+                      (rowgroup-number . ,rowgroup-number)
+                      (start-rowgroup-p . ,start-rowgroup-p)
+                      (end-rowgroup-p . , end-rowgroup-p)
+                      (top-row-p . ,top-row-p)
+                      (bottom-row-p . ,bottom-row-p))))
        ;; End a rowgroup?
        (when end-rowgroup-p (cdr rowgroup-tags))))))

Best regards,

Fabrice

2015-12-13 0:36 GMT+01:00 Fabrice Popineau <fabrice.popineau@gmail.com>:

> Hi,
>
> I get an error in ox-html.el with the latest org-mode when exporting
> tables to html :
>
> Debugger entered--Lisp error: (void-variable top-row-p)
>   (cond (top-row-p "<tr class=\"tr-top\">") (bottom-row-p "<tr
> class=\"tr-bottom\">") (t (if (= (mod row-number 2) 1) "<tr
> class=\"tr-odd\">" "<tr class=\"tr-even\">")))
>   eval((cond (top-row-p "<tr class=\"tr-top\">") (bottom-row-p "<tr
> class=\"tr-bottom\">") (t (if (= (mod row-number 2) 1) "<tr
> class=\"tr-odd\">" "<tr class=\"tr-even\">"))) t)
>   org-html-table-row((table-row (:type standard :begin 1784 :end 1898
> :contents-begin 1785 :contents-end 1897 :post-blank 0 :post-affiliated 1784
> :parent ...))
>
> Can anybody confirm or is something wrong on my side ?
>
> Greetings,
>
> Fabrice
>

[-- Attachment #2: Type: text/html, Size: 4089 bytes --]

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

* Re: ox-html, top-row-p
  2015-12-13  9:31 ` Fabrice Popineau
@ 2015-12-14 22:49   ` Nicolas Goaziou
  2015-12-14 23:05     ` Fabrice Popineau
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-12-14 22:49 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-orgmode@gnu.org

Hello,

Fabrice Popineau <fabrice.popineau@gmail.com> writes:

> So the problem is due to lexical binding (I am using emacs 25 devel branch).
> The following variables can't be dynamically bound anymore in ox-html:
> row-number, rowgroup-number, start-rowgroup-p, end-rowgroup-p,
> top-row-p, bottom-row-p
> .
> There are 2 options :
> - declare them with defvar
> - pass them to eval as an environment.
> Here is a patch for the second option, but I wonder if the first one
> wouldn't be better.

Another option would be to remove that ugly `eval' hack altogether, and
instead use a function returning a string, called with 6 arguments (or
with 3 arguments: row-number, rowgroup-number, and list of symbols among
`top', `bottom', `start' and `end').

WDYT?

-- 
Nicolas Goaziou

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

* Re: ox-html, top-row-p
  2015-12-14 22:49   ` Nicolas Goaziou
@ 2015-12-14 23:05     ` Fabrice Popineau
  2015-12-14 23:20       ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2015-12-14 23:05 UTC (permalink / raw)
  To: Fabrice Popineau, emacs-orgmode@gnu.org

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

2015-12-14 23:49 GMT+01:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Hello,
>
> Fabrice Popineau <fabrice.popineau@gmail.com> writes:
>
> > So the problem is due to lexical binding (I am using emacs 25 devel
> branch).
> > The following variables can't be dynamically bound anymore in ox-html:
> > row-number, rowgroup-number, start-rowgroup-p, end-rowgroup-p,
> > top-row-p, bottom-row-p
> > .
> > There are 2 options :
> > - declare them with defvar
> > - pass them to eval as an environment.
> > Here is a patch for the second option, but I wonder if the first one
> > wouldn't be better.
>
> Another option would be to remove that ugly `eval' hack altogether, and
> instead use a function returning a string, called with 6 arguments (or
> with 3 arguments: row-number, rowgroup-number, and list of symbols among
> `top', `bottom', `start' and `end').
>
> WDYT?
>

I am not fond of eval at all, at least not in this specific case.
So yes, your way is at least as good as what I did.

Fabrice

[-- Attachment #2: Type: text/html, Size: 1565 bytes --]

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

* Re: ox-html, top-row-p
  2015-12-14 23:05     ` Fabrice Popineau
@ 2015-12-14 23:20       ` Nicolas Goaziou
  2015-12-15 22:34         ` Fabrice Popineau
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-12-14 23:20 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-orgmode@gnu.org

Fabrice Popineau <fabrice.popineau@gmail.com> writes:

> I am not fond of eval at all, at least not in this specific case.
> So yes, your way is at least as good as what I did.

Fine. Would you want to provide a patch along these lines? It may
require an entry in ORG-NEWS.

-- 
Nicolas

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

* Re: ox-html, top-row-p
  2015-12-14 23:20       ` Nicolas Goaziou
@ 2015-12-15 22:34         ` Fabrice Popineau
  0 siblings, 0 replies; 6+ messages in thread
From: Fabrice Popineau @ 2015-12-15 22:34 UTC (permalink / raw)
  To: Fabrice Popineau, emacs-orgmode@gnu.org

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

2015-12-15 0:20 GMT+01:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Fabrice Popineau <fabrice.popineau@gmail.com> writes:
>
> > I am not fond of eval at all, at least not in this specific case.
> > So yes, your way is at least as good as what I did.
>
> Fine. Would you want to provide a patch along these lines? It may
> require an entry in ORG-NEWS.
>
>
I'll do it but some more urgent things to do right now.

Fabrice

[-- Attachment #2: Type: text/html, Size: 953 bytes --]

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

end of thread, other threads:[~2015-12-15 22:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-12 23:36 ox-html, top-row-p Fabrice Popineau
2015-12-13  9:31 ` Fabrice Popineau
2015-12-14 22:49   ` Nicolas Goaziou
2015-12-14 23:05     ` Fabrice Popineau
2015-12-14 23:20       ` Nicolas Goaziou
2015-12-15 22:34         ` Fabrice Popineau

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