emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BABEL] [BUG] Property ":exports: both" ignored when exporting subtree
@ 2011-02-25 16:15 Rainer M Krug
  2011-02-27 21:24 ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Rainer M Krug @ 2011-02-25 16:15 UTC (permalink / raw)
  To: emacs-orgmode, Eric Schulte

Hi,

When exporting this buffer to pdf, the R code becomes evaluated and
the code and the result becomes exported; but when I export only the
"Here it does not work" subtree, the :exports: is ignored and only the
code is exported; if I export only the "Here it works" subtree, the
code and result are exported as ":export both" is used as a header
argument.

Cheers,

Rainer

* Her it does not work
:PROPERTIES:
:tangle: no
:results: output org
:exports: both
:END:
** R code graph
#+begin_src R
  pdf("pdf1.pdf")
  plot(runif(100))
  dev.off()

  cat(
      "\n|--|--|\n",
      "|name|[[./pdf1.pdf]]|\n",
      "|--|--|\n"
      )
#+end_src

* Here it works
:PROPERTIES:
:tangle: no
:results: output org
:exports: both
:END:
** R code graph
#+begin_src R :exports both
  pdf("pdf1.pdf")
  plot(runif(100))
  dev.off()

  cat(
      "\n|--|--|\n",
      "|name|[[./pdf1.pdf]]|\n",
      "|--|--|\n"
      )
#+end_src

-- 
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] 4+ messages in thread

* Re: [BABEL] [BUG] Property ":exports: both" ignored when exporting subtree
  2011-02-25 16:15 [BABEL] [BUG] Property ":exports: both" ignored when exporting subtree Rainer M Krug
@ 2011-02-27 21:24 ` Eric Schulte
  2011-02-28 11:12   ` Rainer M Krug
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2011-02-27 21:24 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

Hi Rainer,

I tried to reproduce this problem, but it seems to have worked as
expected on my system, specifically when exporting the "Her it does not
work" subtree, I get the following in the resulting .tex file.

#+begin_src latex
  \section*{Her it does not work}
  \label{sec-1}
  \subsection*{R code graph}
  \label{sec-1_1}

  \begin{verbatim}
  pdf("pdf1.pdf")
  plot(runif(100))
  dev.off()

  cat(
      "\n|--|--|\n",
      "|name|[[./pdf1.pdf]]|\n",
      "|--|--|\n"
      )
  \end{verbatim}

  \begin{verbatim}
   null device 
             1 

   |--|--|
    |name|[[./pdf1.pdf]]|
    |--|--|
  \end{verbatim}
#+end_src

Cheers -- Eric

Rainer M Krug <r.m.krug@gmail.com> writes:

> Hi,
>
> When exporting this buffer to pdf, the R code becomes evaluated and
> the code and the result becomes exported; but when I export only the
> "Here it does not work" subtree, the :exports: is ignored and only the
> code is exported; if I export only the "Here it works" subtree, the
> code and result are exported as ":export both" is used as a header
> argument.
>
> Cheers,
>
> Rainer
>
> * Her it does not work
> :PROPERTIES:
> :tangle: no
> :results: output org
> :exports: both
> :END:
> ** R code graph
> #+begin_src R
>   pdf("pdf1.pdf")
>   plot(runif(100))
>   dev.off()
>
>   cat(
>       "\n|--|--|\n",
>       "|name|[[./pdf1.pdf]]|\n",
>       "|--|--|\n"
>       )
> #+end_src
>
>
> * Here it works
> :PROPERTIES:
> :tangle: no
> :results: output org
> :exports: both
> :END:
> ** R code graph
> #+begin_src R :exports both
>   pdf("pdf1.pdf")
>   plot(runif(100))
>   dev.off()
>
>   cat(
>       "\n|--|--|\n",
>       "|name|[[./pdf1.pdf]]|\n",
>       "|--|--|\n"
>       )
> #+end_src

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BABEL] [BUG] Property ":exports: both" ignored when exporting subtree
  2011-02-27 21:24 ` Eric Schulte
@ 2011-02-28 11:12   ` Rainer M Krug
  2011-03-01 17:38     ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Rainer M Krug @ 2011-02-28 11:12 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3095 bytes --]

On Sun, Feb 27, 2011 at 10:24 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> Hi Rainer,
>
> I tried to reproduce this problem, but it seems to have worked as
> expected on my system, specifically when exporting the "Her it does not
> work" subtree, I get the following in the resulting .tex file.
>
> #+begin_src latex
>  \section*{Her it does not work}
>  \label{sec-1}
>  \subsection*{R code graph}
>  \label{sec-1_1}
>
>  \begin{verbatim}
>  pdf("pdf1.pdf")
>  plot(runif(100))
>  dev.off()
>
>  cat(
>      "\n|--|--|\n",
>      "|name|[[./pdf1.pdf]]|\n",
>      "|--|--|\n"
>      )
>  \end{verbatim}
>
>  \begin{verbatim}
>   null device
>             1
>
>   |--|--|
>    |name|[[./pdf1.pdf]]|
>    |--|--|
>  \end{verbatim}
> #+end_src
>
> Cheers -- Eric
>
> Rainer M Krug <r.m.krug@gmail.com> writes:
>
>> Hi,
>>
>> When exporting this buffer to pdf, the R code becomes evaluated and
>> the code and the result becomes exported; but when I export only the
>> "Here it does not work" subtree, the :exports: is ignored and only the
>> code is exported; if I export only the "Here it works" subtree, the
>> code and result are exported as ":export both" is used as a header
>> argument.

OK - further test:

after an update this morning to Org-mode version 7.4
(release_7.4.553.g83b7) even the export of the whole document top pdf,
does not include the graphs. In contrast, when using 7.01g with the
same emacs.org file, the export of the complete document includes the
graphs, although on 7.01g, no subtree export does include an graph.

With Org-mode version 7.4 (release_7.4.553.g83b7), no export of any
subtree included any graph.

I attach my (longish) emacs.org file ant the init.el, but I do not
think there is a problem in there.

Cheers,

Rainer


>>
>> Cheers,
>>
>> Rainer
>>
>> * Her it does not work
>> :PROPERTIES:
>> :tangle: no
>> :results: output org
>> :exports: both
>> :END:
>> ** R code graph
>> #+begin_src R
>>   pdf("pdf1.pdf")
>>   plot(runif(100))
>>   dev.off()
>>
>>   cat(
>>       "\n|--|--|\n",
>>       "|name|[[./pdf1.pdf]]|\n",
>>       "|--|--|\n"
>>       )
>> #+end_src
>>
>>
>> * Here it works
>> :PROPERTIES:
>> :tangle: no
>> :results: output org
>> :exports: both
>> :END:
>> ** R code graph
>> #+begin_src R :exports both
>>   pdf("pdf1.pdf")
>>   plot(runif(100))
>>   dev.off()
>>
>>   cat(
>>       "\n|--|--|\n",
>>       "|name|[[./pdf1.pdf]]|\n",
>>       "|--|--|\n"
>>       )
>> #+end_src
>



-- 
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 #2: init.el --]
[-- Type: text/x-emacs-lisp, Size: 2555 bytes --]

;;; init.el --- Where all the magic begins
;;
;; This file loads both
;; - Org-mode : http://orgmode.org/ and
;; - Org-babel: http://orgmode.org/worg/org-contrib/babel/org-babel.php#library-of-babel
;;
;; It then loads the rest of our Emacs initialization from Emacs lisp
;; embedded in literate Org-mode files.

;; Load up Org Mode and Org Babel for elisp embedded in Org Mode files
(add-to-list 'load-path "~/.emacs.d/org-mode/lisp")
(add-to-list 'load-path "~/.emacs.d/org-mode/contrib/lisp")

;; load up Org-mode and Org-babel
(require 'org-install)

;; load up the main file
(org-babel-load-file "~/.emacs.d/emacs.org")

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(markchars-global-mode nil)
 '(org-agenda-files nil)
 '(org-capture-templates (quote (("t" "Todo" entry (file+headline "~/Documents/orgfiles/notes.org" "Tasks") "* TODO %U
 %?
  %i
  %a") ("j" "Journal" entry (file+headline "~/Documents/orgfiles//notes.org" "") "* %U %?

  %i
  %a") ("i" "Idea" entry (file+headline "~/Documents/orgfiles//notes.org" "New Ideas") "* %^{Title}
  %i
  %a") ("r" "Reference Material" entry (file+headline "~/Documents/orgfiles/./notes.org" "Reference") "*%? %&%^g") ("q" "Question to be addressed" entry (id "QUESTIONS") "* %?
- file     :: %(buffer-file-name (org-capture-get :original-buffer))
- revision :: %(vc-working-revision (buffer-file-name (org-capture-get :original-buffer)))
- state    :: %(symbol-name (vc-state (buffer-file-name (org-capture-get :original-buffer))))
- link     :: %a 
- author   :: Rainer M Krug, email: Rainer@krugs.de") ("c" "Changes to be logged for change log" entry (file+headline "" "") "* %T %? 
- file     :: %(buffer-file-name (org-capture-get :original-buffer))
- revision :: %(vc-working-revision (buffer-file-name (org-capture-get :original-buffer)))
- state    :: %(symbol-name (vc-state (buffer-file-name (org-capture-get :original-buffer))))
- link     :: %a 
- author   :: Rainer M Krug, email: Rainer@krugs.de %n"))))
)
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(markchars-heavy ((t (:background "red" :underline "magenta"))))
 '(markchars-light ((t (:background "red" :underline "light blue")))))

[-- Attachment #3: emacs.org --]
[-- Type: application/octet-stream, Size: 38587 bytes --]

#+TITLE: .emacs file 
#+AUTHOR:    Rainer M Krug
#+EMAIL:     rkrug@ecolmod
#+DATE:      2010-09-17 Fri
#+DESCRIPTION: 
#+KEYWORDS: 
#+LANGUAGE:  en
#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:t 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: 
##+OPTIONS: toc:nil num:nil ^:nil

* General settings
** Save desktop
#+begin_src emacs-lisp
(desktop-save-mode 1)
#+end_src
** Do not show font locking messages
#+begin_src emacs-lisp
  '(font-lock-verbose nil)
#+end_src
** COMMENT Autosave desktop every hour
#+begin_src emacs-lisp :tangle no
  (run-at-time "00:59" 3600 'org-save-all-org-buffers)
#+end_src
** Search path definitions
#+begin_src emacs-lisp
  (add-to-list 'load-path "~/.emacs.d/site-lisp")
#+end_src
* COMMENT Load markchars
#+begin_src emacs-lisp :tangle no
  (load "~/.emacs.d/nxhtml/autostart.el")
  
#+end_src
* COMMENT CEDET
  See cedet/common/cedet.info for configuration details.
#+begin_src emacs-lisp :tangle no
   (add-to-list 'load-path "~/.emacs.d/cedet")
   (load-file "~/.emacs.d/cedet/common/cedet.el")
#+end_src
  Optional other options
#+begin_src emacs-lisp :tangle no
  ;; 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
* COMMENT Ecb 
#+begin_src emacs-lisp :tangle no
  (add-to-list 'load-path "~/.emacs.d/ecb")
  (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
** Load ess
#+begin_src emacs-lisp
  (add-to-list 'load-path "~/.emacs.d/ess")
  (load "~/.emacs.d/ess/lisp/ess-site")
  (require 'ess-site)
#+end_src
** ESS help
*** kill "bogus" help buffers
#+begin_src emacs-lisp
  (setq ess-help-kill-bogus-buffers t)
#+end_src 
*** all help in one window and in own frame
#+begin_src emacs-lisp
(setq ess-help-own-frame 'one)
#+end_src 

** Add highlighting for certain keywords
#+begin_src emacs-lisp
  (font-lock-add-keywords 'ess-mode
   '(("\\<\\(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
** r-utils
#+begin_src emacs-lisp
   (require 'r-utils)
#+end_src
** R-object tooltips
based on [[http://blogisticreflections.wordpress.com/2009/10/01/r-object-tooltips-in-ess/]]
Here are the comments as on the website:
;; ess-R-object-tooltip.el
;; 
;; I have defined a function, ess-R-object-tooltip, that when
;; invoked, will return a tooltip with some information about
;; the object at point.  The information returned is
;; determined by which R function is called.  This is controlled
;; by an alist, called ess-R-object-tooltip-alist.  The default is
;; given below.  The keys are the classes of R object that will
;; use the associated function.  For example, when the function
;; is called while point is on a factor object, a table of that
;; factor will be shown in the tooltip.  The objects must of course
;; exist in the associated inferior R process for this to work.
;; The special key "other" in the alist defines which function
;; to call when the class is not mached in the alist.  By default,
;; the str function is called, which is actually a fairly useful
;; default for data.frame and function objects.
;; 
;; The last line of this file shows my default keybinding.
;; I simply save this file in a directory in my load-path
;; and then place (require 'ess-R-object-tooltip) in my .emacs
#+begin_src emacs-lisp
  ;; the alist
  (setq ess-R-object-tooltip-alist
        '((numeric    . "summary")
          (factor     . "table")
          (integer    . "summary")
          (lm         . "summary")
          (other      . "str")))
  
  (defun ess-R-object-tooltip ()
    "Get info for object at point, and display it in a tooltip."
    (interactive)
    (let ((objname (current-word))
          (curbuf (current-buffer))
          (tmpbuf (get-buffer-create "**ess-R-object-tooltip**")))
      (if objname
          (progn
            (ess-command (concat "class(" objname ")\n")  tmpbuf )
            (set-buffer tmpbuf)
            (let ((bs (buffer-string)))
              (if (not(string-match "\(object .* not found\)\|unexpected" bs))
                  (let* ((objcls (buffer-substring
                                  (+ 2 (string-match "\".*\"" bs))
                                  (- (point-max) 2)))
                         (myfun (cdr(assoc-string objcls
                                                  ess-R-object-tooltip-alist))))
                    (progn
                      (if (eq myfun nil)
                          (setq myfun
                                (cdr(assoc-string "other"
                                                  ess-R-object-tooltip-alist))))
                      (ess-command (concat myfun "(" objname ")\n") tmpbuf)
                      (let ((bs (buffer-string)))
                        (progn
                          (set-buffer curbuf)
                          (tooltip-show-at-point bs 0 30)))))))))
      (kill-buffer tmpbuf)))
  
  ;; key map for R files and inferior mode
  (define-key ess-mode-map "\C-c\C-g" 'ess-R-object-tooltip)
  (define-key inferior-ess-mode-map "\C-c\C-g" 'ess-R-object-tooltip)
  
  (provide 'ess-R-object-tooltip)
#+end_src
** Shift Enter
From [[http://www.emacswiki.org/emacs/ESSShiftEnter]]
- if R if not running, it starts automatically and opens an inferior frame
- if the region is active, evaluates the region
- otherwise, it runs the current line
#+begin_src emacs-lisps
  (setq ess-ask-for-ess-directory nil)
  (setq ess-local-process-name "R")
  (setq ansi-color-for-comint-mode 'filter)
  (setq comint-prompt-read-only t)
  (setq comint-scroll-to-bottom-on-input t)
  (setq comint-scroll-to-bottom-on-output t)
  (setq comint-move-point-for-output t)
  (defun my-ess-start-R ()
    (interactive)
    (if (not (member "*R*" (mapcar (function buffer-name) (buffer-list))))
      (progn
	(delete-other-windows)
	(setq w1 (selected-window))
	(setq w1name (buffer-name))
	(setq w2 (split-window w1))
	(R)
	(set-window-buffer w2 "*R*")
	(set-window-buffer w1 w1name))))
  (defun my-ess-eval ()
    (interactive)
    (my-ess-start-R)
    (if (and transient-mark-mode mark-active)
	(call-interactively 'ess-eval-region)
      (call-interactively 'ess-eval-line-and-step)))
  (add-hook 'ess-mode-hook
	    '(lambda()
	       (local-set-key [(shift return)] 'my-ess-eval)))
  (add-hook 'inferior-ess-mode-hook
	    '(lambda()
	       (local-set-key [C-up] 'comint-previous-input)
	       (local-set-key [C-down] 'comint-next-input)))
  (require 'ess-site)
#+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
** Additional syntax highlighting
#+begin_src emacs-lisp
  (add-hook 'ess-mode-hook
            '(lambda()
               (font-lock-add-keywords nil
                                       '(("\\<\\(if\\|for\\|function\\|return\\)\\>[\n[:blank:]]*(" 1
                                          font-lock-keyword-face) ; must go first to override highlighting below
                                         ("\\<\\([.A-Za-z][._A-Za-z0-9]*\\)[\n[:blank:]]*(" 1
                                          font-lock-function-name-face) ; highlight function names
                                         ("\\([(,]\\|[\n[:blank:]]*\\)\\([.A-Za-z][._A-Za-z0-9]*\\)[\n[:blank:]]*=[^=]" 2
                                          font-lock-reference-face) ;highlight argument names
                                         ))
               ))
#+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

** eldoc
https://stat.ethz.ch/pipermail/ess-help/2010-June/006176.html for details
#+begin_src emacs-lisp
  (require 'ess-eldoc)
#+end_src
** COMMENT TODO Syntax highlighting for functions in R NOT WORKING
  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 :tangle no
  (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
* ess-tracebugs
** load ess-tracebug and activate
#+begin_src emacs-lisp
  (require 'ess-tracebug)
  (add-hook 'ess-post-run-hook 'ess-tracebug t)
#+end_src

** Error Tracing
#+begin_src emacs-lisp
  (define-key ess-mode-map "\M-]" 'next-error)
  (define-key ess-mode-map "\M-[" 'previous-error)
  (define-key inferior-ess-mode-map "\M-]" 'next-error-no-select)
  (define-key inferior-ess-mode-map "\M-[" 'previous-error-no-select)
#+end_src

** Tracebug Buffer  
#+begin_src emacs-lisp
  (define-key compilation-minor-mode-map [(?n)] 'next-error-no-select)
  (define-key compilation-minor-mode-map [(?p)] 'previous-error-no-select)
#+end_src

** Visual Debugger
*** COMMENT Own Breakpoints
#+begin_src emacs-lisp :tangle no
  (conc ess-bp-type-spec-alist
        '((my-browser "browser(expr = exists(\"a\") && a>.5)"
                      "My-Br>\n"
                      question-mark
                      font-lock-doc-face)))
#+end_src
* COMMENT Graphviz
Load graphviz-dot-mode
#+begin_src emacs-lisp :tangle no
  (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
* COMMENT Bookmark (bm)
#+begin_src emacs-lisp :tangle no
  (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
* COMMENT anything
#+begin_src emacs-lisp :tangle no
  (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-lisps
  (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-lisps
  (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-lisps
  (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-lisps
  (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-lisps
  ;; (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-lisps
  ;;
  (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
* COMMENT icicles
#+begin_src emacs-lisp :tangle no
  (load "~/.emacs.d/site-lisp/icicles-install")
  (add-to-list 'load-path "~/.emacs.d/icicles")
  ;; (require 'icicles)
#+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)
   (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

* 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

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

*** Enable fontification of inline code blocks
#+begin_src emacs-lisp
  (setq org-src-fontify-natively t)
#+end_src

*** Enable tab in source block
#+begin_src emacs-lisp
  (setq org-src-tab-acts-natively t)
#+end_src

*** COMMENT Use text search instead of :ID: properties for links
#+begin_src emacs-lisp :tangle no
  (set org-link-to-org-use-id nil)
#+end_src

*** Enable fontified code export to LaTeX / pdf
#+begin_src emacs-lisp
  (require 'org-latex)
  (setq org-export-latex-listings t)
  (add-to-list 'org-export-latex-packages-alist '("" "listings"))
  (add-to-list 'org-export-latex-packages-alist '("" "color"))
#+end_src

*** Display source code edit buffer in the current window, keeping all other windows
#+begin_src emacs-lisp
  (setq org-src-window-setup 'current-window)
#+end_src

*** Scale LaTeX math symbols et al
#+BEGIN_SRC emacs-lisp
  (setq org-format-latex-options 
        (plist-put org-format-latex-options :scale 1.3))
#+END_SRC

*** Kill export buffer when created
#+begin_src emacs-lisp
  (setq org-export-kill-product-buffer-when-displayed t)
#+end_src

*** Change "folding ellipses"
#+begin_src emacs-lisp
  (setq org-ellipsis "  ___**FOLDED**___")
#+end_src

*** Ask when deleting subtree
#+begin_src emacs-lisp
  (setq org-ctrl-k-protect-subtree "ask")
#+end_src

#+results:
: ask

** org-mime
[[http://orgmode.org/worg/org-contrib/org-mime.php]]
#+begin_src emacs-lisp
  (require 'org-mime)
  (add-hook 'message-mode-hook
            (lambda ()
              (local-set-key "\C-c\M-o" 'org-mime-htmlize)))
  
  (add-hook 'org-mode-hook
            (lambda ()
              (local-set-key "\C-c\M-o" 'org-mime-org-buffer-htmlize)))
#+end_src
** org-protocol
[[http://orgmode.org/worg/org-contrib/org-protocol.php]] 
#+begin_src emacs-lisp
  (server-start)
  (add-to-list 'load-path "~/.emacs.d/org-mode/lisp/")
  (require 'org-protocol)
#+end_src

** org-capture
  Set the keyboard shortcut and define the templates
#+begin_src emacs-lisp
    (define-key global-map "\C-cc" 'org-capture) 
    (setq org-capture-templates
          '(quote 
             (
              ("t" "Todo" entry (file+headline "~/Documents/orgfiles//notes.org" "Tasks") "* TODO %U %?%i %a") 
              ("j" "Journal" entry (file+headline "~/Documents/orgfiles//notes.org" "") "* %U %? %i %a")
              ("i" "Idea" entry (file+headline "~/Documents/orgfiles//notes.org" "New Ideas") "* %^{Title} %i %a") 
              ("r" "Reference Material" entry (file+headline "reference.org" "") "*%? %&%^g")
              ("x" "Message" entry (file+datetree (buffer-file-name (buffer-base-buffer))) "* MSG @ %U %?\n %a"))
             ))
#+end_src

** org-babel
*** Disable prompting for code execution
#+begin_src emacs-lisp
(setq org-confirm-babel-evaluate nil)
#+end_src

*** Set prompting for shell link execution
#+begin_src emacs-lisp
  (setq org-confirm-shell-link-function 'y-or-n-p)
#+end_src

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

*** Tangle with comments
#+begin_src emacs-lisp
  (setq org-babel-tangle-w-comments t)
  ;; (add-to-list 'org-babel-default-header-args:R '(:comments . "yes"))
#+end_src

*** Set :noweb per default to no
This is needed for plantuml
See manual "14.10 Noweb reference syntax" for details.
#+begin_src emacs-lisp
  (setq org-babel-default-header-args
        (cons '(:noweb . "no")
              (assq-delete-all :noweb org-babel-default-header-args)))
#+end_src

*** 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
**** Enable language execution
#+begin_src emacs-lisp
(require 'ob-sh)         ;; requires R and ess-mode
#+end_src
*** R
Enable language execution
#+begin_src emacs-lisp
  (require 'ob-R)         ;; requires R and ess-mode
#+end_src

*** COMMENT plantuml 
Further info can be find at http://eschulte.github.com/babel-dev/DONE-integrate-plantuml-support.html http://plantuml.sourceforge.net/
Enable language execution
#+begin_src emacs-lisp : tangle no
(require 'ob-plantuml)         ;; requires R and ess-mode
#+end_src
Set location where plantuml.jar is located
#+begin_src emacs-lisp :tangle no
(setq org-plantuml-jar-path
      (expand-file-name "~/.emacs.d/org-mode/contrib/scripts/plantuml.jar"))
#+end_src

*** LaTeX
Settings copied from http://orgmode.org/worg/org-contrib/babel/languages/org-babel-doc-LaTeX.php
**** Activate LaTeX Evaluation
#+begin_src emacs-lisp
(require 'ob-latex)
#+end_src
**** AucTeX
Strongly recommended for editing .tex files. Add the following line to .emacs: 
#+begin_src emacs-lisp
(add-to-list 'load-path "~/.emacs.d/auctex")
(load "auctex.el" nil t t)
#+end_src
*** Raise Noweb-type Errors
Add LaTeX to a list of languages that raise noweb-type errors
Edit the following example to include the languages you use in Org-babel
#+begin_src emacs-lisp
(setq org-babel-noweb-error-langs '("R" "latex"))
#+end_src

*** Set post-tangle-hook for R
This is an example on how to set the hook for loading R files via ess-load-file after tangling. This code should be copied into the .org file, to enable per-file setting of the hook.
#+begin_src emacs-lisp :results silent :tangle no
  (add-hook 'org-babel-post-tangle-hook
            (lambda () (ess-load-file (buffer-file-name))))
#+end_src

*** Enable fontified LaTeX listing exports. 
Set org-export-latex-listings to a non-nil value and make sure that the packages listings and color are loaded into LaTeX
#+begin_src emacs-lisp
  (setq org-export-latex-listings t)
  (require 'org-latex)
  (add-to-list 'org-export-latex-packages-alist '("" "listings"))
  (add-to-list 'org-export-latex-packages-alist '("" "color"))
#+end_src

*** org-babel-tangle-jump-to-org
#+begin_src emacs-lisp
  (defun org-babel-tangle-jump-to-org ()
  "Jump from a tangled code file to the related Org-mode file."
  (interactive)
  (let ((mid (point))
  target-buffer target-char
  start end link path block-name)
    (save-window-excursion
  (save-excursion
  (unless (and (re-search-backward org-bracket-link-analytic-regexp nil t)
  (setq start (point))
  (setq link (match-string 0))
  (setq path (match-string 3))
  (setq block-name (match-string 5))
  (re-search-forward (concat " " (regexp-quote block-name)
  " ends here[\n\r]") nil t)
  (setq end (point))
  (< start mid) (< mid end))
  (error "not in tangled code")))
  (when (string-match "::" path)
  (setq path (substring path 0 (match-beginning 0))))
  (find-file path) (setq target-buffer (current-buffer))
  (goto-char start) (org-open-link-from-string link)
  (if (string-match "[^ \t\n\r]:\\([[:digit:]]+\\)" block-name)
  (org-babel-next-src-block
  (string-to-int (match-string 1 block-name)))
  (org-babel-goto-named-src-block block-name))
  (setq target-char (point)))
  (pop-to-buffer target-buffer)
  (goto-char target-char)))
#+end_src

*** inhibits the insertion of blank lines on tangling
#+begin_src emacs-lisp
  (setq org-babel-tangle-pad-newline nil)
#+end_src

*** COMMENT add plantuml language mode
#+begin_src emacs-lisp :tangle no
  (add-to-list 'org-src-lang-modes '("plantuml" . fundamental))
#+end_src

** Org-mobile settings
#+begin_src emacs-lisp
  ; Set to the location of your Org files on your local system
  (setq org-directory "~/Documents/orgfiles")
  ;; Set to the name of the file where new notes will be stored
  (setq org-mobile-inbox-for-pull "~/Documents/orgfiles/flagged.org")
  ;; Set to <your Dropbox root directory>/MobileOrg.
  (setq org-mobile-directory "~/Dropbox/MobileOrg")
#+end_src

* Define screenshot function[[
/home/rkrug/.emacs.d/3534x4y.png]]
#+BEGIN_SRC emacs-lisp
  (defun my-screenshot ()
    "Take a screenshot into a unique-named file in the current buffer file directory and insert a link to this file."
    (interactive)
    (setq filename
          (concat
           (make-temp-name
            (file-name-directory (buffer-file-name))
            )
           ".png"
           )
          )
  
    (call-process "import" nil nil nil filename)
    (insert (concat "[[" filename "]]"))
    (org-display-inline-images)
    ) 
#+END_SRC

* COMMENT plantuml
** Load plantuml-mode
http://zhangweize.wordpress.com/2010/09/20/update-plantuml-mode/
#+begin_src emacs-lisp :tangle no
  (load-file "~/.emacs.d/site-lisp/plantuml-mode.el")
#+end_src

* COMMENT YASnippet
See [[http://yasnippet.googlecode.com/svn/trunk/doc/index.html]] for details
** Load and activate
#+begin_src emacs-lisp :tangle no
  (add-to-list 'load-path
                "~/.emacs.d/yasnippet")
  (require 'yasnippet) ;; not yasnippet-bundle
  (yas/initialize)
  (yas/load-directory "~/.emacs.d/yasnippet/snippets")
#+end_src
** Org-Mode Hook
Aome modifications (see [[http://eschulte.github.com/emacs-starter-kit/starter-kit-org.html]] for details.
#+begin_src emacs-lisp :tangle no
  (defun yas/org-very-safe-expand ()
   (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))   
#+end_src

#+begin_src emacs-lisp :tangle no
(add-hook 'org-mode-hook
          (lambda ()
            (local-set-key "\M-\C-n" 'outline-next-visible-heading)
            (local-set-key "\M-\C-p" 'outline-previous-visible-heading)
            (local-set-key "\M-\C-u" 'outline-up-heading)
            ;; table
            (local-set-key "\M-\C-w" 'org-table-copy-region)
            (local-set-key "\M-\C-y" 'org-table-paste-rectangle)
            (local-set-key "\M-\C-l" 'org-table-sort-lines)
            ;; yasnippet (using the new org-cycle hooks)
            (make-variable-buffer-local 'yas/trigger-key)
            (setq yas/trigger-key [tab])
            (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
            (define-key yas/keymap [tab] 'yas/next-field)
            ))
#+end_src 

* Color themes
** load color-theme package
load color-theme package
#+begin_src emacs-lisp
  (add-to-list 'load-path "~/.emacs.d/color-theme")
  (require 'color-theme)
  (eval-after-load "color-theme"
    '(progn
       (color-theme-initialize)
       (color-theme-hober)))
#+end_src
and initialize and load hober color theme
#+begin_src emacs-lisp
  (eval-after-load "color-theme"
    '(progn
       (color-theme-initialize)
       (color-theme-hober)))
#+end_src
** Cycle through loaded color themes
based on [[http://orgmode.org/worg/org-color-themes.php]]            
#+BEGIN_SRC emacs-lisp
  (add-to-list 'load-path "~/.emacs.d/color-themes")
  (setq color-theme-is-global t)
  (color-theme-initialize)
  
  ;;(load "color-theme-colorful-obsolescence")
  (load "color-theme-zenburn")
  (load "color-theme-tangotango")
  ;;(load "color-theme-railscast")
  (load "color-theme-sva")
  ;;(load "color-theme-folio")
  (load "color-theme-zenash")
  ;;(load "color-theme-manoj")
  ;;(load "color-theme-dark-emacs")
  ;;(load "color-theme-hober")
  
  (setq my-color-themes (list
    'color-theme-hober
    'color-theme-tangotango
    ;;'color-theme-colorful-obsolescence 
    'color-theme-zenburn
    'color-theme-sva 
    'color-theme-zenash
    ;;'color-theme-folio 
    ;;'color-theme-dark-emacs 
    ;;'color-theme-manoj 'color-theme-zenash
    ;;'color-theme-railscast
    ;;'color-theme-hober
  ))
  
  (defun my-theme-set-default () ; Set the first row
        (interactive)
        (setq theme-current my-color-themes)
        (funcall (car theme-current)))
  
      (defun my-describe-theme () ; Show the current theme
        (interactive)
        (message "%s" (car theme-current)))
  
     ; Set the next theme (fixed by Chris Webber - tanks)
      (defun my-theme-cycle ()            
        (interactive)
        (setq theme-current (cdr theme-current))
        (if (null theme-current)
        (setq theme-current my-color-themes))
        (funcall (car theme-current))
        (message "%S" (car theme-current)))
  
      (setq theme-current my-color-themes)
  (setq color-theme-is-global nil) ; Initialization
      (my-theme-set-default)
  (global-set-key [f4] 'my-theme-cycle)
#+END_SRC
* Mail
** Set user name and mail address
#+begin_src emacs-lisp
  (setq user-mail-address "Rainer@krugs.de")
  (setq user-full-name "Rainer M. Krug")
#+end_src
** Setup smtp for sending mail
Based on an email from Oscar Carlson: [[shell:xdg-open%20imap-message://R.M.Krug%40gmail.com@imap.googlemail.com/Lists/orgmode#13247][mail: {Orgmode} Re: Sending org buffer as mail?]]
#+begin_src emacs-lisp
  (setq message-send-mail-function 'smtpmail-send-it
        smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
        smtpmail-auth-credentials "~/.authinfo"
        smtpmail-default-smtp-server "smtp.gmail.com"
        smtpmail-smtp-server "smtp.gmail.com"
        smtpmail-smtp-service 587)
#+end_src


* Add message hook to include selected text as body
Thanks to Deniz Dogan ([[shell:xdg-open%20imap-message://R.M.Krug%40gmail.com@imap.googlemail.com/email/R.M.Krug@gmail.com#4468][mail: Create email with selected text as body?]])
#+begin_src emacs-lisp
  (add-hook 'message-mode-hook
            (lambda ()
              (let (text)
                (with-current-buffer (other-buffer)
                  (when (region-active-p)
                    (setq text
                          (buffer-substring (region-beginning)
                                            (region-end)))))
                (when text
                  (end-of-buffer)
                  (insert text)))))
#+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] 4+ messages in thread

* Re: [BABEL] [BUG] Property ":exports: both" ignored when exporting subtree
  2011-02-28 11:12   ` Rainer M Krug
@ 2011-03-01 17:38     ` Eric Schulte
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2011-03-01 17:38 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

>
> OK - further test:
>
> after an update this morning to Org-mode version 7.4
> (release_7.4.553.g83b7) even the export of the whole document top pdf,
> does not include the graphs. In contrast, when using 7.01g with the
> same emacs.org file, the export of the complete document includes the
> graphs, although on 7.01g, no subtree export does include an graph.
>

Hi Rainer,

So you want the Org-mode syntax text returned by R, to be interpreted as
Org-mode and then further processed by the latex exporter to convert the
"|name|[[./pdf1.pdf]]|" line into a latex table with an embedded graph?

In that case you should add the ":results raw" header argument to your
code block so that the results of the code block are not escaped.

Best -- Eric

>
> With Org-mode version 7.4 (release_7.4.553.g83b7), no export of any
> subtree included any graph.
>
> I attach my (longish) emacs.org file ant the init.el, but I do not
> think there is a problem in there.
>
> Cheers,
>
> Rainer
>
>
>>>
>>> Cheers,
>>>
>>> Rainer
>>>
>>> * Her it does not work
>>> :PROPERTIES:
>>> :tangle: no
>>> :results: output org
>>> :exports: both
>>> :END:
>>> ** R code graph
>>> #+begin_src R
>>>   pdf("pdf1.pdf")
>>>   plot(runif(100))
>>>   dev.off()
>>>
>>>   cat(
>>>       "\n|--|--|\n",
>>>       "|name|[[./pdf1.pdf]]|\n",
>>>       "|--|--|\n"
>>>       )
>>> #+end_src
>>>
>>>
>>> * Here it works
>>> :PROPERTIES:
>>> :tangle: no
>>> :results: output org
>>> :exports: both
>>> :END:
>>> ** R code graph
>>> #+begin_src R :exports both
>>>   pdf("pdf1.pdf")
>>>   plot(runif(100))
>>>   dev.off()
>>>
>>>   cat(
>>>       "\n|--|--|\n",
>>>       "|name|[[./pdf1.pdf]]|\n",
>>>       "|--|--|\n"
>>>       )
>>> #+end_src
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-01 17:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-25 16:15 [BABEL] [BUG] Property ":exports: both" ignored when exporting subtree Rainer M Krug
2011-02-27 21:24 ` Eric Schulte
2011-02-28 11:12   ` Rainer M Krug
2011-03-01 17:38     ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).