Hi Bernt,

Bernt Hansen <be...@norang.ca> writes:

> Tangling doesn't work for me in git master anymore.  Git bisect
> identifies the following commit as introducing the problem

Please try the attached patch and let us know if it works.

Thanks,

>From 45c517919756b7af78b720e454e8ea8d969f6a43 Mon Sep 17 00:00:00 2001
From: Bastien Guerry <b...@altern.org>
Date: Sun, 12 Aug 2012 10:41:28 +0200
Subject: [PATCH] org-compat.el: New alias 'org-letrec for 'labels

* org-compat.el: New alias 'org-letrec for 'labels.

* org-bibtex.el (org-compat): Require.
(org-bibtex-headline): Use the `org-letrec' alias.

* ob.el (org-compat): Require.
(org-babel-noweb-p): Use the `org-letrec' alias.
---
 lisp/ob.el         |   12 +++++++-----
 lisp/org-bibtex.el |   42 ++++++++++++++++++++++--------------------
 lisp/org-compat.el |    2 ++
 3 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/lisp/ob.el b/lisp/ob.el
index a6d1359..79f12f7 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -27,6 +27,7 @@
   (require 'cl))
 (require 'ob-eval)
 (require 'org-macs)
+(require 'org-compat)
 
 (defconst org-babel-exeext
   (if (memq system-type '(windows-nt cygwin))
@@ -2223,11 +2224,12 @@ header argument from buffer or subtree wide properties.")
 (defun org-babel-noweb-p (params context)
   "Check if PARAMS require expansion in CONTEXT.
 CONTEXT may be one of :tangle, :export or :eval."
-  (letrec ((intersect (lambda (as bs)
-			(when as
-			  (if (member (car as) bs)
-			      (car as)
-			    (funcall intersect (cdr as) bs))))))
+  (org-letrec
+      ((intersect (lambda (as bs)
+		    (when as
+		      (if (member (car as) bs)
+			  (car as)
+			(funcall intersect (cdr as) bs))))))
     (funcall intersect (case context
 			 (:tangle '("yes" "tangle" "no-export" "strip-export"))
 			 (:eval   '("yes" "no-export" "strip-export" "eval"))
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index 43b3c41..f857459 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -111,6 +111,7 @@
 (require 'bibtex)
 (eval-when-compile
   (require 'cl))
+(require 'org-compat)
 
 (defvar org-bibtex-description nil) ; dynamically scoped from org.el
 (defvar org-id-locations)
@@ -309,26 +310,27 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords` is t."
 
 (defun org-bibtex-headline ()
   "Return a bibtex entry of the given headline as a string."
-  (letrec ((val (lambda (key lst) (cdr (assoc key lst))))
-	   (to (lambda (string) (intern (concat ":" string))))
-	   (from (lambda (key) (substring (symbol-name key) 1)))
-	   (flatten (lambda (&rest lsts)
-		      (apply #'append (mapcar
-				       (lambda (e)
-					 (if (listp e) (apply flatten e) (list e)))
-				       lsts))))
-	   (notes (buffer-string))
-	   (id (org-bibtex-get org-bibtex-key-property))
-	   (type (org-bibtex-get org-bibtex-type-property-name))
-	   (tags (when org-bibtex-tags-are-keywords
-		   (delq nil
-			 (mapcar
-			  (lambda (tag)
-			    (unless (member tag
-					    (append org-bibtex-tags
-						    org-bibtex-no-export-tags))
-			      tag))
-			  (org-get-local-tags-at))))))
+  (org-letrec
+      ((val (lambda (key lst) (cdr (assoc key lst))))
+       (to (lambda (string) (intern (concat ":" string))))
+       (from (lambda (key) (substring (symbol-name key) 1)))
+       (flatten (lambda (&rest lsts)
+		  (apply #'append (mapcar
+				   (lambda (e)
+				     (if (listp e) (apply flatten e) (list e)))
+				   lsts))))
+       (notes (buffer-string))
+       (id (org-bibtex-get org-bibtex-key-property))
+       (type (org-bibtex-get org-bibtex-type-property-name))
+       (tags (when org-bibtex-tags-are-keywords
+	       (delq nil
+		     (mapcar
+		      (lambda (tag)
+			(unless (member tag
+					(append org-bibtex-tags
+						org-bibtex-no-export-tags))
+			  tag))
+		      (org-get-local-tags-at))))))
     (when type
       (let ((entry (format
 		    "@%s{%s,\n%s\n}\n" type id
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index b049ecc..5f410bd 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -110,6 +110,8 @@ any other entries, and any resulting duplicates will be removed entirely."
 	    t))
       t)))
 
+(defalias 'org-letrec (if (>= emacs-major-version 24) 'letrec 'labels)
+
 
 ;;;; Emacs/XEmacs compatibility
 
-- 
1.7.10.2

-- 
 Bastien

Reply via email to