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'.
This commit is contained in:
Carsten Dominik 2010-10-18 14:23:38 +02:00
parent 7335254531
commit c5a8bc9db4
6 changed files with 27 additions and 6 deletions

View File

@ -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

View File

@ -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"))

View File

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

View File

@ -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"]"))

View File

@ -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

View File

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