* [BABEL] html export for R not working, but for sh and others
@ 2010-07-01 8:14 Rainer M Krug
2010-07-01 15:55 ` Eric Schulte
0 siblings, 1 reply; 6+ messages in thread
From: Rainer M Krug @ 2010-07-01 8:14 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 894 bytes --]
Hi
I am trying to export the attached test.org file to HTML, but I can only
export it, when I change the source block language to anything different
from R.
I also attach my emacs.org file, but I am not doing any customisations to R.
In addition: if I specify :session *R* in #:BABEL: , the code is evaluated,
even though I specified :exports code. Is this intended?
Thanks,
Rainer
--
NEW GERMAN FAX NUMBER!!!
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
Cell: +27 - (0)83 9479 042
Fax: +27 - (0)86 516 2782
Fax: +49 - (0)321 2125 2244
email: Rainer@krugs.de
Skype: RMkrug
Google: R.M.Krug@gmail.com
[-- Attachment #1.2: Type: text/html, Size: 1248 bytes --]
[-- Attachment #2: test.org --]
[-- Type: application/octet-stream, Size: 621 bytes --]
#+TITLE: test.org
#+AUTHOR: Rainer M Krug
#+EMAIL: rkrug@ecolmod
#+DATE: 2010-07-01 Thu
#+DESCRIPTION:
#+KEYWORDS:
#+LANGUAGE: en
#+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+LINK_UP:
#+LINK_HOME:
#+XSLT:
#+BABEL: :tangle test.R
* first
#+begin_src ruby
x <- 1:10
y <- runif(10)
print(x)
plot(x,y)
x <- function() {}
#+end_src
[-- Attachment #3: emacs.org --]
[-- Type: application/octet-stream, Size: 20132 bytes --]
#+TITLE: .emacs file
#+OPTIONS: toc:nil num:nil ^:nil
* From Custom
* Save desktop
#+begin_src emacs-lisp
(desktop-save-mode 1)
#+end_src
* Search path definitions
#+begin_src emacs-lisp
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(add-to-list 'load-path "~/.emacs.d/icicles")
(add-to-list 'load-path "~/.emacs.d/ess")
(add-to-list 'load-path "~/.emacs.d/cedet")
(add-to-list 'load-path "~/.emacs.d/ecb")
#+end_src
* CEDET
See cedet/common/cedet.info for configuration details.
#+begin_src emacs-lisp
(load-file "~/.emacs.d/cedet/common/cedet.el")
#+end_src
Optional other options
#+begin_src emacs-lisp
;; Enable EDE (Project Management) features
(global-ede-mode 1)
;; Enable EDE for a pre-existing C++ project
;; (ede-cpp-root-project "NAME" :file "~/myproject/Makefile")
;; Enabling Semantic (code-parsing, smart completion) features
;; Select one of the following:
;; * This enables the database and idle reparse engines
; (semantic-load-enable-minimum-features)
;; * This enables some tools useful for coding, such as summary mode
;; imenu support, and the semantic navigator
; (semantic-load-enable-code-helpers)
;; * This enables even more coding tools such as intellisense mode
;; decoration mode, and stickyfunc mode (plus regular code helpers)
;; (semantic-load-enable-gaudy-code-helpers)
;; * This enables the use of Exuberent ctags if you have it installed.
;; If you use C++ templates or boost, you should NOT enable it.
;; (semantic-load-enable-all-exuberent-ctags-support)
;; Enable SRecode (Template management) minor-mode.
(global-srecode-minor-mode 1)
#+end_src
* Ecb
#+begin_src emacs-lisp
(require 'ecb-autoloads)
(setq ecb-layout-name "left3")
(setq ecb-layout-window-sizes (quote (("left8" (0.23076923076923078 . 0.23333333333333334) (0.23076923076923078 . 0.25) (0.23076923076923078 . 0.2833333333333333) (0.23076923076923078 . 0.21666666666666667)) ("left3" (0.22162162162162163 . 0.10344827586206896) (0.22162162162162163 . 0.46551724137931033) (0.22162162162162163 . 0.41379310344827586)))))
(setq ecb-options-version "2.32")
(setq ecb-toggle-layout-sequence (quote ("left9" "left14" "left3")))
#+end_src
* ESS
** Basic Settings
#+begin_src emacs-lisp
(load "~/.emacs.d/ess/lisp/ess-site")
(require 'ess-site)
(font-lock-add-keywords 'ess-mode
#+end_src
*** Add highlighting for certain keywords
#+begin_src emacs-lisp
'(("\\<\\(FIXME\\|TODO\\|COMMENT\\|DONE\\|CHANGES\\|FIXED\\)\\>" 1 font-lock-warning-face prepend)))
#+end_src
*** Further customisations
#+begin_src emacs-lisp
(setq inferior-R-args "--vanilla")
(setq ess-eval-visibly-p nil)
(setq inferior-ess-same-window t)
(setq inferior-ess-client-command "Initial")
(setq inferior-ess-own-frame nil)
(setq ess-ask-for-ess-directory nil)
#+end_src
*** Make html help in R default
#+begin_src emacs-lisp
(setq inferior-ess-r-help-command "help(\"%s\", help_type=\"html\")\n")
#+end_src
** r-utils
#+begin_src emacs-lisp
(require 'r-utils)
#+end_src
** ess-roxy (might be redundant)
Load ess-roxy from http://www.metabolome.jp/download/ess-roxy
#+begin_src emacs-lisp
;; (add-to-list 'load-path "~/emacs/site-lisp/ess-roxy")
;; (require 'ess-roxy)
;; (add-hook 'ess-mode-hook
;; (lambda () (ess-roxy-mode) ))
#+end_src
* Syntax highlighting for functions in R
based on https://mail.google.com/mail/#label/Lists%2FESS/125131ed24688970
The following code needs to be run in R:
obj <- do.call("c", sapply(c("package:base", "package:stats",
"package:utils"), objects, all.names=TRUE))
re <- "(^[^.[:alpha:][:digit:]]|<-|__)" # to remove "weird" functions
obj <- obj[-grep(re, obj)]
fpath <- file.path(Sys.getenv("HOME"), ".emacs.d", "R-function-names.txt")
write.table(obj, fpath, quote=FALSE, row.names=FALSE, col.names=FALSE)
Read a whole file into list of lines
Author: Xah Lee
see http://xahlee.org/emacs/elisp_process_lines.html
#+begin_src emacs-lisp
(defun read-lines (file)
"Return a list of lines in FILE."
(with-temp-buffer
(insert-file-contents file)
(split-string
(buffer-string) "\n" t)
)
)
(add-hook 'ess-mode-hook
'(lambda()
(setq ess-my-extra-R-function-keywords
(read-lines "~/.emacs.d/R-function-names.txt"))
(setq ess-R-mode-font-lock-keywords
(append ess-R-mode-font-lock-keywords
(list (cons (concat "\\<" (regexp-opt
ess-my-extra-R-function-keywords 'enc-paren) "\\>")
'font-lock-function-name-face))))))
#+end_src
* hideshow for ESS
#+begin_src emacs-lisp
(autoload 'hideshowvis-enable "hideshowvis" "Highlight foldable regions")
(dolist (hook (list 'emacs-lisp-mode-hook
'ess-mode-hook))
(add-hook hook 'hideshowvis-enable))
(setq hs-special-modes-alist
(cons '(ess-mode "{" "}" "#" nil nil) hs-special-modes-alist))
(define-fringe-bitmap 'hs-marker [0 24 24 126 126 24 24 0])
(defcustom hs-fringe-face 'hs-fringe-face
"*Specify face used to highlight the fringe on hidden regions."
:type 'face
:group 'hideshow)
(defface hs-fringe-face
'((t (:foreground "#888" :box (:line-width 2 :color "grey75" :style released-button))))
"Face used to highlight the fringe on folded regions"
:group 'hideshow)
(defcustom hs-face 'hs-face
"*Specify the face to to use for the hidden region indicator"
:type 'face
:group 'hideshow)
(defface hs-face
'((t (:background "#ff8" :box t)))
"Face to hightlight the ... area of hidden regions"
:group 'hideshow)
(defun display-code-line-counts (ov)
(when (eq 'code (overlay-get ov 'hs))
(let* ((marker-string "*fringe-dummy*")
(marker-length (length marker-string))
(display-string (format "(%d)..." (count-lines (overlay-start ov) (overlay-end ov))))
)
(overlay-put ov 'help-echo "Hiddent text. C-c,= to show")
(put-text-property 0 marker-length 'display (list 'left-fringe 'hs-marker 'hs-fringe-face) marker-string)
(overlay-put ov 'before-string marker-string)
(put-text-property 0 (length display-string) 'face 'hs-face display-string)
(overlay-put ov 'display display-string)
)))
(setq hs-set-up-overlay 'display-code-line-counts)
#+end_src
* hideshow
hideshow-org (http://github.com/secelis/hideshow-org/tree/master)
#+begin_src emacs-lisp
(require 'hideshow)
(require 'hideshow-org)
(add-to-list 'hs-special-modes-alist
'(ess-mode "{" "}" "/[*/]" nil
hs-c-like-adjust-block-beginning))
(global-set-key "\C-ch" 'hs-org/minor-mode) ;; toggles hideshow-org
;; (add-hook 'ess-mode-hook 'hs-org/minor-mode) ;; starts for ESS files
(add-hook 'ess-mode-hook '(lambda () (hs-org/minor-mode 1)))
#+end_src
* Graphviz (disabled)
Load graphviz-dot-mode
#+begin_src emacs-lisp
;; (load-file "~/emacs/graphviz-dot-mode.el")
;; (setq graphviz-dot-view-command "display %s")
#+end_src
* SSH Major mode
#+begin_src emacs-lisp
(load-file "/home/rkrug/.emacs.d/site-lisp/ssh.el")
#+end_src
* Bookmark (bm)
#+begin_src emacs-lisp
;; (setq bm-restore-repository-on-load t)
;; (require 'bm)
;; (global-set-key (kbd "<f2>") 'bm-toggle)
;; (global-set-key (kbd "<C-f2>") 'bm-next)
;; (global-set-key (kbd "<s-f2>") 'bm-previous)
;; ;; make bookmarks persistent as default
;; (setq-default bm-buffer-persistence t)
;; ;; Loading the repository from file when on start up.
;; (add-hook' after-init-hook 'bm-repository-load)
;; ;; Restoring bookmarks when on file find.
;; (add-hook 'find-file-hooks 'bm-buffer-restore)
;; ;; Saving bookmark data on killing a buffer
;; (add-hook 'kill-buffer-hook 'bm-buffer-save)
;; ;; Saving the repository to file when on exit.
;; ;; kill-buffer-hook is not called when emacs is killed, so we
;; ;; must save all bookmarks first.
;; (add-hook 'kill-emacs-hook '(lambda nil
;; (bm-buffer-save-all)
;; (bm-repository-save)))
#+end_src
* anything
#+begin_src emacs-lisp
(require 'anything)
(require 'anything-config)
(require 'recentf)
(global-set-key [f11] 'anything)
(remove-hook 'kill-emacs-hook 'anything-c-adaptive-save-history)
#+end_src
** R objects
#+begin_src emacs-lisp
(setq anything-c-source-R-help
'((name . "R objects / help")
(init . (lambda ()
; this grabs the process name associated with the buffer
(setq anything-c-ess-local-process-name ess-local-process-name)))
(candidates . (lambda ()
(condition-case nil
(ess-get-object-list anything-c-ess-local-process-name)
(error nil))))
(action
("help" . ess-display-help-on-object)
("head (10)" . (lambda(obj-name)
(ess-execute (concat "head(" obj-name ", n = 10)\n") nil (concat "R head: " obj-name))))
("head (100)" . (lambda(obj-name)
(ess-execute (concat "head(" obj-name ", n = 100)\n") nil (concat "R head: " obj-name))))
("tail" . (lambda(obj-name)
(ess-execute (concat "tail(" obj-name ", n = 10)\n") nil (concat "R tail: " obj-name))))
("str" . (lambda(obj-name)
(ess-execute (concat "str(" obj-name ")\n") nil (concat "R str: " obj-name))))
("summary" . (lambda(obj-name)
(ess-execute (concat "summary(" obj-name ")\n") nil (concat "R summary: " obj-name))))
("view source" . (lambda(obj-name)
(ess-execute (concat "print(" obj-name ")\n") nil (concat "R object: " obj-name))))
("dput" . (lambda(obj-name)
(ess-execute (concat "dput(" obj-name ")\n") nil (concat "R dput: " obj-name)))))
(volatile)))
#+end_src
** R local objects
#+begin_src emacs-lisp
(setq anything-c-source-R-local
'((name . "R local objects")
(init . (lambda ()
; this grabs the process name associated with the buffer
(setq anything-c-ess-local-process-name ess-local-process-name)
; this grabs the buffer for later use
(setq anything-c-ess-buffer (current-buffer))))
(candidates . (lambda ()
(let (buf)
(condition-case nil
(with-temp-buffer
(progn
(setq buf (current-buffer))
(with-current-buffer anything-c-ess-buffer
(ess-command "print(ls.str(), max.level=0)\n" buf))
(split-string (buffer-string) "\n" t)))
(error nil)))))
(display-to-real . (lambda (obj-name) (car (split-string obj-name " : " t))))
(action
("str" . (lambda(obj-name)
(ess-execute (concat "str(" obj-name ")\n") nil (concat "R str: " obj-name))))
("summary" . (lambda(obj-name)
(ess-execute (concat "summary(" obj-name ")\n") nil (concat "R summary: " obj-name))))
("head (10)" . (lambda(obj-name)
(ess-execute (concat "head(" obj-name ", n = 10)\n") nil (concat "R head: " obj-name))))
("head (100)" . (lambda(obj-name)
(ess-execute (concat "head(" obj-name ", n = 100)\n") nil (concat "R head: " obj-name))))
("tail" . (lambda(obj-name)
(ess-execute (concat "tail(" obj-name ", n = 10)\n") nil (concat "R tail: " obj-name))))
("print" . (lambda(obj-name)
(ess-execute (concat "print(" obj-name ")\n") nil (concat "R object: " obj-name))))
("dput" . (lambda(obj-name)
(ess-execute (concat "dput(" obj-name ")\n") nil (concat "R dput: " obj-name)))))
(volatile)))
#+end_src
** Occur
#+begin_src emacs-lisp
(setq anything-c-source-occur
'((name . "Occur")
(init . (lambda ()
(setq anything-occur-current-buffer
(current-buffer))))
(candidates . (lambda ()
(let ((anything-occur-buffer (get-buffer-create "*Anything Occur*")))
(with-current-buffer anything-occur-buffer
(occur-mode)
(erase-buffer)
(let ((count (occur-engine anything-pattern
(list anything-occur-current-buffer) anything-occur-buffer
list-matching-lines-default-context-lines case-fold-search
list-matching-lines-buffer-name-face
nil list-matching-lines-face
(not (eq occur-excluded-properties t)))))
(when (> count 0)
(setq next-error-last-buffer anything-occur-buffer)
(cdr (split-string (buffer-string) "\n" t))))))))
(action . (("Goto line" . (lambda (candidate)
(with-current-buffer "*Anything Occur*"
(search-forward candidate))
(goto-line (string-to-number candidate) anything-occur-current-buffer)))))
(requires-pattern . 3)
(volatile)
(delayed)))
#+end_src
** imenu --- probably ---
#+begin_src emacs-lisp
(defvar anything-c-imenu-delimiter "/")
(defvar anything-c-cached-imenu-alist nil)
(defvar anything-c-cached-imenu-candidates nil)
(defvar anything-c-cached-imenu-tick nil)
(make-variable-buffer-local 'anything-c-cached-imenu-alist)
(make-variable-buffer-local 'anything-c-cached-imenu-candidates)
(make-variable-buffer-local 'anything-c-cached-imenu-tick)
(setq anything-c-source-imenu
'((name . "Imenu")
(init . (lambda ()
(setq anything-c-imenu-current-buffer
(current-buffer))))
(candidates
. (lambda ()
(with-current-buffer anything-c-imenu-current-buffer
(let ((tick (buffer-modified-tick)))
(if (eq anything-c-cached-imenu-tick tick)
anything-c-cached-imenu-candidates
(setq anything-c-cached-imenu-tick tick
anything-c-cached-imenu-candidates
(condition-case nil
(mapcan
(lambda (entry)
(if (listp (cdr entry))
(mapcar (lambda (sub)
(concat (car entry) anything-c-imenu-delimiter (car sub)))
(cdr entry))
(list (car entry))))
(setq anything-c-cached-imenu-alist (imenu--make-index-alist)))
(error nil))))))))
(volatile)
(action
. (lambda (entry)
(let* ((pair (split-string entry anything-c-imenu-delimiter))
(first (car pair))
(second (cadr pair)))
(imenu
(if second
(assoc second (cdr (assoc first anything-c-cached-imenu-alist)))
(assoc entry anything-c-cached-imenu-alist))))))))
#+end_src
** Visible bookmarks
#+begin_src emacs-lisp
;; (defvar anything-c-source-bm
;; '((name . "Visible Bookmarks")
;; (init . (lambda ()
;; (let ((bookmarks (bm-lists)))
;; (setq anything-bm-marks
;; (delq nil
;; (mapcar (lambda (bm)
;; (let ((start (overlay-start bm))
;; (end (overlay-end bm)))
;; (if (< (- end start) 2)
;; nil
;; (format "%7d: %s"
;; (line-number-at-pos start)
;; (buffer-substring start (1- end))))))
;; (append (car bookmarks) (cdr bookmarks))))))))
;; (candidates . (lambda ()
;; anything-bm-marks))
;; (action . (("Goto line" . (lambda (candidate)
;; (goto-line (string-to-number candidate))))))))
#+end_src
** I don't know
#+begin_src emacs-lisp
;;
(setq anything-sources
(list
anything-c-source-buffers ; buffers
;; anything-c-source-bm
anything-c-source-imenu ; e.g. Imenu-S menu
;; anything-c-source-recentf ; recent files: needs (require 'recentf)
anything-c-source-R-local
anything-c-source-R-help
anything-c-source-files-in-current-dir
anything-c-source-occur
anything-c-source-locate ; needs the utility locate
))
#+end_src
* icicles
#+begin_src emacs-lisp
;; (load-file "~/emacs/icicles/icicles.el")
#+end_src
* highlight-parentheses
http://nschum.de/src/emacs/highlight-parentheses/highlight-parentheses.el
highlight parenthesis with different colours
#+begin_src emacs-lisp
(require 'highlight-parentheses)
(setq hl-paren-colors '("gold" "IndianRed" "cyan" "green" "orange"
"magenta"))
(defun hpm-on ()
(highlight-parentheses-mode t))
(add-hook 'ess-mode-hook 'hpm-on)
(add-hook 'inferior-ess-mode-hook 'hpm-on)
#+end_src
* automatically closing brackets
following from Marc Schwartz from ESS list, works globally
insert closing bracets automatically
#+begin_src emacs-lisp
(setq skeleton-pair t)
;(setq skeleton-pair-on-word t)
(global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "{") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "\"") 'skeleton-pair-insert-maybe)
;;(global-set-key (kbd "\'") 'skeleton-pair-insert-maybe) ;; apostrophe
(global-set-key (kbd "\`") 'skeleton-pair-insert-maybe)
;;(global-set-key (kbd "<") 'skeleton-pair-insert-maybe)
;; Delete empty pairs like '()' taken from
;; http://www.emacswiki.org/cgi-bin/wiki/SkeletonMode#toc14 ##Deletion section
(defvar skeletons-alist
'((?\( . ?\))
(?\' . ?\')
(?\" . ?\")
(?[ . ?])
(?{ . ?})
(?< . ?>)
(?$ . ?$)))
(defadvice delete-backward-char (before delete-empty-pair activate)
(if (eq (cdr (assq (char-before) skeletons-alist)) (char-after))
(and (char-after) (delete-char 1))))
#+end_src
* load color-theme-hober
load color-theme package
#+begin_src emacs-lisp
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
;; (color-theme-initialize)
(color-theme-hober)))
#+end_src
* org-mode
** Basic org mode
*** Initialise org-mode
http://orgmode.org/manual/Installation.html#Installation
http://orgmode.org/manual/Activation.html#Activation
#+begin_src emacs-lisp
;; The following lines are always needed. Choose your own keys.
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
;; activate font-lock-mode
(global-font-lock-mode 1) ; for all buffers
;; (add-hook 'org-mode-hook 'turn-on-font-lock) ; Org buffers only
(transient-mark-mode 1)
#+end_src
*** Startup settings
**** Hide leading stars
#+begin_src emacs-lisp
(setq org-hide-leading-stars t)
#+end_src
**** Indent by default
#+begin_src emacs-lisp
(setq org-startup-indented t)
#+end_src
**** Start with hidden source blocks
#+begin_src emacs-lisp
(setq org-hide-block-startup nil)
#+end_src
**** Visibility of outline tree
#+begin_src emacs-lisp
org-startup-folded
#+end_src
*** Use the info files from the actual org-mode used
#+begin_src emacs-lisp
(add-to-list 'Info-default-directory-list "~/.emacs.d/org-mode/doc/")
#+end_src
** Remember for org
setup and load remember for org mode (http://orgmode.org/manual/Setting-up-Remember-for-Org.html#Setting-up-Remember-for-Org)
#+begin_src emacs-lisp
;; (require ‘remember)
(org-remember-insinuate)
(setq org-directory "~/Documents/orgfiles/")
(setq org-default-notes-file (concat org-directory "/notes.org"))
(define-key global-map "\C-cr" 'org-remember)
;; Define templates as in http://orgmode.org/manual/Remember-templates.html#Remember-templates
(setq org-remember-templates
'(("Todo" ?t "* TODO %U\n %?\n %i\n %a" nil "Tasks" )
("Journal" ?j "* %U %?\n\n %i\n %a" nil )
("Idea" ?i "* %^{Title}\n %i\n %a" nil "New Ideas")
("Reference Material" ?r "*%? %&%^g" "reference.org" )))
#+end_src
** org-babel
*** Load library-of-babel.el
Load the source-code blocks defined in an Org-mode file into the global "org-babel-library-of-babel" variable
#+begin_src emacs-lisp
(org-babel-lob-ingest "~/.emacs.d/org-mode/contrib/babel/library-of-babel.org")
#+end_src
*** Define languages to be loaded
#+begin_src emacs-lisp
(require 'ob-R) ;; requires R and ess-mode
;; (require 'ob-ruby) ;; requires ruby, irb, ruby-mode, and inf-ruby
(require 'ob-python) ;; requires python, and python-mode
;; (require 'ob-clojure) ;; requires clojure, clojure-mode, swank-clojure and slime
#+end_src
*** Tangle with comments
#+begin_src emacs-lisp
(setq org-babel-tangle-w-comments t)
#+end_src
*** Customization of sh
set shebang for sh script to "#!/bin/bash"
#+begin_src emacs-lisp
;; ensure this variable is defined
(unless (boundp 'org-babel-default-header-args:sh)
(setq org-babel-default-header-args:sh '()))
;; add a default shebang header argument
(add-to-list 'org-babel-default-header-args:sh
'(:shebang . "#!/bin/bash"))
#+end_src
* Org-mobile settinge --- disabled
#+begin_src emacs-lisp
;; (setq org-mobile-directory "/scpc:rmkrug@webdav.mydrive.ch:org/")
#+end_src
[-- Attachment #4: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BABEL] html export for R not working, but for sh and others
2010-07-01 8:14 [BABEL] html export for R not working, but for sh and others Rainer M Krug
@ 2010-07-01 15:55 ` Eric Schulte
2010-07-02 7:44 ` Rainer M Krug
0 siblings, 1 reply; 6+ messages in thread
From: Eric Schulte @ 2010-07-01 15:55 UTC (permalink / raw)
To: Rainer M Krug; +Cc: emacs-orgmode
Hi Rainer,
Rainer M Krug <r.m.krug@gmail.com> writes:
> Hi
>
> I am trying to export the attached test.org file to HTML, but I can only
> export it, when I change the source block language to anything different
> from R.
>
> I also attach my emacs.org file, but I am not doing any customisations to R.
>
I've just started up a minimal Emacs instance and loaded the babel
portion of your attached config, but I am able to export your attached
org file w/o error. A couple of questions.
1) are you able to export to latex? If so, then maybe the issue has to
do with fontification of R code by htmlize-buffer
2) could you send in the actual error being reported by Emacs, or a
stack trace?
>
> In addition: if I specify :session *R* in #:BABEL: , the code is
> evaluated, even though I specified :exports code. Is this intended?
>
Yes, this is for Sweave like behavior.
If you have a session specified for every block in the buffer, and you
are exporting the buffer, there are cases when you need a block to be
executed (e.g. because it sets the value of a variable used by a
subsequent block) even though you *do not* want the results of the block
included in the final document. To support these use cases, on export
every block with a session is executed so that it's effects on the
persist session takes place.
Cheers -- Eric
>
> Thanks,
>
> Rainer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BABEL] html export for R not working, but for sh and others
2010-07-01 15:55 ` Eric Schulte
@ 2010-07-02 7:44 ` Rainer M Krug
2010-07-02 12:37 ` Rainer M Krug
0 siblings, 1 reply; 6+ messages in thread
From: Rainer M Krug @ 2010-07-02 7:44 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 2700 bytes --]
On Thu, Jul 1, 2010 at 5:55 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> Hi Rainer,
>
Hi Eric,
>
> Rainer M Krug <r.m.krug@gmail.com> writes:
>
> > Hi
> >
> > I am trying to export the attached test.org file to HTML, but I can only
> > export it, when I change the source block language to anything different
> > from R.
> >
> > I also attach my emacs.org file, but I am not doing any customisations
> to R.
> >
>
> I've just started up a minimal Emacs instance and loaded the babel
> portion of your attached config, but I am able to export your attached
> org file w/o error. A couple of questions.
>
> 1) are you able to export to latex? If so, then maybe the issue has to
> do with fontification of R code by htmlize-buffer
>
Yes - export to latex (and from there to pdf) are working.
>
> 2) could you send in the actual error being reported by Emacs, or a
> stack trace?
>
These are the messages in emacs:
Select command:
Exporting...
org-babel-exp processing...
Fontifying *temp*... (regexps.............)
org-babel-exp processing...
font-lock-fontify-keywords-region: Invalid regexp: "Regular expression too
big"
How can I get a stack trace?
One more thing: if I start emacs with the -Q option, it works. So I assume
it is something in my emacs.org file. What is the easiest way to avoid that
source blocks under a heading in the emacs.org file are executed?
> >
> > In addition: if I specify :session *R* in #:BABEL: , the code is
> > evaluated, even though I specified :exports code. Is this intended?
> >
>
> Yes, this is for Sweave like behavior.
>
> If you have a session specified for every block in the buffer, and you
> are exporting the buffer, there are cases when you need a block to be
> executed (e.g. because it sets the value of a variable used by a
> subsequent block) even though you *do not* want the results of the block
> included in the final document. To support these use cases, on export
> every block with a session is executed so that it's effects on the
> persist session takes place.
>
OK - that makes sense.
If you need any further info, please let me know.
Thanks,
Rainer
>
> Cheers -- Eric
>
> >
> > Thanks,
> >
> > Rainer
>
--
NEW GERMAN FAX NUMBER!!!
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
Cell: +27 - (0)83 9479 042
Fax: +27 - (0)86 516 2782
Fax: +49 - (0)321 2125 2244
email: Rainer@krugs.de
Skype: RMkrug
Google: R.M.Krug@gmail.com
[-- Attachment #1.2: Type: text/html, Size: 4879 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BABEL] html export for R not working, but for sh and others
2010-07-02 7:44 ` Rainer M Krug
@ 2010-07-02 12:37 ` Rainer M Krug
2010-07-02 22:52 ` Eric Schulte
0 siblings, 1 reply; 6+ messages in thread
From: Rainer M Krug @ 2010-07-02 12:37 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 4818 bytes --]
Hi Eric
I traced the problem to the following section in my emacs.org file:
* Syntax highlighting for functions in R
based on https://mail.google.com/mail/#label/Lists%2FESS/125131ed24688970
The following code needs to be run in R:
obj <- do.call("c", sapply(c("package:base", "package:stats",
"package:utils"), objects, all.names=TRUE))
re <- "(^[^.[:alpha:][:digit:]]|<-|__)" # to remove "weird" functions
obj <- obj[-grep(re, obj)]
fpath <- file.path(Sys.getenv("HOME"), ".emacs.d", "R-function-names.txt")
write.table(obj, fpath, quote=FALSE, row.names=FALSE, col.names=FALSE)
Read a whole file into list of lines
Author: Xah Lee
see http://xahlee.org/emacs/elisp_process_lines.html
#+begin_src emacs-lisp
(defun read-lines (file)
"Return a list of lines in FILE."
(with-temp-buffer
(insert-file-contents file)
(split-string
(buffer-string) "\n" t)
)
)
(add-hook 'ess-mode-hook
'(lambda()
(setq ess-my-extra-R-function-keywords
(read-lines "~/.emacs.d/R-function-names.txt"))
(setq ess-R-mode-font-lock-keywords
(append ess-R-mode-font-lock-keywords
(list (cons (concat "\\<" (regexp-opt
ess-my-extra-R-function-keywords 'enc-paren) "\\>")
'font-lock-function-name-face))))))
If I disable that section, it works. Do you have any ideas if it could be
changes? I don't know anything about emacs-lisp.
Thanks,
Rainer
On Fri, Jul 2, 2010 at 9:44 AM, Rainer M Krug <r.m.krug@gmail.com> wrote:
>
>
> On Thu, Jul 1, 2010 at 5:55 PM, Eric Schulte <schulte.eric@gmail.com>wrote:
>
>> Hi Rainer,
>>
>
> Hi Eric,
>
>
>>
>> Rainer M Krug <r.m.krug@gmail.com> writes:
>>
>> > Hi
>> >
>> > I am trying to export the attached test.org file to HTML, but I can
>> only
>> > export it, when I change the source block language to anything different
>> > from R.
>> >
>> > I also attach my emacs.org file, but I am not doing any customisations
>> to R.
>> >
>>
>> I've just started up a minimal Emacs instance and loaded the babel
>> portion of your attached config, but I am able to export your attached
>> org file w/o error. A couple of questions.
>>
>> 1) are you able to export to latex? If so, then maybe the issue has to
>> do with fontification of R code by htmlize-buffer
>>
>
> Yes - export to latex (and from there to pdf) are working.
>
>>
>> 2) could you send in the actual error being reported by Emacs, or a
>> stack trace?
>>
> These are the messages in emacs:
>
> Select command:
> Exporting...
> org-babel-exp processing...
> Fontifying *temp*... (regexps.............)
> org-babel-exp processing...
> font-lock-fontify-keywords-region: Invalid regexp: "Regular expression too
> big"
>
> How can I get a stack trace?
>
> One more thing: if I start emacs with the -Q option, it works. So I assume
> it is something in my emacs.org file. What is the easiest way to avoid
> that source blocks under a heading in the emacs.org file are executed?
>
>
>> >
>> > In addition: if I specify :session *R* in #:BABEL: , the code is
>> > evaluated, even though I specified :exports code. Is this intended?
>> >
>>
>> Yes, this is for Sweave like behavior.
>>
>> If you have a session specified for every block in the buffer, and you
>> are exporting the buffer, there are cases when you need a block to be
>> executed (e.g. because it sets the value of a variable used by a
>> subsequent block) even though you *do not* want the results of the block
>> included in the final document. To support these use cases, on export
>> every block with a session is executed so that it's effects on the
>> persist session takes place.
>>
>
> OK - that makes sense.
> If you need any further info, please let me know.
>
> Thanks,
>
> Rainer
>
>>
>> Cheers -- Eric
>>
>> >
>> > Thanks,
>> >
>> > Rainer
>>
>
>
>
> --
> NEW GERMAN FAX NUMBER!!!
>
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
> UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Natural Sciences Building
> Office Suite 2039
> Stellenbosch University
> Main Campus, Merriman Avenue
> Stellenbosch
> South Africa
>
> Cell: +27 - (0)83 9479 042
> Fax: +27 - (0)86 516 2782
> Fax: +49 - (0)321 2125 2244
> email: Rainer@krugs.de
>
> Skype: RMkrug
> Google: R.M.Krug@gmail.com
>
>
--
NEW GERMAN FAX NUMBER!!!
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
Cell: +27 - (0)83 9479 042
Fax: +27 - (0)86 516 2782
Fax: +49 - (0)321 2125 2244
email: Rainer@krugs.de
Skype: RMkrug
Google: R.M.Krug@gmail.com
[-- Attachment #1.2: Type: text/html, Size: 11222 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BABEL] html export for R not working, but for sh and others
2010-07-02 12:37 ` Rainer M Krug
@ 2010-07-02 22:52 ` Eric Schulte
2010-07-03 18:42 ` Rainer M Krug
0 siblings, 1 reply; 6+ messages in thread
From: Eric Schulte @ 2010-07-02 22:52 UTC (permalink / raw)
To: Rainer M Krug; +Cc: emacs-orgmode
Hi Rainer,
My guess would be that the `htmlize-buffer' command which is used to
fontify code in html export is choking because the elisp below is
defining new fonts for R code. If htmlize-buffer can't find the
definitions for these fonts then it will throw an error.
I'm not sure what the solution would be, but I'm pretty sure that's the
source of the problem.
Best -- Eric
Rainer M Krug <r.m.krug@gmail.com> writes:
> Hi Eric
>
> I traced the problem to the following section in my emacs.org file:
>
> * Syntax highlighting for functions in R
> based on https://mail.google.com/mail/#label/Lists%2FESS/125131ed24688970
> The following code needs to be run in R:
>
> obj <- do.call("c", sapply(c("package:base", "package:stats",
> "package:utils"), objects, all.names=TRUE))
> re <- "(^[^.[:alpha:][:digit:]]|<-|__)" # to remove "weird" functions
> obj <- obj[-grep(re, obj)]
> fpath <- file.path(Sys.getenv("HOME"), ".emacs.d", "R-function-names.txt")
> write.table(obj, fpath, quote=FALSE, row.names=FALSE, col.names=FALSE)
>
> Read a whole file into list of lines
> Author: Xah Lee
> see http://xahlee.org/emacs/elisp_process_lines.html
> #+begin_src emacs-lisp
> (defun read-lines (file)
> "Return a list of lines in FILE."
> (with-temp-buffer
> (insert-file-contents file)
> (split-string
> (buffer-string) "\n" t)
> )
> )
>
> (add-hook 'ess-mode-hook
> '(lambda()
> (setq ess-my-extra-R-function-keywords
> (read-lines "~/.emacs.d/R-function-names.txt"))
> (setq ess-R-mode-font-lock-keywords
> (append ess-R-mode-font-lock-keywords
> (list (cons (concat "\\<" (regexp-opt
> ess-my-extra-R-function-keywords 'enc-paren) "\\>")
> 'font-lock-function-name-face))))))
>
> If I disable that section, it works. Do you have any ideas if it could be
> changes? I don't know anything about emacs-lisp.
>
> Thanks,
>
> Rainer
>
> On Fri, Jul 2, 2010 at 9:44 AM, Rainer M Krug <r.m.krug@gmail.com> wrote:
>
>>
>>
>> On Thu, Jul 1, 2010 at 5:55 PM, Eric Schulte <schulte.eric@gmail.com>wrote:
>>
>>> Hi Rainer,
>>>
>>
>> Hi Eric,
>>
>>
>>>
>>> Rainer M Krug <r.m.krug@gmail.com> writes:
>>>
>>> > Hi
>>> >
>>> > I am trying to export the attached test.org file to HTML, but I can
>>> only
>>> > export it, when I change the source block language to anything different
>>> > from R.
>>> >
>>> > I also attach my emacs.org file, but I am not doing any customisations
>>> to R.
>>> >
>>>
>>> I've just started up a minimal Emacs instance and loaded the babel
>>> portion of your attached config, but I am able to export your attached
>>> org file w/o error. A couple of questions.
>>>
>>> 1) are you able to export to latex? If so, then maybe the issue has to
>>> do with fontification of R code by htmlize-buffer
>>>
>>
>> Yes - export to latex (and from there to pdf) are working.
>>
>>>
>>> 2) could you send in the actual error being reported by Emacs, or a
>>> stack trace?
>>>
>> These are the messages in emacs:
>>
>> Select command:
>> Exporting...
>> org-babel-exp processing...
>> Fontifying *temp*... (regexps.............)
>> org-babel-exp processing...
>> font-lock-fontify-keywords-region: Invalid regexp: "Regular expression too
>> big"
>>
>> How can I get a stack trace?
>>
>> One more thing: if I start emacs with the -Q option, it works. So I assume
>> it is something in my emacs.org file. What is the easiest way to avoid
>> that source blocks under a heading in the emacs.org file are executed?
>>
>>
>>> >
>>> > In addition: if I specify :session *R* in #:BABEL: , the code is
>>> > evaluated, even though I specified :exports code. Is this intended?
>>> >
>>>
>>> Yes, this is for Sweave like behavior.
>>>
>>> If you have a session specified for every block in the buffer, and you
>>> are exporting the buffer, there are cases when you need a block to be
>>> executed (e.g. because it sets the value of a variable used by a
>>> subsequent block) even though you *do not* want the results of the block
>>> included in the final document. To support these use cases, on export
>>> every block with a session is executed so that it's effects on the
>>> persist session takes place.
>>>
>>
>> OK - that makes sense.
>> If you need any further info, please let me know.
>>
>> Thanks,
>>
>> Rainer
>>
>>>
>>> Cheers -- Eric
>>>
>>> >
>>> > Thanks,
>>> >
>>> > Rainer
>>>
>>
>>
>>
>> --
>> NEW GERMAN FAX NUMBER!!!
>>
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
>> UCT), Dipl. Phys. (Germany)
>>
>> Centre of Excellence for Invasion Biology
>> Natural Sciences Building
>> Office Suite 2039
>> Stellenbosch University
>> Main Campus, Merriman Avenue
>> Stellenbosch
>> South Africa
>>
>> Cell: +27 - (0)83 9479 042
>> Fax: +27 - (0)86 516 2782
>> Fax: +49 - (0)321 2125 2244
>> email: Rainer@krugs.de
>>
>> Skype: RMkrug
>> Google: R.M.Krug@gmail.com
>>
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BABEL] html export for R not working, but for sh and others
2010-07-02 22:52 ` Eric Schulte
@ 2010-07-03 18:42 ` Rainer M Krug
0 siblings, 0 replies; 6+ messages in thread
From: Rainer M Krug @ 2010-07-03 18:42 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
Hi Eric
On Saturday, July 3, 2010, Eric Schulte <schulte.eric@gmail.com> wrote:
> Hi Rainer,
>
> My guess would be that the `htmlize-buffer' command which is used to
> fontify code in html export is choking because the elisp below is
> defining new fonts for R code. If htmlize-buffer can't find the
> definitions for these fonts then it will throw an error.
>
> I'm not sure what the solution would be, but I'm pretty sure that's the
> source of the problem.
If I find Time,I'll look into it and contact the original author.
For the time being,i'll disable that Code Section.
Thanks,
Rainer
>
> Best -- Eric
>
> Rainer M Krug <r.m.krug@gmail.com> writes:
>
>> Hi Eric
>>
>> I traced the problem to the following section in my emacs.org file:
>>
>> * Syntax highlighting for functions in R
>> based on https://mail.google.com/mail/#label/Lists%2FESS/125131ed24688970
>> The following code needs to be run in R:
>>
>> obj <- do.call("c", sapply(c("package:base", "package:stats",
>> "package:utils"), objects, all.names=TRUE))
>> re <- "(^[^.[:alpha:][:digit:]]|<-|__)" # to remove "weird" functions
>> obj <- obj[-grep(re, obj)]
>> fpath <- file.path(Sys.getenv("HOME"), ".emacs.d", "R-function-names.txt")
>> write.table(obj, fpath, quote=FALSE, row.names=FALSE, col.names=FALSE)
>>
>> Read a whole file into list of lines
>> Author: Xah Lee
>> see http://xahlee.org/emacs/elisp_process_lines.html
>> #+begin_src emacs-lisp
>> (defun read-lines (file)
>> "Return a list of lines in FILE."
>> (with-temp-buffer
>> (insert-file-contents file)
>> (split-string
>> (buffer-string) "\n" t)
>> )
>> )
>>
>> (add-hook 'ess-mode-hook
>> '(lambda()
>> (setq ess-my-extra-R-function-keywords
>> (read-lines "~/.emacs.d/R-function-names.txt"))
>> (setq ess-R-mode-font-lock-keywords
>> (append ess-R-mode-font-lock-keywords
>> (list (cons (concat "\\<" (regexp-opt
>> ess-my-extra-R-function-keywords 'enc-paren) "\\>")
>> 'font-lock-function-name-face))))))
>>
>> If I disable that section, it works. Do you have any ideas if it could be
>> changes? I don't know anything about emacs-lisp.
>>
>> Thanks,
>>
>> Rainer
>>
>> On Fri, Jul 2, 2010 at 9:44 AM, Rainer M Krug <r.m.krug@gmail.com> wrote:
>>
>>>
>>>
>>> On Thu, Jul 1, 2010 at 5:55 PM, Eric Schulte <schulte.eric@gmail.com>wrote:
>>>
>>>> Hi Rainer,
>>>>
>>>
>>> Hi Eric,
>>>
>>>
>>>>
>>>> Rainer M Krug <r.m.krug@gmail.com> writes:
>>>>
>>>> > Hi
>>>> >
>>>> > I am trying to export the attached test.org file to HTML, but I can
>>>> only
>>>> > export it, when I change the source block language to anything different
>>>> > from R.
>>>> >
>>>> > I also attach my emacs.org file, but I am not doing any customisations
>>>> to R.
>>>> >
>>>>
>>>> I've just started up a minimal Emacs instance and loaded the babel
>>>> portion of your attached config, but I am able to export your attached
>>>> org file w/o error. A couple of questions.
>>>>
>>>> 1) are you able to export to latex? If so, then maybe the issue has to
>>>> do with fontification of R code by htmlize-buffer
>>>>
>>>
>>> Yes - export to latex (and from there to pdf) are working.
>>>
>>>>
>>>> 2) could you send in the actual error being reported by Emacs, or a
>>>> stack trace?
>>>>
>>> These are the messages in emacs:
>>>
>>> Select command:
>>> Exporting...
>>> org-babel-exp processing...
>>> Fontifying *temp*... (regexps.............)
>>> org-babel-exp processing...
>>> font-lock-fontify-keywords-region: Invalid regexp: "Regular expression too
>>> big"
>>>
>>> How can I get a stack trace?
>>>
>>> One more thing: if I start emacs with
--
NEW GERMAN FAX NUMBER!!!
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
Cell: +27 - (0)83 9479 042
Fax: +27 - (0)86 516 2782
Fax: +49 - (0)321 2125 2244
email: Rainer@krugs.de
Skype: RMkrug
Google: R.M.Krug@gmail.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-07-03 18:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-01 8:14 [BABEL] html export for R not working, but for sh and others Rainer M Krug
2010-07-01 15:55 ` Eric Schulte
2010-07-02 7:44 ` Rainer M Krug
2010-07-02 12:37 ` Rainer M Krug
2010-07-02 22:52 ` Eric Schulte
2010-07-03 18:42 ` Rainer M Krug
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.