* Re: Re: svn version number as tag or property?
2010-09-01 20:33 ` Achim Gratz
@ 2010-09-02 8:41 ` Rainer M Krug
2010-09-02 9:21 ` Noorul Islam K M
0 siblings, 1 reply; 10+ messages in thread
From: Rainer M Krug @ 2010-09-02 8:41 UTC (permalink / raw)
To: Achim Gratz; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2614 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/09/10 22:33, Achim Gratz wrote:
> Rainer M Krug <r.m.krug@gmail.com> writes:
>
>> Hm - I can't find that command (I assume it is a function)? And if how
>> can I get the file name of the buffer?
>
> Yes, an elisp function. You either already know the name of the file
> and insert it as a string or just use another elisp function to ask
> EMACS for it. Then instead of running a shell script (which you said
> you wanted to avoid) you'll get this information from EMACS.
Yes - that is exactly what I want to do. But I don't have that function
and svn is working from emacs. I have the following functions beginning
with vc-:
Possible completions are:
vc-annotate vc-create-tag
vc-delete-file vc-diff
vc-dir vc-finish-logentry
vc-git-grep vc-git-log-view-mode
vc-git-stash vc-git-stash-apply
vc-git-stash-apply-at-point vc-git-stash-delete-at-point
vc-git-stash-menu vc-git-stash-pop
vc-git-stash-pop-at-point vc-git-stash-show
vc-git-stash-show-at-point vc-git-stash-snapshot
vc-insert-headers vc-merge
vc-mode-line vc-next-action
vc-print-log vc-print-root-log
vc-register vc-rename-file
vc-resolve-conflicts vc-retrieve-tag
vc-revert vc-revert-buffer
vc-revert-buffer-internal vc-revision-other-window
vc-rollback vc-root-diff
vc-svn-log-view-mode vc-switch-backend
vc-toggle-read-only vc-update
vc-update-change-log vc-version-diff
Is there anything I have to load into emacs (GNU Emacs 23.2.1
(i686-pc-linux-gnu, GTK+ Version 2.20.1) to get that commad?
Attached please find for reference my emacs.org file.
Cheers,
Rainer
>
>
> Achim.
>
>
> _______________________________________________
> 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
- --
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
Tel: +33 - (0)9 53 10 27 44
Cell: +27 - (0)8 39 47 90 42
Fax (SA): +27 - (0)8 65 16 27 82
Fax (D) : +49 - (0)3 21 21 25 22 44
Fax (FR): +33 - (0)9 58 10 27 44
email: Rainer@krugs.de
Skype: RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkx/Y0AACgkQoYgNqgF2egr1vwCbBV5Xu8njL/fzfgMOKqJ51dsX
iZYAniQXmNkkQalXE+4ETcyBFZGCy6gg
=AQpb
-----END PGP SIGNATURE-----
[-- Attachment #2: emacs.org --]
[-- Type: text/plain, Size: 28036 bytes --]
#+TITLE: .emacs file
#+OPTIONS: toc:nil num:nil ^:nil
* General settings
** Save desktop
#+begin_src emacs-lisp
(desktop-save-mode 1)
#+end_src
** COMMENT Autosave desktop every hour
#+begin_src emacs-lisps
(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 CEDET
See cedet/common/cedet.info for configuration details.
#+begin_src emacs-lisps
(add-to-list 'load-path "~/.emacs.d/cedet")
(load-file "~/.emacs.d/cedet/common/cedet.el")
#+end_src
Optional other options
#+begin_src emacs-lisps
;; 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-lisps
(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)
(font-lock-add-keywords 'ess-mode
#+end_src
** Add highlighting for certain keywords
#+begin_src emacs-lisp
'(("\\<\\(FIXME\\|TODO\\|COMMENT\\|DONE\\|CHANGES\\|FIXED\\)\\>" 1 font-lock-warning-face prepend)))
#+end_src
** Further customisations
#+begin_src emacs-lisp
(setq inferior-R-args "--vanilla")
(setq ess-eval-visibly-p nil)
(setq inferior-ess-same-window t)
(setq inferior-ess-client-command "Initial")
(setq inferior-ess-own-frame nil)
(setq ess-ask-for-ess-directory nil)
#+end_src
** Make html help in R default
#+begin_src emacs-lisp
(setq inferior-ess-r-help-command "help(\"%s\", help_type=\"html\")\n")
#+end_src
** r-utils
#+begin_src emacs-lisp
(require 'r-utils)
#+end_src
** 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
** 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-lisps
(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
* COMMENT Graphviz
Load graphviz-dot-mode
#+begin_src emacs-lisps
(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-lisps
(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
(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-lisps
(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
* load color-theme-hober
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
* 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
** 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"))
))
#+end_src
** org-babel
*** Disable prompting for code execution
#+begin_src emacs-lisp
(setq org-confirm-babel-evaluate nil)
#+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
*** 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
(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
** COMMENT Org-mobile settinge --- disabled
#+begin_src emacs-lisps
(setq org-mobile-directory "/scpc:rmkrug@webdav.mydrive.ch:org/")
#+end_src
[-- Attachment #3: 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] 10+ messages in thread