emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rainer M Krug <r.m.krug@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: BUG: Newest org-mode interferes with desktop save
Date: Wed, 15 Jun 2011 20:21:30 +0200	[thread overview]
Message-ID: <BANLkTin1hENotQRzHfE-Wcx3K=y=THZvOYWXz6XCQm3zP50S6g@mail.gmail.com> (raw)
In-Reply-To: <87y613uj2x.fsf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2329 bytes --]

On Wed, Jun 15, 2011 at 6:49 PM, Eric Schulte <schulte.eric@gmail.com>wrote:

> Hi Rainer,
>
> I was able to reproduce this query-on-close behavior with the following
> minimal config.
>
> #+begin_src sh
>  emacs -Q -l ~/.emacs.d/src/org/lisp/org.el --eval "(desktop-save-mode 1)"
> #+end_src
>
> however, I think this prompting behavior is expected, and when I
> switched to the following alternative
>
> #+begin_src sh
>  emacs -Q -l ~/.emacs.d/src/org/lisp/org.el --eval '(desktop-read
> "~/Desktop/")'
> #+end_src
>
> I received no prompt on exit.  As far as I can tell there is not an
> Org-mode bug here, however I could very well have missed something.
>

I can not reproduce your example, as I am getting an "can not open
org-entities", but have you tried it with org-mode 7.5 as well as the newest
git? My point is, that up to a recent git version (probably yesterday), this
question was *not* there, but it is there at with the newest git version.

I agree, that emacs should ask where to save if there is no .emacs.desktop
 if where to save the desktop file, but the final question

"Current desktop was not loaded from a file. Overwrite this desktop file?"

(which I did not see in your example) should not be there as the desktop
file was definitely loaded. I attache my emacs.org file for reference.

Hope this clarifies the issue,
Rainer


> Cheers -- Eric
>
> Rainer M Krug <r.m.krug@gmail.com> writes:
>
> > Hi
> >
> > when using the newest version of org-mode (Org-mode version 7.5
> > (release_7.5.391.gfacc)), I get the following warning when closing emacs,
> >
> > "Current desktop was not loaded from a file. Overwrite this desktop
> file?"
> >
> > although it has loaded the desktop file. When I use 7.5 (and te one from
> I
> > guess yesterday), the message did not occur.
> >
> > I have (desktop-save-mode 1) on my emacs.org.
> >
> >
> > Cheers,
> >
> > Rainer
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte/
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

[-- Attachment #1.2: Type: text/html, Size: 3451 bytes --]

[-- Attachment #2: emacs.org --]
[-- Type: application/octet-stream, Size: 42920 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 

#+LATEX_HEADER: \usepackage[landscape, top=0.5in,bottom=0.5in,left=0.75in,right=0.75in]{geometry}

* 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
* R-autoyas
R-autoyas is a small ESS complement. It provides automatically created yasnippets for R function argument lists.
Watch the demo screencast: http://www.youtube.com/watch?v=jLJPorf2LBE
Details can be found [[http://www.svenhartenstein.de/Software/R-autoyas/]].
** COMMENT Loading and Key bindings
#+begin_src emacs-lisp :tangle no
  (add-hook 'ess-mode-hook
            '(lambda ()
               (load "~/.emacs.d/plugins/r-autoyas.el")))
  (define-key ess-mode-map (kbd "C-M-<tab>")
    '(lambda ()(interactive)
       (r-autoyas-expand nil nil)))
#+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 to 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
** COMMENT Calling R-autoyas whenever "(" is typed in 
#+begin_src emacs-lisp :tangle no
  (define-key ess-mode-map (kbd "(") '(lambda () (interactive)
                                        (skeleton-pair-insert-maybe nil)
                                        (r-autoyas-expand nil t)))
#+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

*** Disable tab in source block
To enable, set to non-nil value
#+begin_src emacs-lisp
  (setq org-src-tab-acts-natively nil)
#+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 " ... ... >")     
  (setq org-ellipsis "〖 ✎ 〗")
#+end_src

#+results:
:  ... ... >

*** 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
        `(
          ;; ("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")
  ;; ;;;;;;;;;;;;;;;;;;
  ;;        ("gt" 
  ;;         "Global Todo" 
  ;;         entry 
  ;;         (file+headline "~/Documents/orgfiles/notes.org" "Tasks") 
  ;;         "* TODO %U
  ;; %?
  ;; %i
  ;; %a"
  ;;         )
  ;; ;;;;;;;;;;;;;;;;;;
  ;;         ("J"
  ;;          "Global Journal" 
  ;;          entry 
  ;;          (file+headline "~/Documents/orgfiles/notes.org" "") 
  ;;          "* %U %?
  
  ;;   %i
  ;;   %a"
  ;;          ) 
  ;; ;;;;;;;;;;;;;;;;;;
  ;;         ("I"
  ;;          "Global Idea" 
  ;;          entry 
  ;;          (file+headline "~/Documents/orgfiles/notes.org" "New Ideas") 
  ;;          "* %^{Title}
  ;;   %i
  ;;   %a"
  ;;          ) 
  ;; ;;;;;;;;;;;;;;;;;;
  ;;         ("R" 
  ;;          "Global Reference Material" 
  ;;          entry 
  ;;          (file+headline "~/Documents/orgfiles/notes.org" "Reference")
  ;;          "*%? %&%^g"
  ;;          ) 
  ;; ;;;;;;;;;;;;;;;;;;
          ("p" 
           "Problem to be logged in buffer" 
           entry 
          (file+headline (buffer-file-name) "QUESTIONS")
           "* %?
  - file     :: %(buffer-file-name (org-capture-get :original-buffer))
  - revision :: %(symbol-name (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 in buffer" 
           entry
          (file+headline (buffer-file-name) "CHANGES")
           "* %T %? 
  - file     :: %(buffer-file-name (org-capture-get :original-buffer))
  - revision :: %(symbol-name (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"
           )
  ;;;;;;;;;;;;;;;;;;
  ;;         ("t" 
  ;;          "TODO to be logged in buffer" 
  ;;          entry
  ;;         (file+headline (buffer-file-name) "TODO")
  ;;          "* %T %? 
  ;; - file     :: %(buffer-file-name (org-capture-get :original-buffer))
  ;; - revision :: %(symbol-name (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"
  ;;          )
  ;;;;;;;;;;;;;;;;;;
          )
        )
  
#+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

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

** org-html5-presentation
#+begin_src emacs-lisp
  (require 'org-html5presentation)
#+end_src
* Define screenshot function
#+BEGIN_SRC emacs-lisp
  (defun org-screenshot ()
    "Take a screenshot into a time stamped unique-named file in the same directory as the org-buffer and insert a link to this file."
    (interactive)
    (setq filename
          (concat
           (make-temp-name
            (concat (buffer-file-name)
                    "_"
                    (format-time-string "%Y%m%d_%H%M%S_")) ) ".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 :tangle no
  (eval-after-load "color-theme"
    '(progn
       (color-theme-initialize)
       (color-theme-hober)))
#+end_src
** COMMENT Cycle through loaded color themes
based on [[http://orgmode.org/worg/org-color-themes.php]]            
#+BEGIN_SRC emacs-lisp :tangle no
  (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

* tabbar
http://www.emacswiki.org/emacs/TabBarMode and http://www.emacswiki.org/emacs/tabbar.el
** load tabbar
#+begin_src emacs-lisp
  (require 'tabbar)
  (tabbar-mode)
#+end_src
(setq tabbar-buffer-groups-function
          (lambda ()
            (list "All"))) ;; code by Peter Barabas
** All tabs in one group
#+begin_src emacs-lisp
  ;; (setq tabbar-buffer-groups-function
  ;;       (lambda ()
  ;;         (list "All"))) ;; code by Peter Barabas
#+end_src
* notmuch mail thingy
#+begin_src emacs-lisp
  (add-to-list 'load-path "~/share/emacs/site-lisp")
  (require 'notmuch)
#+end_srcpd



  parent reply	other threads:[~2011-06-15 18:21 UTC|newest]

Thread overview: 217+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 10:29 BUG: Newest org-mode interferes with desktop save Rainer M Krug
2011-06-15 16:49 ` Eric Schulte
2011-06-15 17:35   ` Nick Dokos
2011-06-15 18:23     ` Rainer M Krug
2011-06-15 18:21   ` Rainer M Krug [this message]
2011-06-15 18:31     ` Eric Schulte
2011-06-15 18:59       ` Rainer M Krug
2011-06-15 22:40         ` Nick Dokos
2011-06-16  7:15           ` Rainer M Krug
2011-06-16  7:29             ` Jambunathan K
2011-06-16  8:22               ` Rainer M Krug
  -- strict thread matches above, loose matches on Subject: below --
2013-03-19 21:40 python sessions Gary Oberbrunner
2013-03-20  0:04 ` John Hendy
2013-03-20  3:07   ` Nick Dokos
2013-03-20  6:44     ` Andreas Röhler
2013-03-20 12:54       ` Ista Zahn
2013-03-20 14:08         ` Nick Dokos
2013-03-20 14:28           ` Gary Oberbrunner
2013-03-20 17:21         ` Andreas Röhler
2013-03-20  7:08   ` Andreas Röhler
2013-03-20 15:38     ` John Hendy
2013-03-20 15:42       ` John Hendy
2013-03-20 16:06       ` Nick Dokos
     [not found]         ` <CAFChFygsUeBejEY6m2bSU0C5cjLYz0nUADH=s+BYxajfZ2sKKQ@mail.gmail.com>
2013-03-20 16:12           ` Fwd: " Gary Oberbrunner
2013-03-20 17:08         ` Andreas Röhler
2013-03-20 17:25           ` Nick Dokos
2013-03-20 17:54             ` John Hendy
2013-03-20 18:15               ` Nick Dokos
2013-03-20 18:32                 ` Ista Zahn
2013-03-20 18:39                   ` Nick Dokos
2013-03-20 18:43                   ` Andreas Röhler
2013-03-20 19:42                     ` Ista Zahn
2013-03-20 19:53                       ` Andreas Röhler
2013-03-20 20:12                         ` Ista Zahn
2013-03-20 20:25                           ` Gary Oberbrunner
2013-03-20 22:06                             ` Ista Zahn
2013-03-20 18:42                 ` Andreas Röhler
2013-03-20 19:01             ` Andreas Röhler
     [not found]       ` <CAFChFygPrhuHHyMo2Vk2_OdksWVB=oACA7jnOXN+itUNqh-nqw@mail.gmail.com>
     [not found]         ` <CA+M2ft9bO7DU61vVeYrhduVvkg1V6PMuiyvsOy5tNWuXcSUEpw@mail.gmail.com>
     [not found]           ` <CAFChFyhbeXE4HNLKA6Ubii+MtQwD7=4khAypa+--coZrQiJekA@mail.gmail.com>
2013-03-21  1:22             ` Gary Oberbrunner
2013-03-21  1:54               ` John Hendy
2013-03-21  1:56                 ` Gary Oberbrunner
2013-03-21  7:42                   ` Andreas Röhler
2013-03-21  7:43                     ` Bastien
2013-03-21  8:13                       ` Andreas Röhler
2013-03-23 22:07                         ` Eric Schulte
2013-03-24  1:29                           ` John Hendy
2013-03-24 22:59                             ` Eric Schulte
2013-03-25  2:38                               ` Nick Dokos
2013-03-25  2:59                                 ` John Hendy
2013-03-25  6:34                                   ` Andreas Röhler
2013-03-25 15:40                                   ` Eric Schulte
2013-03-25 15:55                                     ` John Hendy
2013-03-25 16:07                                       ` Eric Schulte
2013-03-25 16:41                                         ` Nick Dokos
2013-03-25 16:01                                     ` Ista Zahn
2013-03-25 16:23                                       ` John Hendy
2013-03-25 16:43                                         ` Eric Schulte
2013-03-25 17:27                                           ` Andreas Röhler
2013-03-25 17:41                                             ` John Hendy
2013-03-25 18:16                                               ` Ista Zahn
2013-03-25 19:30                                             ` Ivan Andrus
2013-03-24  7:47                           ` Andreas Röhler
2013-03-24 14:47                             ` John Hendy
2013-03-24 15:30                               ` Andreas Röhler
2013-03-24 16:58                               ` Nick Dokos
2013-03-24 16:59                                 ` John Hendy
2013-03-24 18:41                                   ` Nick Dokos
2013-03-25 20:46                                     ` Andreas Röhler
2013-03-25 21:37                                       ` Eric Schulte
2013-03-26  6:29                                         ` Andreas Röhler
2013-03-26 12:32                                           ` Eric Schulte
2013-03-26 21:41                                             ` Gary Oberbrunner
2013-03-26 21:47                                               ` John Hendy
2013-03-27  6:19                                               ` Andreas Röhler
2013-03-30  7:19                                                 ` Andreas Röhler
2012-10-31  6:12 Bug? R: Org babel block execution *drastically* slower than in ESS session directly John Hendy
2012-10-31 16:41 ` cberry
2012-10-31 17:18   ` John Hendy
2012-10-31 20:12     ` cberry
2012-10-31 20:23       ` John Hendy
2012-10-31 20:56         ` Thomas S. Dye
2012-10-31 23:00           ` Nick Dokos
2012-10-31 22:53         ` Nick Dokos
2012-11-01 14:53           ` John Hendy
2012-11-01 15:38             ` Nick Dokos
2012-11-01 18:17               ` John Hendy
2012-11-01 18:18               ` John Hendy
2012-11-01 18:48                 ` Nick Dokos
2012-11-14  3:27                   ` Aaron Ecay
2012-11-14  4:52                     ` John Hendy
2012-11-14  6:32                       ` Aaron Ecay
2012-11-14  8:28                         ` Thomas S. Dye
2012-11-14  8:35                           ` Andreas Leha
2012-11-16 15:45                             ` Eric Schulte
2012-11-16 17:47                               ` Andreas Leha
2012-11-16 19:00                                 ` John Hendy
2012-11-16 20:25                                 ` Achim Gratz
2012-11-17 17:12                                   ` Eric Schulte
2012-11-18  0:41                               ` Aaron Ecay
2012-11-18  0:57                                 ` Eric Schulte
2012-11-18  1:41                                   ` Aaron Ecay
2012-11-19  1:18                                     ` Eric Schulte
2012-11-19  5:11                                       ` Eric Schulte
2012-08-26 20:11 Alternate format for datetree c b
2012-08-27  1:16 ` John Hendy
2012-08-27  4:04   ` Nick Dokos
2012-08-27  6:08     ` John Hendy
2012-08-28  8:49       ` Ian Barton
2012-08-28 12:49         ` Nick Dokos
2012-08-28 12:50         ` Nick Dokos
2012-08-29  7:49           ` Ian Barton
     [not found]             ` <lists@manor-farm.org>
2012-08-29 14:17               ` Nick Dokos
2012-08-29 14:25             ` John Hendy
2012-08-29 20:01               ` Ian Barton
2012-09-06  7:46                 ` Ian Barton
2012-09-06  5:42       ` c b
2012-09-06  6:26         ` Nick Dokos
2012-09-06  7:00         ` Jambunathan K
2012-09-06 15:33         ` John Hendy
2012-09-06 16:08           ` Jonathan Leech-Pepin
2011-11-02  2:22 Pass LaTeX exporter option prior to \documentclass John Hendy
2011-11-02  2:43 ` suvayu ali
2011-11-02 10:30   ` suvayu ali
2011-11-03 17:48     ` John Hendy
2011-11-03 17:55       ` suvayu ali
2011-11-03 18:07         ` John Hendy
2011-11-04 17:29           ` Nick Dokos
2011-11-04 19:29             ` suvayu ali
2011-10-19 14:54 Prompt for time when clocking in? Nathan Neff
2011-10-19 15:12 ` John Hendy
2011-10-19 15:35   ` Nick Dokos
2011-10-20 16:15     ` Nathan Neff
2011-10-20 17:09       ` Nick Dokos
2011-10-20 17:44         ` Nathan Neff
2011-10-19 16:37 ` Bernt Hansen
2011-08-05 22:15 Handling errors in command line exporting of agenda? John Hendy
2011-08-05 23:34 ` suvayu ali
2011-08-05 23:35   ` suvayu ali
2011-08-08 18:12   ` John Hendy
2011-08-08 18:28     ` suvayu ali
2011-08-08 18:53       ` John Hendy
2011-08-08 18:59         ` suvayu ali
2011-08-08 19:48           ` John Hendy
2011-08-08 20:22             ` suvayu ali
2011-08-08 20:31               ` John Hendy
2011-08-08 20:33               ` Nick Dokos
2011-08-08 20:37             ` Nick Dokos
2011-08-08 20:54               ` John Hendy
2011-08-08 21:09                 ` Nick Dokos
2011-08-08 21:27                   ` John Hendy
2011-08-08 21:30               ` suvayu ali
2011-08-08 22:17                 ` Nick Dokos
2011-08-08 21:46             ` suvayu ali
2011-05-24 15:54 Passing font size to exported LaTeX table John Hendy
2011-05-24 16:44 ` Sebastien Vauban
2011-05-24 18:57   ` John Hendy
2011-05-24 19:25     ` Nick Dokos
2011-05-24 19:31       ` John Hendy
2011-05-24 19:58         ` Thomas S. Dye
2011-05-24 20:42           ` Nick Dokos
2011-05-24 21:12             ` Nick Dokos
2011-05-24 21:19               ` Nick Dokos
2011-05-25  7:22                 ` Thomas S. Dye
2011-05-27  0:58                   ` suvayu ali
2011-05-27  6:46                     ` Thomas S. Dye
2011-05-27  7:07                       ` suvayu ali
2011-05-27 16:17                         ` Thomas S. Dye
2011-05-27 16:50                           ` Suvayu Ali
2011-05-27 17:37                             ` Thomas S. Dye
2011-05-27 18:30                               ` Suvayu Ali
2011-05-27 21:25                                 ` Thomas S. Dye
2011-05-28  7:17                                   ` Sebastien Vauban
2011-05-28 10:14                                     ` Suvayu Ali
2011-05-28 15:21                                       ` Nick Dokos
2011-05-28 18:10                                         ` Suvayu Ali
2011-06-01 18:50                                   ` Nick Dokos
2011-06-01 19:08                                     ` Suvayu Ali
2011-06-10 22:31                                       ` Suvayu Ali
2011-06-13  1:38                                         ` suvayu ali
2011-06-13  1:52                                         ` Nick Dokos
2011-06-13  2:40                                           ` Suvayu Ali
2011-06-13  3:29                                             ` Nick Dokos
2011-06-13  3:45                                           ` Thomas S. Dye
2011-06-13  4:27                                             ` Nick Dokos
2011-06-13  4:56                                               ` Suvayu Ali
2011-06-13  5:29                                                 ` Nick Dokos
2011-06-13  6:42                                                   ` Suvayu Ali
2011-05-24 20:06         ` Nick Dokos
2011-05-24 19:42       ` Sebastien Vauban
2010-08-21 19:30 Gnuplot unevenly spaced non-numeric data plot? John Hendy
2010-08-21 20:35 ` Eric S Fraga
2010-08-21 20:41 ` Nick Dokos
2010-08-21 21:11   ` John Hendy
2010-08-21 22:41     ` John Hendy
2010-08-21 23:17       ` Nick Dokos
2010-08-23 14:22         ` John Hendy
2010-08-23 15:16           ` Nick Dokos
     [not found]             ` <AANLkTi=WTLBL1Giq0GTrjCo-A1s=iP4u1Qxn57cH-xnB@mail.gmail.com>
     [not found]               ` <AANLkTimSVm=-2o39CQ9wSMT276Dee4Tuj9jLKJH-c+cd@mail.gmail.com>
2010-08-24  2:44                 ` [For Worg?] " John Hendy
2010-08-24  5:25                   ` suvayu ali
2010-08-24  5:56               ` Nick Dokos
2010-08-25  0:32                 ` Eric Schulte
2010-08-25  1:06                   ` John Hendy
2010-08-25  1:35                     ` Eric Schulte
2010-08-25 18:38                       ` John Hendy
2010-08-25 18:52                         ` Eric Schulte
     [not found]         ` <jw.hendy@gmail.com>
2012-03-12 21:13           ` Beamer specific setupfile? John Hendy
2012-03-12 21:48             ` Nick Dokos
2012-03-12 22:09               ` John Hendy
2012-03-12 22:30                 ` Nick Dokos
2012-03-12 22:44                   ` Nick Dokos
2012-03-13  5:02                     ` John Hendy
2012-03-13  5:46                       ` Nick Dokos
2012-04-25  8:16                         ` Eric Fraga
2012-04-25  8:59                           ` Eric Fraga
2012-03-12 23:01                 ` Nick Dokos
2012-03-12 21:51             ` Nick Dokos
2012-03-12 22:05             ` Nick Dokos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTin1hENotQRzHfE-Wcx3K=y=THZvOYWXz6XCQm3zP50S6g@mail.gmail.com' \
    --to=r.m.krug@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).