Forráskód Böngészése

Improve XEmacs compatibility

* lisp/org-compat.el (org-number-sequence): New function.
* lisp/ob-R.el (org-babel-expand-body:R): Use `org-number-sequence'.
* lisp/ob.el (org-babel-where-is-src-block-result): Use `org-number-sequence'.
(org-babel-current-buffer-properties): Fix variable definition.
* lisp/ob-ref.el (org-babel-ref-index-list): Use `org-number-sequence'.
* lisp/ob-latex.el (org-babel-latex-tex-to-pdf): Use the 2-argument version
of `shell-command'.
* lisp/org-latex.el (org-export-as-pdf): Use the 2-argument version
of `shell-command'.
Carsten Dominik 14 éve
szülő
commit
c5a8bc9db4
6 módosított fájl, 27 hozzáadás és 6 törlés
  1. 1 1
      lisp/ob-R.el
  2. 1 1
      lisp/ob-latex.el
  3. 1 1
      lisp/ob-ref.el
  4. 3 2
      lisp/ob.el
  5. 20 0
      lisp/org-compat.el
  6. 1 1
      lisp/org-latex.el

+ 1 - 1
lisp/ob-R.el

@@ -61,7 +61,7 @@
 			 (cdr (nth i (nth 1 processed-params)))
 			 (cdr (nth i (nth 4 processed-params)))
 			 (cdr (nth i (nth 5 processed-params))))))
-		(number-sequence 0 (1- (length (nth 1 processed-params))))))
+		(org-number-sequence 0 (1- (length (nth 1 processed-params))))))
          (out-file (cdr (assoc :file params))))
     (mapconcat ;; define any variables
      #'org-babel-trim

+ 1 - 1
lisp/ob-latex.el

@@ -150,7 +150,7 @@ Extracted from `org-export-as-pdf' in org-latex.el."
 		     (save-match-data
 		       (shell-quote-argument output-dir))
 		     t t cmd)))
-	(shell-command cmd outbuf outbuf)))
+	(shell-command cmd outbuf)))
     (message (concat "Processing LaTeX file " file "...done"))
     (if (not (file-exists-p pdffile))
 	(error (concat "PDF file " pdffile " was not produced"))

+ 1 - 1
lisp/ob-ref.el

@@ -199,7 +199,7 @@ to \"0:-1\"."
             (if (or (= 0 (length portion)) (string-match ind-re portion))
                 (mapcar
 		 (lambda (n) (nth n lis))
-		 (apply 'number-sequence
+		 (apply 'org-number-sequence
 			(if (and (> (length portion) 0) (match-string 2 portion))
 			    (list
 			     (wrap (string-to-number (match-string 2 portion)))

+ 3 - 2
lisp/ob.el

@@ -263,7 +263,8 @@ specific header arguments as well.")
   '((:session . "none") (:results . "silent") (:exports . "results"))
   "Default arguments to use when evaluating an inline source block.")
 
-(defvar org-babel-current-buffer-properties)
+(defvar org-babel-current-buffer-properties nil
+  "Local cache for buffer properties.")
 (make-variable-buffer-local 'org-babel-current-buffer-properties)
 
 (defvar org-babel-result-regexp
@@ -1217,7 +1218,7 @@ following the source block."
 		     (if indent
 			 (mapconcat
 			  (lambda (el) " ")
-			  (number-sequence 1 indent) "")
+			  (org-number-sequence 1 indent) "")
 		       "")
 		     "#+results"
 		     (when hash (concat "["hash"]"))

+ 20 - 0
lisp/org-compat.el

@@ -206,6 +206,26 @@ ignored in this case."
 	 (shrink-window-if-larger-than-buffer window)))
   (or window (selected-window)))
 
+(defun org-number-sequence (from &optional to inc)
+  "Call `number-sequence or emulate it."
+  (if (fboundp 'number-sequence)
+      (number-sequence from to inc)
+    (if (or (not to) (= from to))
+	(list from)
+      (or inc (setq inc 1))
+      (when (zerop inc) (error "The increment can not be zero"))
+      (let (seq (n 0) (next from))
+	(if (> inc 0)
+	    (while (<= next to)
+	      (setq seq (cons next seq)
+		    n (1+ n)
+		    next (+ from (* n inc))))
+	  (while (>= next to)
+	    (setq seq (cons next seq)
+		  n (1+ n)
+		  next (+ from (* n inc)))))
+	(nreverse seq)))))
+
 ;; Region compatibility
 
 (defvar org-ignore-region nil

+ 1 - 1
lisp/org-latex.el

@@ -944,7 +944,7 @@ when PUB-DIR is set, use this as the publishing directory."
 		     (save-match-data
 		       (shell-quote-argument output-dir))
 		     t t cmd)))
-	(shell-command cmd outbuf outbuf)))
+	(shell-command cmd outbuf)))
     (message (concat "Processing LaTeX file " file "...done"))
     (setq errors (org-export-latex-get-error outbuf))
     (if (not (file-exists-p pdffile))