emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* A weird warning and a test (eager macro expansion) error
@ 2013-11-05  7:31 Bastien
  2013-11-05 19:33 ` Achim Gratz
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2013-11-05  7:31 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I've got this warning when compiling:

,----
| Compiling /home/guerry/install/git/org-mode/lisp/ob-R.el...
| 
| In end of data:
| ob-R.el:401:1:Warning: the function `org-every' is not known to be defined.
`----

(There is no org-every in ob-R.el directly.)

And ~$ make test fails like this:

,----
| 21 src blocks added to Library of Babel
| Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob-maxima.el (source)...
| Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob-octave.el (source)...
| Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob-perl.el (source)...
| Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob-python.el (source)...
| Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob-ruby.el (source)...
| Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob-sh.el (source)...
| Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob-table.el (source)...
| Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob-tangle.el (source)...
| Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob.el (source)...
| Eager macro-expansion failure: (void-variable test-line)
| Symbol's value as variable is void: test-line
| mk/targets.mk:99: recipe for target 'test' failed
| make: *** [test] Error 255
`----

This is with latest Org and Emacs 24.3.50.1, as compiled from trunk
yesterday.

I don't have time to look into this right now, but maybe someone has.

Thanks,

-- 
 Bastien

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

* Re: A weird warning and a test (eager macro expansion) error
  2013-11-05  7:31 A weird warning and a test (eager macro expansion) error Bastien
@ 2013-11-05 19:33 ` Achim Gratz
  2013-11-05 20:59   ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Achim Gratz @ 2013-11-05 19:33 UTC (permalink / raw)
  To: emacs-orgmode

Bastien writes:
> | Loading /home/guerry/install/git/org-mode/testing/lisp/test-ob.el (source)...
> | Eager macro-expansion failure: (void-variable test-line)
> | Symbol's value as variable is void: test-line
> | mk/targets.mk:99: recipe for target 'test' failed
> | make: *** [test] Error 255
> `----
>
> This is with latest Org and Emacs 24.3.50.1, as compiled from trunk
> yesterday.

This is caused by the following constructs in test-ob.el:

--8<---------------cut here---------------start------------->8---
(ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-1 ()
  (let ((test-line "src_sh{echo 1}"))
    ;; src_ at bol line 1...
    (org-test-with-temp-text
	test-line
--8<---------------cut here---------------end--------------->8---

ert-deftest is a macro and when it gets expanded the let binding is not
yet established, thus the expansion of test-line fails further down in
the body.  I'm not sure if this is supposed to work or not.  The older
Emacsen just didn't expand the macro at all so the body was interpreted
at runtime, Stefan Monnier made this an error a while back in trunk,
IIRC.  You might ask on emacs-devel for more details.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables

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

* Re: A weird warning and a test (eager macro expansion) error
  2013-11-05 19:33 ` Achim Gratz
@ 2013-11-05 20:59   ` Bastien
  2013-11-12 21:50     ` Achim Gratz
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2013-11-05 20:59 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Hi Achim,

Achim Gratz <Stromeko@nexgo.de> writes:

> This is caused by the following constructs in test-ob.el:
>
> (ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-1 ()
>   (let ((test-line "src_sh{echo 1}"))
>     ;; src_ at bol line 1...
>     (org-test-with-temp-text
> 	test-line
>
> ert-deftest is a macro and when it gets expanded the let binding is not
> yet established, thus the expansion of test-line fails further down in
> the body.  I'm not sure if this is supposed to work or not.  The older
> Emacsen just didn't expand the macro at all so the body was interpreted
> at runtime, Stefan Monnier made this an error a while back in trunk,
> IIRC.  You might ask on emacs-devel for more details.

Thanks -- I remember we had this issue before.  I'm just surprise I'm
the first one to report it, I assume many people use a recent Emacs
with macro expansion done this way.

Can you ask this on emacs-devel and see what could be done?

Or someone else that grok the issue well?

-- 
 Bastien

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

* Re: A weird warning and a test (eager macro expansion) error
  2013-11-05 20:59   ` Bastien
@ 2013-11-12 21:50     ` Achim Gratz
  2013-11-13  8:58       ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Achim Gratz @ 2013-11-12 21:50 UTC (permalink / raw)
  To: emacs-orgmode

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

[resent]

Bastien writes:
> Thanks -- I remember we had this issue before.  I'm just surprise I'm
> the first one to report it, I assume many people use a recent Emacs
> with macro expansion done this way.

This patch fixes the error, but it looks strange (indentation is still
unchanged for clarity).  Not sure if this an Ert or Emacs error, though.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-testing-fix-eager-macro-expansion-failures-on-Emacs-.patch --]
[-- Type: text/x-patch, Size: 9764 bytes --]

From e123a7c180f5390a8658e0f352e05d85aca3627c Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Tue, 12 Nov 2013 22:01:41 +0100
Subject: [PATCH] testing: fix eager macro expansion failures on Emacs trunk

* testing/lisp/test-ob.el, testing/lisp/test-org-table.el: Quote
  deftest body forms starting with a let clause.

This may actually constitute a bug in Emacs or Ert.
---
 testing/lisp/test-ob.el        | 36 ++++++++++++++++++------------------
 testing/lisp/test-org-table.el | 16 ++++++++--------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index e7f0645..ac409a4 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -41,7 +41,7 @@
 	 "   \t #+headers : blah1 blah2 blah3 \t\n\t\n blah4 blah5 blah6 \n"))))
 
 (ert-deftest test-org-babel/src-block-regexp ()
-  (let ((test-block
+  `(let ((test-block
 	 (concat
 	  "#+begin_src language -n-r-a-b -c :argument-1 yes :argument-2 no\n"
 	  "echo this is a test\n"
@@ -103,7 +103,7 @@
 	  org-babel-default-inline-header-args)))
 
 (ert-deftest ob-test/org-babel-combine-header-arg-lists ()
-  (let ((results (org-babel-combine-header-arg-lists
+  `(let ((results (org-babel-combine-header-arg-lists
                   '((foo  . :any)
                     (bar)
                     (baz  . ((foo bar) (baz)))
@@ -280,7 +280,7 @@
       (should-not (org-babel-get-inline-src-block-matches)))))
 
 (ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-1 ()
-  (let ((test-line "src_sh{echo 1}"))
+  `(let ((test-line "src_sh{echo 1}"))
     ;; src_ at bol line 1...
     (org-test-with-temp-text
 	test-line
@@ -300,7 +300,7 @@
        	       (concat test-line " =1= =1= =1=")
        	       (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
     ;; src_ follows space line 1...
-    (let ((test-line " src_emacs-lisp{ 1 }"))
+    `(let ((test-line " src_emacs-lisp{ 1 }"))
       (org-test-with-temp-text
 	  test-line
 	(should-error (org-ctrl-c-ctrl-c))
@@ -317,7 +317,7 @@
 
 (ert-deftest test-org-babel/inline-src_blk-default-results-replace-line-2 ()
   ;; src_ at bol line 2...
-  (let ((test-line " src_emacs-lisp{ \"x\" }"))
+  `(let ((test-line " src_emacs-lisp{ \"x\" }"))
     (org-test-with-temp-text
 	(concat "\n" test-line)
       (should-error (org-ctrl-c-ctrl-c))
@@ -331,7 +331,7 @@
 	       (buffer-substring-no-properties
 		(point-at-bol) (point-at-eol))))))
 
-  (let ((test-line "Some text prior to block src_emacs-lisp{ \"y\" }"))
+  `(let ((test-line "Some text prior to block src_emacs-lisp{ \"y\" }"))
     (org-test-with-temp-text
 	test-line
       (goto-char (point-max))
@@ -348,7 +348,7 @@
       (should-error (org-ctrl-c-ctrl-c)))))
 
 (ert-deftest test-org-babel/inline-src_blk-manual-results-replace ()
-  (let ((test-line " src_emacs-lisp[:results replace]{ \"x\" }"))
+  `(let ((test-line " src_emacs-lisp[:results replace]{ \"x\" }"))
     (org-test-with-temp-text
 	(concat "\n" test-line)
       (should-error (org-ctrl-c-ctrl-c))
@@ -362,7 +362,7 @@
       	       (buffer-substring-no-properties
 		(point-at-bol) (point-at-eol))))))
 
-  (let ((test-line (concat " Some text prior to block "
+  `(let ((test-line (concat " Some text prior to block "
 			   "src_emacs-lisp[:results replace]{ \"y\" }")))
     (org-test-with-temp-text test-line
       (goto-char (point-max))
@@ -379,7 +379,7 @@
       (should-error (org-ctrl-c-ctrl-c)))))
 
 (ert-deftest test-org-babel/inline-src_blk-results-silent ()
-  (let ((test-line "src_emacs-lisp[ :results silent ]{ \"x\" }"))
+  `(let ((test-line "src_emacs-lisp[ :results silent ]{ \"x\" }"))
     (org-test-with-temp-text test-line
       (org-ctrl-c-ctrl-c)
       (should (string= test-line
@@ -387,7 +387,7 @@
 			(point-at-bol) (point-at-eol))))
       (end-of-buffer)
       (should-error (org-ctrl-c-ctrl-c))))
-  (let ((test-line (concat " Some text prior to block src_emacs-lisp"
+  `(let ((test-line (concat " Some text prior to block src_emacs-lisp"
 			   "[ :results silent ]{ \"y\" }")))
     (org-test-with-temp-text
 	test-line
@@ -405,12 +405,12 @@
       (should-error (org-ctrl-c-ctrl-c)))))
 
 (ert-deftest test-org-babel/inline-src_blk-results-raw ()
-  (let ((test-line "src_emacs-lisp[ :results raw ]{ \"x\" }"))
+  `(let ((test-line "src_emacs-lisp[ :results raw ]{ \"x\" }"))
     (org-test-with-temp-text test-line
       (org-ctrl-c-ctrl-c)
       (should (string= (concat test-line " x")
 		       (buffer-string)))))
-  (let ((test-line (concat " Some text prior to block "
+  `(let ((test-line (concat " Some text prior to block "
 			   "src_emacs-lisp[ :results raw ]{ \"the\" }")))
     (org-test-with-temp-text (concat test-line " end")
       (re-search-forward "src_") (org-ctrl-c-ctrl-c)
@@ -425,7 +425,7 @@
       (should-error (org-ctrl-c-ctrl-c)))))
 
 (ert-deftest test-org-babel/inline-src_blk-results-file ()
-  (let ((test-line "src_emacs-lisp[ :results file ]{ \"~/test-file\"  }"))
+  `(let ((test-line "src_emacs-lisp[ :results file ]{ \"~/test-file\"  }"))
     (org-test-with-temp-text
 	test-line
       (org-ctrl-c-ctrl-c)
@@ -434,7 +434,7 @@
 			(point-min) (point-max)))))))
 
 (ert-deftest test-org-babel/inline-src_blk-results-scalar ()
-  (let ((test-line "src_emacs-lisp[ :results scalar ]{ \"x\"  }"))
+  `(let ((test-line "src_emacs-lisp[ :results scalar ]{ \"x\"  }"))
     (org-test-with-temp-text
 	test-line
       (org-ctrl-c-ctrl-c)
@@ -443,7 +443,7 @@
 			(point-min) (point-max)))))))
 
 (ert-deftest test-org-babel/inline-src_blk-results-verbatim ()
-  (let ((test-line "src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+  `(let ((test-line "src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
     (org-test-with-temp-text
 	test-line
       (org-ctrl-c-ctrl-c)
@@ -628,7 +628,7 @@
       (should (looking-at ": 2")))))
 
 (ert-deftest test-ob/eval-header-argument ()
-  (flet ((check-eval (eval runp)
+  `(flet ((check-eval (eval runp)
 		     (org-test-with-temp-text (format "#+begin_src emacs-lisp :eval %s
   (setq foo :evald)
 #+end_src" eval)
@@ -828,7 +828,7 @@ (defun test-ob-verify-result-and-removed-result (result buffer-text)
 * next heading"))
 
 (ert-deftest test-org-babel/inline-src_blk-preceded-punct-preceded-by-point ()
-  (let ((test-line ".src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+  `(let ((test-line ".src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
     (org-test-with-temp-text
 	test-line
       (forward-char 1)
@@ -1183,7 +1183,7 @@ (defun test-ob-verify-result-and-removed-result (result buffer-text)
 
 (ert-deftest test-ob/safe-header-args ()
   "Detect safe and unsafe header args."
-  (let ((safe-args '((:cache . "foo")
+  `(let ((safe-args '((:cache . "foo")
 		     (:results . "output")
 		     (:eval . "never")
 		     (:eval . "query")))
diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el
index e78e56b..19cef8d 100644
--- a/testing/lisp/test-org-table.el
+++ b/testing/lisp/test-org-table.el
@@ -231,7 +231,7 @@ (defconst references/target-special "
   "Basic: Assign field reference, sum of field references, sum
 and len of simple range reference (no row) and complex range
 reference (with row).  Mode string E."
-  (let ((lisp
+  `(let ((lisp
 	 (concat
 	  "#+TBLFM: $3 = '(identity $1); E :: $4 = '(+ $1 $2); E :: "
 	  "$5 = '(+ $1..$2); E :: $6 = '(+ @0$1..@0$2); E :: "
@@ -274,7 +274,7 @@ (defconst references/target-special "
   "Basic: Assign field reference, sum of field references, sum
 and len of simple range reference (no row) and complex range
 reference (with row).  Mode string EN."
-  (let ((lisp (concat
+  `(let ((lisp (concat
 	       "#+TBLFM: $3 = '(identity $1); EN :: $4 = '(+ $1 $2); EN :: "
 	       "$5 = '(+ $1..$2); EN :: $6 = '(+ @0$1..@0$2); EN :: "
 	       "$7 = '(length '($1..$2)); EN :: "
@@ -324,7 +324,7 @@ (defconst references/target-special "
   "Basic: Assign field reference, sum of field references, sum
 and len of simple range reference (no row) and complex range
 reference (with row).  No mode string."
-  (let ((lisp (concat
+  `(let ((lisp (concat
 	       "#+TBLFM: $3 = '(identity $1) :: $4 = '(+ $1 $2) :: "
 	       "$5 = '(+ $1..$2) :: $6 = '(+ @0$1..@0$2) :: "
 	       "$7 = '(length '($1..$2)) :: $8 = '(length '(@0$1..@0$2))"))
@@ -365,7 +365,7 @@ (defconst references/target-special "
   "Basic: Assign field reference, sum of field references, sum
 and len of simple range reference (no row) and complex range
 reference (with row).  Mode string N."
-  (let ((lisp
+  `(let ((lisp
 	 (concat
 	  "#+TBLFM: $3 = '(identity $1); N :: $4 = '(+ $1 $2); N :: "
 	  "$5 = '(+ $1..$2); N :: $6 = '(+ @0$1..@0$2); N :: "
@@ -554,7 +554,7 @@ (defconst references/target-special "
 
 (ert-deftest test-org-table/copy-field ()
   "Experiments on how to copy one field into another field."
-  (let ((target
+  `(let ((target
 	 "
 | 0                | replace |
 | a b              | replace |
@@ -940,7 +940,7 @@ (defconst references/target-special "
 #+TBLFM: $2=$1*2
 #+TBLFM: $2=$1*3
 "
-    (let ((got (progn (goto-char (point-min))
+    `(let ((got (progn (goto-char (point-min))
 		      (forward-line 3)
 		      (org-table-calc-current-TBLFM)
 		      (buffer-string)))
@@ -954,7 +954,7 @@ (defconst references/target-special "
       (should (string= got
 		       expect)))
 
-    (let ((got (progn (goto-char (point-min))
+    `(let ((got (progn (goto-char (point-min))
 		      (forward-line 4)
 		      (org-table-calc-current-TBLFM)
 		      (buffer-string)))
@@ -978,7 +978,7 @@ (defconst references/target-special "
 #+TBLFM: $2=$1*2::$2=$1*2
 #+TBLFM: $2=$1*3
 "
-    (let ((expect "
+    `(let ((expect "
 | 1 | 1 |
 | 2 | 2 |
 #+TBLFM: $2=$1*1
-- 
1.8.4.2


[-- Attachment #3: Type: text/plain, Size: 199 bytes --]



Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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

* Re: A weird warning and a test (eager macro expansion) error
  2013-11-12 21:50     ` Achim Gratz
@ 2013-11-13  8:58       ` Bastien
  2013-11-13 18:19         ` Achim Gratz
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2013-11-13  8:58 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Hi Achim,

Achim Gratz <Stromeko@nexgo.de> writes:

> This patch fixes the error, but it looks strange (indentation is still
> unchanged for clarity).  Not sure if this an Ert or Emacs error, though.

I suggest you handle this the way you prefer: either by committing
this in Org before asking emacs-devel@, or by asking first then see
of this needs to be fixed upstream?  I won't have time to digg this
issue further, sorry.

-- 
 Bastien

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

* Re: A weird warning and a test (eager macro expansion) error
  2013-11-13  8:58       ` Bastien
@ 2013-11-13 18:19         ` Achim Gratz
  2013-11-17 20:57           ` Achim Gratz
  0 siblings, 1 reply; 7+ messages in thread
From: Achim Gratz @ 2013-11-13 18:19 UTC (permalink / raw)
  To: emacs-orgmode

Bastien writes:
> I suggest you handle this the way you prefer: either by committing
> this in Org before asking emacs-devel@, or by asking first then see
> of this needs to be fixed upstream?  I won't have time to digg this
> issue further, sorry.

I'll just keep the patch locally for the moment, at least until I've
looked at Ert and/or made a test case that can be reoprted to
emacs-bugs.  If anybody wants to test on Emacs trunk, it is easy enough
to apply the patch, I think.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra

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

* Re: A weird warning and a test (eager macro expansion) error
  2013-11-13 18:19         ` Achim Gratz
@ 2013-11-17 20:57           ` Achim Gratz
  0 siblings, 0 replies; 7+ messages in thread
From: Achim Gratz @ 2013-11-17 20:57 UTC (permalink / raw)
  To: emacs-orgmode

Achim Gratz writes:
> I'll just keep the patch locally for the moment, at least until I've
> looked at Ert and/or made a test case that can be reoprted to
> emacs-bugs.  If anybody wants to test on Emacs trunk, it is easy enough
> to apply the patch, I think.

This turned out to be a bug in Org after all.  Some test macro
definitions weren't quoted correctly, which generally fails hard with
eager macro expansion as macro expansion and macro execution become
really seperated with it.  Fix has been pushed to master.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

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

end of thread, other threads:[~2013-11-17 20:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-05  7:31 A weird warning and a test (eager macro expansion) error Bastien
2013-11-05 19:33 ` Achim Gratz
2013-11-05 20:59   ` Bastien
2013-11-12 21:50     ` Achim Gratz
2013-11-13  8:58       ` Bastien
2013-11-13 18:19         ` Achim Gratz
2013-11-17 20:57           ` Achim Gratz

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