Navigation
Most Visited HowTos
This is the place where I write down emacs commands and tricks that I often need and often forget. It is not sorted in any way, and of course, it is not complete.
This is to have my .emacs accessible from everywhere.
;; ----- Default .emacs ------ (setq user-mail-address "foo@bar") (setq user-full-name "Foo Bar") ;; look and feel (setq inhibit-startup-screen t) (transient-mark-mode -1) (tool-bar-mode -1) (line-number-mode 1) (column-number-mode 1) (setq text-mode-hook 'turn-on-auto-fill) (setq tab-width 4) (setq uniquify-buffer-name-style 'forward) (ido-mode 'buffer) (setq ido-enable-flex-matching t) ;; colors (global-font-lock-mode 1) ;; always syntax color (add-to-list 'default-frame-alist '(background-color . "White")) (add-to-list 'default-frame-alist '(foreground-color . "Black")) (add-to-list 'default-frame-alist '(cursor-color . "Blue")) (add-to-list 'default-frame-alist '(border-color . "DimGray")) ;; compilation (setq compilation-window-height 8) (setq compilation-scroll-output 'first-error) (global-set-key [(control c) (c)] 'compile-again) ;; keyboard shortcuts (global-set-key [(f9)] 'recompile) (global-set-key [(f12)] 'ibuffer) (global-set-key "\M-t" 'toggle-truncate-lines) (global-set-key [(mouse-6)] 'windmove-left) (global-set-key [(mouse-7)] 'windmove-right) (global-set-key [(mouse-8)] 'windmove-down) (global-set-key [(mouse-9)] 'windmove-up) (global-set-key (kbd "\C-x C-<left>") 'windmove-left) (global-set-key (kbd "\C-x C-<right>") 'windmove-right) (global-set-key (kbd "\C-x C-<down>") 'windmove-down) (global-set-key (kbd "\C-x C-<up>") 'windmove-up) (require 'org) ;; org mode stuff (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) (setq org-clock-persist t) ; (org-clock-persistence-insinuate) ;; latex mode stuff (add-hook 'latex-mode-hook 'flyspell-mode) (add-hook 'TeX-mode-hook 'flyspell-mode) (add-hook 'latex-mode-hook 'reftex-mode) ;; c mode stuff (require 'cc-mode) (add-hook 'c-mode-common-hook (lambda () (subword-mode 1))) (defun my-c-mode-common-hook () (c-set-style "linux") (setq c-basic-offset 4) (setq tab-width 4) (c-set-offset 'substatement-open 0) (c-set-offset 'innamespace 0) (setq c-hungry-delete-key 1) (toggle-truncate-lines) (define-key c-mode-base-map "\C-m" 'c-context-line-break) ) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) ;; desktop-save (setq desktop-save 'if-exists) (desktop-save-mode 1) (setq desktop-globals-to-save (append '((extended-command-history . 30) (file-name-history . 100) (grep-history . 30) (compile-history . 30) (minibuffer-history . 50) (query-replace-history . 60) (read-expression-history . 60) (regexp-history . 60) (regexp-search-ring . 20) (search-ring . 20) (shell-command-history . 50) tags-file-name register-alist))) ;; custom functions (defun german-mode () (interactive) (ispell-change-dictionary "de-neu") ) (defun fullscreen (&optional f) (interactive) (set-frame-parameter f 'fullscreen (if (frame-parameter f 'fullscreen) nil 'fullboth))) (global-set-key [f11] 'fullscreen) (add-hook 'after-make-frame-functions 'fullscreen) (setq auto-mode-alist (cons '("\\.h$" . c++-mode) auto-mode-alist)) (autoload 'octave-mode "octave-mode" nil t) (setq auto-mode-alist (cons '("\\.m$" . octave-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("SConstruct" . python-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("SConscript" . python-mode) auto-mode-alist)) ;; templates (require 'autoinsert) (auto-insert-mode) ;;; Adds hook to find-files-hook (setq auto-insert-directory "~/Templates/") ;;; Trailing slash important (setq auto-insert-query nil) ;;; do not prompt (define-auto-insert "\.org" "org-template.org") ;; FRL (feature request list) syntax highlighting (require 'generic-x) (define-generic-mode 'frl-mode '("#") '("//name" "//depends" "//description" "//long" "//break" "//done" "//progress" "//actual-time" "//time") '(("md" . 'font-lock-buildin) ("mm" . 'font-lock-buildin) ("my" . 'font-lock-builtin)) '("\\.frl$") nil "A mode for frl (feature request list) files" ) ;; ----- local customization ------