Browse Source

replace flet/labels with org-flet/org-labels

This patch ensure Org-mode will build on all supported versions of
Emacs, after the renaming of the cl macros behind the cl- prefix in the
recent Emacs trunk.

* lisp/org-compat.el (org-flet): Compatibility function now that flet
  has been removed from cl-macs.
  (org-labels): Compatibility function now that labels has been removed
  from cl-macs.
* lisp/ob-R.el (org-compat): Require org-compat.
* lisp/ob-comint.el: Require org-compat.
* lisp/ob-exp.el (org-babel-exp-do-export): Switch to compatibility
  function.
* lisp/ob-gnuplot.el (org-babel-expand-body:gnuplot): Switch to
  compatibility function.
* lisp/ob-lob.el (org-babel-lob-get-info): Switch to compatibility
  function.
  (org-babel-lob-execute): Switch to compatibility function.
* lisp/ob-python.el (org-babel-python-evaluate-session): Switch to
  compatibility function.
* lisp/ob-ref.el (org-babel-ref-index-list): Switch to compatibility
  function.
* lisp/ob-sh.el (org-babel-sh-var-to-string): Switch to compatibility
  function.
* lisp/ob-tangle.el (org-babel-load-file): Switch to compatibility
  function.
  (org-babel-tangle): Switch to compatibility function.
  (org-babel-spec-to-string): Switch to compatibility function.
* lisp/ob.el (org-babel-view-src-block-info): Switch to compatibility
  function.
  (org-babel-execute-src-block): Switch to compatibility function.
  (org-babel-edit-distance): Switch to compatibility function.
  (org-babel-switch-to-session-with-code): Switch to compatibility
  function.
  (org-babel-sha1-hash): Switch to compatibility function.
  (org-babel-balanced-split): Switch to compatibility function.
  (org-babel-join-splits-near-ch): Switch to compatibility function.
  (org-babel-get-rownames): Switch to compatibility function.
  (org-babel-format-result): Switch to compatibility function.
  (org-babel-insert-result): Switch to compatibility function.
  (org-babel-examplize-region): Switch to compatibility function.
  (org-babel-merge-params): Switch to compatibility function.
  (org-babel-noweb-p): Switch to compatibility function.
  (org-babel-expand-noweb-references): Switch to compatibility function.
* lisp/org-bibtex.el (org-bibtex-headline): Switch to compatibility
  function.
  (org-bibtex-fleshout): Switch to compatibility function.
  (org-bibtex-read): Switch to compatibility function.
  (org-bibtex-write): Switch to compatibility function.
* lisp/org-exp-blocks.el (org-export-blocks-preprocess): Switch to
  compatibility function.
* lisp/org-exp.el (org-export-format-source-code-or-example): Switch to
  compatibility function.
* lisp/org-macs.el (org-called-interactively-p): Indentation fix.
* lisp/org-mouse.el (org-mouse-timestamp-today): Switch to compatibility
  function.
  (org-mouse-set-priority): Switch to compatibility function.
  (org-mouse-popup-global-menu): Switch to compatibility function.
  (org-mouse-context-menu): Switch to compatibility function.
* lisp/org-plot.el (org-plot/gnuplot-to-grid-data): Switch to
  compatibility function.
  (org-plot/gnuplot-script): Switch to compatibility function.
* lisp/org.el (org-entry-get): Switch to compatibility function.
  (org-fill-paragraph): Switch to compatibility function.
  (org-auto-fill-function): Switch to compatibility function.
Eric Schulte 13 years ago
parent
commit
63b5f8f2e8

+ 2 - 1
lisp/ob-awk.el

@@ -33,6 +33,7 @@
 ;;; Code:
 ;;; Code:
 (require 'ob)
 (require 'ob)
 (require 'ob-eval)
 (require 'ob-eval)
+(require 'org-compat)
 (eval-when-compile (require 'cl))
 (eval-when-compile (require 'cl))
 
 
 (declare-function org-babel-ref-resolve "ob-ref" (ref))
 (declare-function org-babel-ref-resolve "ob-ref" (ref))
@@ -96,7 +97,7 @@ called by `org-babel-execute-src-block'"
 
 
 (defun org-babel-awk-var-to-awk (var &optional sep)
 (defun org-babel-awk-var-to-awk (var &optional sep)
   "Return a printed value of VAR suitable for parsing with awk."
   "Return a printed value of VAR suitable for parsing with awk."
-  (flet ((echo-var (v) (if (stringp v) v (format "%S" v))))
+  (org-flet ((echo-var (v) (if (stringp v) v (format "%S" v))))
     (cond
     (cond
      ((and (listp var) (listp (car var)))
      ((and (listp var) (listp (car var)))
       (orgtbl-to-generic var  (list :sep (or sep "\t") :fmt #'echo-var)))
       (orgtbl-to-generic var  (list :sep (or sep "\t") :fmt #'echo-var)))

+ 2 - 1
lisp/ob-comint.el

@@ -31,6 +31,7 @@
 
 
 ;;; Code:
 ;;; Code:
 (require 'ob)
 (require 'ob)
+(require 'org-compat)
 (require 'comint)
 (require 'comint)
 (eval-when-compile (require 'cl))
 (eval-when-compile (require 'cl))
 (declare-function with-parsed-tramp-file-name "tramp" (filename var &rest body))
 (declare-function with-parsed-tramp-file-name "tramp" (filename var &rest body))
@@ -74,7 +75,7 @@ or user `keyboard-quit' during execution of body."
 	(full-body (cadr (cdr (cdr meta)))))
 	(full-body (cadr (cdr (cdr meta)))))
     `(org-babel-comint-in-buffer ,buffer
     `(org-babel-comint-in-buffer ,buffer
        (let ((string-buffer "") dangling-text raw)
        (let ((string-buffer "") dangling-text raw)
-	 (flet ((my-filt (text)
+	 (org-flet ((my-filt (text)
 			 (setq string-buffer (concat string-buffer text))))
 			 (setq string-buffer (concat string-buffer text))))
 	   ;; setup filter
 	   ;; setup filter
 	   (add-hook 'comint-output-filter-functions 'my-filt)
 	   (add-hook 'comint-output-filter-functions 'my-filt)

+ 1 - 1
lisp/ob-exp.el

@@ -219,7 +219,7 @@ org-mode text."
 (defun org-babel-exp-do-export (info type &optional hash)
 (defun org-babel-exp-do-export (info type &optional hash)
   "Return a string with the exported content of a code block.
   "Return a string with the exported content of a code block.
 The function respects the value of the :exports header argument."
 The function respects the value of the :exports header argument."
-  (flet ((silently () (let ((session (cdr (assoc :session (nth 2 info)))))
+  (org-flet ((silently () (let ((session (cdr (assoc :session (nth 2 info)))))
 			(when (not (and session (equal "none" session)))
 			(when (not (and session (equal "none" session)))
 			  (org-babel-exp-results info type 'silent))))
 			  (org-babel-exp-results info type 'silent))))
 	 (clean () (unless (eq type 'inline) (org-babel-remove-result info))))
 	 (clean () (unless (eq type 'inline) (org-babel-remove-result info))))

+ 1 - 1
lisp/ob-gnuplot.el

@@ -88,7 +88,7 @@ code."
            (time-ind (or (plist-get params :timeind)
            (time-ind (or (plist-get params :timeind)
                          (when timefmt 1)))
                          (when timefmt 1)))
            output)
            output)
-      (flet ((add-to-body (text)
+      (org-flet ((add-to-body (text)
                           (setq body (concat text "\n" body))))
                           (setq body (concat text "\n" body))))
         ;; append header argument settings to body
         ;; append header argument settings to body
         (when title (add-to-body (format "set title '%s'" title))) ;; title
         (when title (add-to-body (format "set title '%s'" title))) ;; title

+ 2 - 2
lisp/ob-lob.el

@@ -97,7 +97,7 @@ if so then run the appropriate source block from the Library."
 ;;;###autoload
 ;;;###autoload
 (defun org-babel-lob-get-info ()
 (defun org-babel-lob-get-info ()
   "Return a Library of Babel function call as a string."
   "Return a Library of Babel function call as a string."
-  (flet ((nonempty (a b)
+  (org-flet ((nonempty (a b)
 		   (let ((it (match-string a)))
 		   (let ((it (match-string a)))
 		     (if (= (length it) 0) (match-string b) it))))
 		     (if (= (length it) 0) (match-string b) it))))
     (let ((case-fold-search t))
     (let ((case-fold-search t))
@@ -119,7 +119,7 @@ if so then run the appropriate source block from the Library."
 
 
 (defun org-babel-lob-execute (info)
 (defun org-babel-lob-execute (info)
   "Execute the lob call specified by INFO."
   "Execute the lob call specified by INFO."
-  (flet ((mkinfo (p) (list "emacs-lisp" "results" p nil nil (nth 2 info))))
+  (org-flet ((mkinfo (p) (list "emacs-lisp" "results" p nil nil (nth 2 info))))
     (let* ((pre-params (org-babel-merge-params
     (let* ((pre-params (org-babel-merge-params
 			org-babel-default-header-args
 			org-babel-default-header-args
 			(org-babel-params-from-properties)
 			(org-babel-params-from-properties)

+ 1 - 1
lisp/ob-python.el

@@ -238,7 +238,7 @@ last statement in BODY, as elisp."
 If RESULT-TYPE equals 'output then return standard output as a
 If RESULT-TYPE equals 'output then return standard output as a
 string. If RESULT-TYPE equals 'value then return the value of the
 string. If RESULT-TYPE equals 'value then return the value of the
 last statement in BODY, as elisp."
 last statement in BODY, as elisp."
-  (flet ((send-wait () (comint-send-input nil t) (sleep-for 0 5))
+  (org-flet ((send-wait () (comint-send-input nil t) (sleep-for 0 5))
 	 (dump-last-value
 	 (dump-last-value
 	  (tmp-file pp)
 	  (tmp-file pp)
 	  (mapc
 	  (mapc

+ 1 - 1
lisp/ob-ref.el

@@ -222,7 +222,7 @@ to \"0:-1\"."
 	    (length (length lis))
 	    (length (length lis))
             (portion (match-string 1 index))
             (portion (match-string 1 index))
             (remainder (substring index (match-end 0))))
             (remainder (substring index (match-end 0))))
-        (flet ((wrap (num) (if (< num 0) (+ length num) num))
+        (org-flet ((wrap (num) (if (< num 0) (+ length num) num))
                (open (ls) (if (and (listp ls) (= (length ls) 1)) (car ls) ls)))
                (open (ls) (if (and (listp ls) (= (length ls) 1)) (car ls) ls)))
           (open
           (open
            (mapcar
            (mapcar

+ 1 - 1
lisp/ob-sh.el

@@ -107,7 +107,7 @@ var of the same value."
 
 
 (defun org-babel-sh-var-to-string (var &optional sep)
 (defun org-babel-sh-var-to-string (var &optional sep)
   "Convert an elisp value to a string."
   "Convert an elisp value to a string."
-  (flet ((echo-var (v) (if (stringp v) v (format "%S" v))))
+  (org-flet ((echo-var (v) (if (stringp v) v (format "%S" v))))
     (cond
     (cond
      ((and (listp var) (listp (car var)))
      ((and (listp var) (listp (car var)))
       (orgtbl-to-generic var  (list :sep (or sep "\t") :fmt #'echo-var)))
       (orgtbl-to-generic var  (list :sep (or sep "\t") :fmt #'echo-var)))

+ 3 - 3
lisp/ob-tangle.el

@@ -142,7 +142,7 @@ This function exports the source code using
 `org-babel-tangle' and then loads the resulting file using
 `org-babel-tangle' and then loads the resulting file using
 `load-file'."
 `load-file'."
   (interactive "fFile to load: ")
   (interactive "fFile to load: ")
-  (flet ((age (file)
+  (org-flet ((age (file)
               (float-time
               (float-time
                (time-subtract (current-time)
                (time-subtract (current-time)
                               (nth 5 (or (file-attributes (file-truename file))
                               (nth 5 (or (file-attributes (file-truename file))
@@ -221,7 +221,7 @@ exported source code blocks by language."
                 she-banged)
                 she-banged)
            (mapc
            (mapc
             (lambda (spec)
             (lambda (spec)
-              (flet ((get-spec (name)
+              (org-flet ((get-spec (name)
                                (cdr (assoc name (nth 4 spec)))))
                                (cdr (assoc name (nth 4 spec)))))
                 (let* ((tangle (get-spec :tangle))
                 (let* ((tangle (get-spec :tangle))
                        (she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb))
                        (she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb))
@@ -412,7 +412,7 @@ form
 				       (if (stringp le) le (format "%S" le)))
 				       (if (stringp le) le (format "%S" le)))
 				     (eval el))))
 				     (eval el))))
 			    '(start-line file link source-name))))
 			    '(start-line file link source-name))))
-    (flet ((insert-comment (text)
+    (org-flet ((insert-comment (text)
             (when (and comments (not (string= comments "no"))
             (when (and comments (not (string= comments "no"))
 		       (> (length text) 0))
 		       (> (length text) 0))
 	      (when padline (insert "\n"))
 	      (when padline (insert "\n"))

+ 19 - 19
lisp/ob.el

@@ -340,7 +340,7 @@ This includes header arguments, language and name, and is largely
 a window into the `org-babel-get-src-block-info' function."
 a window into the `org-babel-get-src-block-info' function."
   (interactive)
   (interactive)
   (let ((info (org-babel-get-src-block-info 'light)))
   (let ((info (org-babel-get-src-block-info 'light)))
-    (flet ((full (it) (> (length it) 0))
+    (org-flet ((full (it) (> (length it) 0))
 	   (printf (fmt &rest args) (princ (apply #'format fmt args))))
 	   (printf (fmt &rest args) (princ (apply #'format fmt args))))
       (when info
       (when info
 	(with-help-window (help-buffer)
 	(with-help-window (help-buffer)
@@ -536,9 +536,9 @@ block."
 	     (indent (car (last info)))
 	     (indent (car (last info)))
 	     result cmd)
 	     result cmd)
 	(unwind-protect
 	(unwind-protect
-	    (flet ((call-process-region (&rest args)
+	    (org-flet ((call-process-region (&rest args)
 		    (apply 'org-babel-tramp-handle-call-process-region args)))
 		    (apply 'org-babel-tramp-handle-call-process-region args)))
-	      (flet ((lang-check (f)
+	      (org-flet ((lang-check (f)
 		       (let ((f (intern (concat "org-babel-execute:" f))))
 		       (let ((f (intern (concat "org-babel-execute:" f))))
 			 (when (fboundp f) f))))
 			 (when (fboundp f) f))))
 		(setq cmd
 		(setq cmd
@@ -618,7 +618,7 @@ arguments and pop open the results in a preview buffer."
 	 (l2 (length s2))
 	 (l2 (length s2))
 	 (dist (map 'vector (lambda (_) (make-vector (1+ l2) nil))
 	 (dist (map 'vector (lambda (_) (make-vector (1+ l2) nil))
 		    (number-sequence 1 (1+ l1)))))
 		    (number-sequence 1 (1+ l1)))))
-    (flet ((in (i j) (aref (aref dist i) j))
+    (org-flet ((in (i j) (aref (aref dist i) j))
 	   (mmin (&rest lst) (apply #'min (remove nil lst))))
 	   (mmin (&rest lst) (apply #'min (remove nil lst))))
       (setf (aref (aref dist 0) 0) 0)
       (setf (aref (aref dist 0) 0) 0)
       (dolist (i (number-sequence 1 l1))
       (dolist (i (number-sequence 1 l1))
@@ -789,7 +789,7 @@ with a prefix argument then this is passed on to
 (defun org-babel-switch-to-session-with-code (&optional arg info)
 (defun org-babel-switch-to-session-with-code (&optional arg info)
   "Switch to code buffer and display session."
   "Switch to code buffer and display session."
   (interactive "P")
   (interactive "P")
-  (flet ((swap-windows
+  (org-flet ((swap-windows
 	  ()
 	  ()
 	  (let ((other-window-buffer (window-buffer (next-window))))
 	  (let ((other-window-buffer (window-buffer (next-window))))
 	    (set-window-buffer (next-window) (current-buffer))
 	    (set-window-buffer (next-window) (current-buffer))
@@ -1017,7 +1017,7 @@ the current subtree."
     (setf (nth 2 info)
     (setf (nth 2 info)
 	  (sort (copy-sequence (nth 2 info))
 	  (sort (copy-sequence (nth 2 info))
 		(lambda (a b) (string< (car a) (car b)))))
 		(lambda (a b) (string< (car a) (car b)))))
-    (labels ((rm (lst)
+    (org-labels ((rm (lst)
 		 (dolist (p '("replace" "silent" "append" "prepend"))
 		 (dolist (p '("replace" "silent" "append" "prepend"))
 		   (setq lst (remove p lst)))
 		   (setq lst (remove p lst)))
 		 lst)
 		 lst)
@@ -1264,7 +1264,7 @@ ALTS is a cons of two character options where each option may be
 either the numeric code of a single character or a list of
 either the numeric code of a single character or a list of
 character alternatives.  For example to split on balanced
 character alternatives.  For example to split on balanced
 instances of \"[ \t]:\" set ALTS to '((32 9) . 58)."
 instances of \"[ \t]:\" set ALTS to '((32 9) . 58)."
-  (flet ((matches (ch spec) (if (listp spec) (member ch spec) (equal spec ch)))
+  (org-flet ((matches (ch spec) (if (listp spec) (member ch spec) (equal spec ch)))
 	 (matched (ch last)
 	 (matched (ch last)
 		  (if (consp alts)
 		  (if (consp alts)
 		      (and (matches ch (cdr alts))
 		      (and (matches ch (cdr alts))
@@ -1292,7 +1292,7 @@ instances of \"[ \t]:\" set ALTS to '((32 9) . 58)."
 
 
 (defun org-babel-join-splits-near-ch (ch list)
 (defun org-babel-join-splits-near-ch (ch list)
   "Join splits where \"=\" is on either end of the split."
   "Join splits where \"=\" is on either end of the split."
-  (flet ((last= (str) (= ch (aref str (1- (length str)))))
+  (org-flet ((last= (str) (= ch (aref str (1- (length str)))))
          (first= (str) (= ch (aref str 0))))
          (first= (str) (= ch (aref str 0))))
     (reverse
     (reverse
      (org-reduce (lambda (acc el)
      (org-reduce (lambda (acc el)
@@ -1389,7 +1389,7 @@ names."
 Return a cons cell, the `car' of which contains the TABLE less
 Return a cons cell, the `car' of which contains the TABLE less
 colnames, and the `cdr' of which contains a list of the column
 colnames, and the `cdr' of which contains a list of the column
 names.  Note: this function removes any hlines in TABLE."
 names.  Note: this function removes any hlines in TABLE."
-  (flet ((trans (table) (apply #'mapcar* #'list table)))
+  (org-flet ((trans (table) (apply #'mapcar* #'list table)))
     (let* ((width (apply 'max
     (let* ((width (apply 'max
 			 (mapcar (lambda (el) (if (listp el) (length el) 0)) table)))
 			 (mapcar (lambda (el) (if (listp el) (length el) 0)) table)))
            (table (trans (mapcar (lambda (row)
            (table (trans (mapcar (lambda (row)
@@ -1826,7 +1826,7 @@ If the path of the link is a file path it is expanded using
 
 
 (defun org-babel-format-result (result &optional sep)
 (defun org-babel-format-result (result &optional sep)
   "Format RESULT for writing to file."
   "Format RESULT for writing to file."
-  (flet ((echo-res (result)
+  (org-flet ((echo-res (result)
 		   (if (stringp result) result (format "%S" result))))
 		   (if (stringp result) result (format "%S" result))))
     (if (listp result)
     (if (listp result)
 	;; table result
 	;; table result
@@ -1933,7 +1933,7 @@ code ---- the results are extracted in the syntax of the source
 	   ((member "prepend" result-params)))) ; already there
 	   ((member "prepend" result-params)))) ; already there
 	(setq results-switches
 	(setq results-switches
 	      (if results-switches (concat " " results-switches) ""))
 	      (if results-switches (concat " " results-switches) ""))
-	(flet ((wrap (start finish)
+	(org-flet ((wrap (start finish)
 		     (goto-char end) (insert (concat finish "\n"))
 		     (goto-char end) (insert (concat finish "\n"))
 		     (goto-char beg) (insert (concat start "\n"))
 		     (goto-char beg) (insert (concat start "\n"))
 		     (goto-char end) (goto-char (point-at-eol))
 		     (goto-char end) (goto-char (point-at-eol))
@@ -2058,7 +2058,7 @@ file's directory then expand relative links."
 (defun org-babel-examplize-region (beg end &optional results-switches)
 (defun org-babel-examplize-region (beg end &optional results-switches)
   "Comment out region using the inline '==' or ': ' org example quote."
   "Comment out region using the inline '==' or ': ' org example quote."
   (interactive "*r")
   (interactive "*r")
-  (flet ((chars-between (b e)
+  (org-flet ((chars-between (b e)
 			(not (string-match "^[\\s]*$" (buffer-substring b e))))
 			(not (string-match "^[\\s]*$" (buffer-substring b e))))
 	 (maybe-cap (str) (if org-babel-capitalize-examplize-region-markers
 	 (maybe-cap (str) (if org-babel-capitalize-examplize-region-markers
 			      (upcase str) str)))
 			      (upcase str) str)))
@@ -2106,7 +2106,7 @@ parameters when merging lists."
 		 (cdr (assoc 'exports org-babel-common-header-args-w-values))))
 		 (cdr (assoc 'exports org-babel-common-header-args-w-values))))
 	(variable-index 0)
 	(variable-index 0)
 	params results exports tangle noweb cache vars shebang comments padline)
 	params results exports tangle noweb cache vars shebang comments padline)
-    (flet ((e-merge (exclusive-groups &rest result-params)
+    (org-flet ((e-merge (exclusive-groups &rest result-params)
              ;; maintain exclusivity of mutually exclusive parameters
              ;; maintain exclusivity of mutually exclusive parameters
              (let (output)
              (let (output)
                (mapc (lambda (new-params)
                (mapc (lambda (new-params)
@@ -2218,11 +2218,11 @@ header argument from buffer or subtree wide properties.")
 (defun org-babel-noweb-p (params context)
 (defun org-babel-noweb-p (params context)
   "Check if PARAMS require expansion in CONTEXT.
   "Check if PARAMS require expansion in CONTEXT.
 CONTEXT may be one of :tangle, :export or :eval."
 CONTEXT may be one of :tangle, :export or :eval."
-  (flet ((intersect (as bs)
-		       (when as
-			 (if (member (car as) bs)
-			     (car as)
-			   (intersect (cdr as) bs)))))
+  (org-labels ((intersect (as bs)
+			  (when as
+			    (if (member (car as) bs)
+				(car as)
+			      (intersect (cdr as) bs)))))
     (intersect (case context
     (intersect (case context
                     (:tangle '("yes" "tangle" "no-export" "strip-export"))
                     (:tangle '("yes" "tangle" "no-export" "strip-export"))
                     (:eval   '("yes" "no-export" "strip-export" "eval"))
                     (:eval   '("yes" "no-export" "strip-export" "eval"))
@@ -2267,7 +2267,7 @@ block but are passed literally to the \"example-block\"."
 	 (rx-prefix (concat "\\(" org-babel-src-name-regexp "\\|"
 	 (rx-prefix (concat "\\(" org-babel-src-name-regexp "\\|"
 			    ":noweb-ref[ \t]+" "\\)"))
 			    ":noweb-ref[ \t]+" "\\)"))
          (new-body "") index source-name evaluate prefix blocks-in-buffer)
          (new-body "") index source-name evaluate prefix blocks-in-buffer)
-    (flet ((nb-add (text) (setq new-body (concat new-body text)))
+    (org-flet ((nb-add (text) (setq new-body (concat new-body text)))
 	   (c-wrap (text)
 	   (c-wrap (text)
 		   (with-temp-buffer
 		   (with-temp-buffer
 		     (funcall (intern (concat lang "-mode")))
 		     (funcall (intern (concat lang "-mode")))

+ 4 - 4
lisp/org-bibtex.el

@@ -309,7 +309,7 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords` is t."
 
 
 (defun org-bibtex-headline ()
 (defun org-bibtex-headline ()
   "Return a bibtex entry of the given headline as a string."
   "Return a bibtex entry of the given headline as a string."
-  (flet ((val (key lst) (cdr (assoc key lst)))
+  (org-flet ((val (key lst) (cdr (assoc key lst)))
          (to (string) (intern (concat ":" string)))
          (to (string) (intern (concat ":" string)))
          (from (key) (substring (symbol-name key) 1))
          (from (key) (substring (symbol-name key) 1))
          (flatten (&rest lsts)
          (flatten (&rest lsts)
@@ -406,7 +406,7 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords` is t."
 (defun org-bibtex-fleshout (type &optional optional)
 (defun org-bibtex-fleshout (type &optional optional)
   "Fleshout the current heading, ensuring that all required fields are present.
   "Fleshout the current heading, ensuring that all required fields are present.
 With optional argument OPTIONAL, also prompt for optional fields."
 With optional argument OPTIONAL, also prompt for optional fields."
-  (flet ((val (key lst) (cdr (assoc key lst)))
+  (org-flet ((val (key lst) (cdr (assoc key lst)))
 	 (keyword (name) (intern (concat ":" (downcase name))))
 	 (keyword (name) (intern (concat ":" (downcase name))))
          (name (keyword) (substring (symbol-name keyword) 1)))
          (name (keyword) (substring (symbol-name keyword) 1)))
     (dolist (field (append
     (dolist (field (append
@@ -600,7 +600,7 @@ With a prefix arg, query for optional fields."
   "Read a bibtex entry and save to `org-bibtex-entries'.
   "Read a bibtex entry and save to `org-bibtex-entries'.
 This uses `bibtex-parse-entry'."
 This uses `bibtex-parse-entry'."
   (interactive)
   (interactive)
-  (flet ((keyword (str) (intern (concat ":" (downcase str))))
+  (org-flet ((keyword (str) (intern (concat ":" (downcase str))))
          (clean-space (str) (replace-regexp-in-string
          (clean-space (str) (replace-regexp-in-string
                              "[[:space:]\n\r]+" " " str))
                              "[[:space:]\n\r]+" " " str))
          (strip-delim (str)	     ; strip enclosing "..." and {...}
          (strip-delim (str)	     ; strip enclosing "..." and {...}
@@ -626,7 +626,7 @@ This uses `bibtex-parse-entry'."
     (error "No entries in `org-bibtex-entries'."))
     (error "No entries in `org-bibtex-entries'."))
   (let ((entry (pop org-bibtex-entries))
   (let ((entry (pop org-bibtex-entries))
 	(org-special-properties nil)) ; avoids errors with `org-entry-put'
 	(org-special-properties nil)) ; avoids errors with `org-entry-put'
-    (flet ((val (field) (cdr (assoc field entry)))
+    (org-flet ((val (field) (cdr (assoc field entry)))
 	   (togtag (tag) (org-toggle-tag tag 'on)))
 	   (togtag (tag) (org-toggle-tag tag 'on)))
       (org-insert-heading)
       (org-insert-heading)
       (insert (val :title))
       (insert (val :title))

+ 10 - 0
lisp/org-compat.el

@@ -110,6 +110,16 @@ any other entries, and any resulting duplicates will be removed entirely."
 	    t))
 	    t))
       t)))
       t)))
 
 
+
+;;; cl macros no longer available in the trunk
+(defalias 'org-flet (if (org-version-check "24.1.50" "cl" :predicate)
+			'cl-flet*
+		      'flet))
+
+(defalias 'org-labels (if (org-version-check "24.1.50" "cl" :predicate)
+			  'cl-labels
+			'labels))
+
 ;;;; Emacs/XEmacs compatibility
 ;;;; Emacs/XEmacs compatibility
 
 
 ;; Keys
 ;; Keys

+ 1 - 1
lisp/org-exp-blocks.el

@@ -170,7 +170,7 @@ which defaults to the value of `org-export-blocks-witheld'."
 	  (types '())
 	  (types '())
 	  matched indentation type func
 	  matched indentation type func
 	  start end body headers preserve-indent progress-marker)
 	  start end body headers preserve-indent progress-marker)
-      (flet ((interblock (start end)
+      (org-flet ((interblock (start end)
 			 (mapcar (lambda (pair) (funcall (second pair) start end))
 			 (mapcar (lambda (pair) (funcall (second pair) start end))
 				 org-export-interblocks)))
 				 org-export-interblocks)))
 	(goto-char (point-min))
 	(goto-char (point-min))

+ 1 - 1
lisp/org-exp.el

@@ -2734,7 +2734,7 @@ INDENT was the original indentation of the block."
 	      (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt))
 	      (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt))
 	      (cond
 	      (cond
 	       ((and lang org-export-latex-listings)
 	       ((and lang org-export-latex-listings)
-		(flet ((make-option-string
+		(org-flet ((make-option-string
 			(pair)
 			(pair)
 			(concat (first pair)
 			(concat (first pair)
 				(if (> (length (second pair)) 0)
 				(if (> (length (second pair)) 0)

+ 2 - 1
lisp/org-macs.el

@@ -58,7 +58,8 @@
      (if (or (> emacs-major-version 23)
      (if (or (> emacs-major-version 23)
 	     (and (>= emacs-major-version 23)
 	     (and (>= emacs-major-version 23)
 		  (>= emacs-minor-version 2)))
 		  (>= emacs-minor-version 2)))
-	 `(with-no-warnings (called-interactively-p ,kind)) ;; defined with no argument in <=23.1
+	 ;; defined with no argument in <=23.1
+	 `(with-no-warnings (called-interactively-p ,kind))
        `(interactive-p))))
        `(interactive-p))))
 (def-edebug-spec org-called-interactively-p (&optional ("quote" symbolp)))
 (def-edebug-spec org-called-interactively-p (&optional ("quote" symbolp)))
 
 

+ 4 - 4
lisp/org-mouse.el

@@ -269,7 +269,7 @@ after the current heading."
 
 
 For the acceptable UNITS, see `org-timestamp-change'."
 For the acceptable UNITS, see `org-timestamp-change'."
   (interactive)
   (interactive)
-  (flet ((org-read-date (&rest rest) (current-time)))
+  (org-flet ((org-read-date (&rest rest) (current-time)))
      (org-time-stamp nil))
      (org-time-stamp nil))
   (when shift
   (when shift
     (org-timestamp-change shift units)))
     (org-timestamp-change shift units)))
@@ -375,7 +375,7 @@ nor a function, elements of KEYWORDS are used directly."
 
 
 (defun org-mouse-set-priority (priority)
 (defun org-mouse-set-priority (priority)
   "Set the priority of the current headline to PRIORITY."
   "Set the priority of the current headline to PRIORITY."
-  (flet ((read-char-exclusive () priority))
+  (org-flet ((read-char-exclusive () priority))
     (org-priority)))
     (org-priority)))
 
 
 (defvar org-mouse-priority-regexp "\\[#\\([A-Z]\\)\\]"
 (defvar org-mouse-priority-regexp "\\[#\\([A-Z]\\)\\]"
@@ -532,7 +532,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
      ,@(org-mouse-keyword-menu
      ,@(org-mouse-keyword-menu
 	(mapcar 'car org-agenda-custom-commands)
 	(mapcar 'car org-agenda-custom-commands)
 	#'(lambda (key)
 	#'(lambda (key)
-	   (eval `(flet ((read-char-exclusive () (string-to-char ,key)))
+	   (eval `(org-flet ((read-char-exclusive () (string-to-char ,key)))
 		      (org-agenda nil))))
 		      (org-agenda nil))))
 	nil
 	nil
 	#'(lambda (key)
 	#'(lambda (key)
@@ -625,7 +625,7 @@ This means, between the beginning of line and the point."
 (defun org-mouse-context-menu (&optional event)
 (defun org-mouse-context-menu (&optional event)
   (let ((stamp-prefixes (list org-deadline-string org-scheduled-string))
   (let ((stamp-prefixes (list org-deadline-string org-scheduled-string))
 	(contextlist (org-context)))
 	(contextlist (org-context)))
-    (flet ((get-context (context) (org-mouse-get-context contextlist context)))
+    (org-flet ((get-context (context) (org-mouse-get-context contextlist context)))
   (cond
   (cond
    ((org-mouse-mark-active)
    ((org-mouse-mark-active)
     (let ((region-string (buffer-substring (region-beginning) (region-end))))
     (let ((region-string (buffer-substring (region-beginning) (region-end))))

+ 2 - 2
lisp/org-plot.el

@@ -160,7 +160,7 @@ and dependant variables."
     (with-temp-file data-file
     (with-temp-file data-file
       (let ((num-rows (length table)) (num-cols (length (first table)))
       (let ((num-rows (length table)) (num-cols (length (first table)))
 	    front-edge back-edge)
 	    front-edge back-edge)
-	(flet ((gnuplot-row (col row value)
+	(org-flet ((gnuplot-row (col row value)
 			    (setf col (+ 1 col)) (setf row (+ 1 row))
 			    (setf col (+ 1 col)) (setf row (+ 1 row))
 			    (format "%f  %f  %f\n%f  %f  %f\n"
 			    (format "%f  %f  %f\n%f  %f  %f\n"
 				    col (- row 0.5) value ;; lower edge
 				    col (- row 0.5) value ;; lower edge
@@ -209,7 +209,7 @@ manner suitable for prepending to a user-specified script."
 		     ('3d "splot")
 		     ('3d "splot")
 		     ('grid "splot")))
 		     ('grid "splot")))
 	 (script "reset") plot-lines)
 	 (script "reset") plot-lines)
-    (flet ((add-to-script (line) (setf script (format "%s\n%s" script line))))
+    (org-flet ((add-to-script (line) (setf script (format "%s\n%s" script line))))
       (when file ;; output file
       (when file ;; output file
 	(add-to-script (format "set term %s" (file-name-extension file)))
 	(add-to-script (format "set term %s" (file-name-extension file)))
 	(add-to-script (format "set output '%s'" file)))
 	(add-to-script (format "set output '%s'" file)))

+ 3 - 3
lisp/org.el

@@ -14342,7 +14342,7 @@ when a \"nil\" value can supersede a non-nil value higher up the hierarchy."
 			       (assoc property org-global-properties)
 			       (assoc property org-global-properties)
 			       (assoc property org-global-properties-fixed))))
 			       (assoc property org-global-properties-fixed))))
 	      val)
 	      val)
-	  (flet ((ap (key)
+	  (org-flet ((ap (key)
 		     (when (re-search-forward
 		     (when (re-search-forward
 			    (org-re-property key) (cdr range) t)
 			    (org-re-property key) (cdr range) t)
 		       (setq props
 		       (setq props
@@ -20787,7 +20787,7 @@ the functionality can be provided as a fall-back.")
 		       (throw 'exit nil))))))
 		       (throw 'exit nil))))))
 	     ;; Use `fill-paragraph' with buffer narrowed to item
 	     ;; Use `fill-paragraph' with buffer narrowed to item
 	     ;; without any child, and with our computed PREFIX.
 	     ;; without any child, and with our computed PREFIX.
-	     (flet ((fill-context-prefix (from to &optional flr) prefix))
+	     (org-flet ((fill-context-prefix (from to &optional flr) prefix))
 	       (save-restriction
 	       (save-restriction
 		 (narrow-to-region beg end)
 		 (narrow-to-region beg end)
 		 (save-excursion (fill-paragraph justify)))) t))
 		 (save-excursion (fill-paragraph justify)))) t))
@@ -20858,7 +20858,7 @@ the functionality can be provided as a fall-back.")
       (cond ((setq itemp (org-in-item-p))
       (cond ((setq itemp (org-in-item-p))
 	     (progn
 	     (progn
 	       (setq prefix (make-string (org-list-item-body-column itemp) ?\ ))
 	       (setq prefix (make-string (org-list-item-body-column itemp) ?\ ))
-	       (flet ((fill-context-prefix (from to &optional flr) prefix))
+	       (org-flet ((fill-context-prefix (from to &optional flr) prefix))
 		 (do-auto-fill))))
 		 (do-auto-fill))))
 	    (orgstruct-is-++
 	    (orgstruct-is-++
 	     (org-let org-fb-vars
 	     (org-let org-fb-vars