Skip to content

Latest commit

 

History

History
executable file
·
179 lines (147 loc) · 5.96 KB

starter-kit-org.org

File metadata and controls

executable file
·
179 lines (147 loc) · 5.96 KB

Starter Kit Org

This is part of the Emacs Starter Kit.

Starter Kit Org

Configuration for the eminently useful Org Mode.

Org-mode is for keeping notes, maintaining ToDo lists, doing project planning, and authoring with a fast and effective plain-text system. Org Mode can be used as a very simple folding outliner or as a complex GTD system or tool for reproducible research and literate programming.

For more information on org-mode check out worg, a large Org-mode wiki which is also implemented using Org-mode and git.

Exporter Settings and Helpful Packages

HTML and LaTeX exporters are shown by default. We add the Markdown exporter to the menu.

;; Autocomplete for orgmode
;;  Disable these, as they are causing org-capture to hang when I try to use sections.
;;(require 'org-ac)
;;(org-ac/config-default)

;; Markdown exporter
(require 'ox-md)

(setq org-completion-use-ido t)
;; (require 'org-special-blocks)
;; (if window-system (require 'org-mouse))

;; Compatibility with WindMove
;; Make windmove work in org-mode:
(add-hook 'org-shiftup-final-hook 'windmove-up)
(add-hook 'org-shiftleft-final-hook 'windmove-left)
(add-hook 'org-shiftdown-final-hook 'windmove-down)
(add-hook 'org-shiftright-final-hook 'windmove-right)
;; (if window-system (require 'org-mouse))

Org-Mode Hooks

Make yasnippet work properly with org-mode.

;;  (defun yas/org-very-safe-expand ()
;;    (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))

(defun yas-org-very-safe-expand ()
  (let ((yas-fallback-behavior 'return-nil))
    (and (fboundp 'yas-expand) (yas-expand))))

(add-hook 'org-mode-hook
          (lambda ()
            (add-to-list 'org-tab-first-hook
                         'yas-org-very-safe-expand)
            ))
(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)
            ;; display images
            (local-set-key "\M-I" 'org-toggle-iimage-in-org)
            ;; 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)
            ))

Speed keys

Speed commands enable single-letter commands in Org-mode files when the point is at the beginning of a headline, or at the beginning of a code block.

See the org-speed-commands-default variable for a list of the keys and commands enabled at the beginning of headlines. All code blocks are available at the beginning of a code block, the following key sequence C-c C-v h (bound to org-babel-describe-bindings) will display a list of the code blocks commands and their related keys.

DISABLED, already set in starter-kit-gtd.org.

(setq org-use-speed-commands t)

Code blocks

This activates a number of widely used languages, you are encouraged to activate more languages using the customize interface for the org-babel-load-languages variable, or with an elisp form like the one below. The customize interface of org-babel-load-languages contains an up to date list of the currently supported languages.

DISABLED, will take list from starter-kit-gtd.org.

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (sh . t)
   (R . t)
   (perl . t)
   (ruby . t)
   (python . t)
   (js . t)
   (haskell . t)))

The next block makes org-babel aware that a lower-case ‘r’ in a src block header should be processed as R.

(add-to-list 'org-src-lang-modes
             '("r" . ess-mode))

Code block fontification

The following displays the contents of code blocks in Org-mode files using the major-mode of the code. It also changes the behavior of TAB to as if it were used in the appropriate major mode. This means that reading and editing code form inside of your Org-mode files is much more like reading and editing of code using its major mode.

;;  This is set in starter-kit-org.org
;;  (setq org-src-fontify-natively t)
  (setq org-src-tab-acts-natively t)

Don’t ask for confirmation on every C-c C-c code-block compile.

DISABLED already set in starter-kit-gtd.org.kit

(setq org-confirm-babel-evaluate nil)

Ensure the Latest Org-mode manual is in the info directory

By placing the doc/ directory in Org-mode at the front of the Info-directory-list we can be sure that the latest version of the Org-mode manual is available to the info command (bound to C-h i).

(unless (boundp 'Info-directory-list)
  (setq Info-directory-list Info-default-directory-list))
(setq Info-directory-list
      (cons (expand-file-name
             "doc"
             (expand-file-name
              "org"
              (expand-file-name "src" dotfiles-dir)))
            Info-directory-list))

Nice Bulleted Lists

(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
(message "Starter Kit Org loaded.")