|
@@ -60,11 +60,6 @@
|
|
|
;; their own divs with author-specific ids allowing for css
|
|
|
;; coloring of comments based on the author.
|
|
|
;;
|
|
|
-;; R :: Implements Sweave type exporting, evaluates blocks of R code,
|
|
|
-;; and also replaces \R{} chunks in the file with their result
|
|
|
-;; when passed to R. This require the `R' command which is
|
|
|
-;; provided by ESS (Emacs Speaks Statistics).
|
|
|
-;;
|
|
|
;;; Adding new blocks
|
|
|
;;
|
|
|
;; When adding a new block type first define a formatting function
|
|
@@ -76,17 +71,11 @@
|
|
|
(require 'cl))
|
|
|
(require 'org)
|
|
|
|
|
|
-(defvar comint-last-input-end)
|
|
|
-(defvar comint-prompt-regexp)
|
|
|
-(defvar comint-last-input-end)
|
|
|
(defvar htmlp)
|
|
|
(defvar latexp)
|
|
|
(defvar docbookp)
|
|
|
(defvar asciip)
|
|
|
|
|
|
-(declare-function comint-send-input "comint" (&optional no-newline artificial))
|
|
|
-(declare-function R "ext:ess" nil)
|
|
|
-
|
|
|
(defun org-export-blocks-set (var value)
|
|
|
"Set the value of `org-export-blocks' and install fontification."
|
|
|
(set var value)
|
|
@@ -102,9 +91,7 @@
|
|
|
(defcustom org-export-blocks
|
|
|
'((comment org-export-blocks-format-comment t)
|
|
|
(ditaa org-export-blocks-format-ditaa nil)
|
|
|
- (dot org-export-blocks-format-dot nil)
|
|
|
- (r org-export-blocks-format-R nil)
|
|
|
- (R org-export-blocks-format-R nil))
|
|
|
+ (dot org-export-blocks-format-dot nil))
|
|
|
"Use this a-list to associate block types with block exporting
|
|
|
functions. The type of a block is determined by the text
|
|
|
immediately following the '#+BEGIN_' portion of the block header.
|
|
@@ -177,34 +164,30 @@ specified in BLOCKS which default to the value of
|
|
|
`org-export-blocks-witheld'."
|
|
|
(interactive)
|
|
|
(save-window-excursion
|
|
|
- (let ((count 0)
|
|
|
- (blocks org-export-blocks-witheld)
|
|
|
- (case-fold-search t)
|
|
|
+ (let ((case-fold-search t)
|
|
|
(types '())
|
|
|
- indentation type func start end)
|
|
|
+ indentation type func start)
|
|
|
(flet ((interblock (start end)
|
|
|
- (save-match-data
|
|
|
- (mapcar (lambda (pair) (funcall (second pair) start end))
|
|
|
- org-export-interblocks))))
|
|
|
+ (mapcar (lambda (pair) (funcall (second pair) start end))
|
|
|
+ org-export-interblocks)))
|
|
|
(goto-char (point-min))
|
|
|
- (setf start (point))
|
|
|
+ (setq start (point))
|
|
|
(while (re-search-forward
|
|
|
"^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]\\([^\000]*?\\)[\r\n][ \t]*#\\+end_\\S-+.*" nil t)
|
|
|
- (save-match-data (setq indentation (length (match-string 1))))
|
|
|
- (save-match-data (setf type (intern (match-string 2))))
|
|
|
- (unless (memq type types) (setf types (cons type types)))
|
|
|
- (setf end (save-match-data (match-beginning 0)))
|
|
|
- (interblock start end)
|
|
|
- (if (setf func (cadr (assoc type org-export-blocks)))
|
|
|
+ (setq indentation (length (match-string 1)))
|
|
|
+ (setq type (intern (match-string 2)))
|
|
|
+ (unless (memq type types) (setq types (cons type types)))
|
|
|
+ (save-match-data (interblock start (match-beginning 0)))
|
|
|
+ (if (setq func (cadr (assoc type org-export-blocks)))
|
|
|
(progn
|
|
|
(replace-match (save-match-data
|
|
|
- (if (memq type blocks)
|
|
|
+ (if (memq type org-export-blocks-witheld)
|
|
|
""
|
|
|
(apply func (save-match-data (org-remove-indentation (match-string 4)))
|
|
|
(split-string (match-string 3) " ")))) t t)
|
|
|
;; indent block
|
|
|
(indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))
|
|
|
- (setf start (save-match-data (match-end 0))))
|
|
|
+ (setq start (match-end 0)))
|
|
|
(interblock start (point-max))))))
|
|
|
|
|
|
(add-hook 'org-export-preprocess-hook 'org-export-blocks-preprocess)
|