Skip to content

Instantly share code, notes, and snippets.

@ptrv
Created December 7, 2009 12:15
Show Gist options
  • Save ptrv/250791 to your computer and use it in GitHub Desktop.
Save ptrv/250791 to your computer and use it in GitHub Desktop.
emacs configuration file on linux
;; Manually set PATH for use by eshell, rspec-mode, etc.
(let ((path))
(setq path (concat "~/bin:"
"/usr/local/sbin:"
"/usr/local/bin:"
"/usr/sbin:"
"/usr/bin:"
"/sbin:"
"/bin"))
(setenv "PATH" path))
(add-to-list 'load-path (concat dotfiles-dir "/vendor"))
;; Save backups in one place
;; Put autosave files (ie #foo#) in one place, *not*
;; scattered all over the file system!
(defvar autosave-dir
(concat "/tmp/emacs_autosaves/" (user-login-name) "/"))
(make-directory autosave-dir t)
(defun auto-save-file-name-p (filename)
(string-match "^#.*#$" (file-name-nondirectory filename)))
(defun make-auto-save-file-name ()
(concat autosave-dir
(if buffer-file-name
(concat "#" (file-name-nondirectory buffer-file-name) "#")
(expand-file-name
(concat "#%" (buffer-name) "#")))))
;; Put backup files (ie foo~) in one place too. (The backup-directory-alist
;; list contains regexp=>directory mappings; filenames matching a regexp are
;; backed up in the corresponding directory. Emacs will mkdir it if necessary.)
(defvar backup-dir (concat "/tmp/emacs_backups/" (user-login-name) "/"))
(setq backup-directory-alist (list (cons "." backup-dir)))
;; major modes
(add-to-list 'load-path (concat dotfiles-dir "/vendor/sc.el"))
(require 'sclang)
(require 'w3m)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(color-theme-selection "Oswald" nil (color-theme))
'(emacs-goodies-el-defaults t)
'(pop-up-frames nil)
'(pop-up-windows t)
'(sclang-auto-scroll-post-buffer t)
'(sclang-eval-line-forward nil)
'(sclang-help-path (quote ("/usr/share/SuperCollider/Help" "~/share/SuperCollider/Help")))
'(sclang-library-configuration-file "~/.sclang.cfg")
;; '(sclang-runtime-directory "~/share/SuperCollider/")
'(sclang-runtime-directory "~/scwork/")
'(sclang-server-panel "Server.default.makeGui")
'(show-paren-mode t)
'(w3m-pop-up-frames t)
'(w3m-pop-up-windows nil)
'(inhibit-startup-screen t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(add-hook 'sclang-mode-hook
'(lambda ()
(define-key sclang-mode-map "\C-m" 'newline-and-indent)))
(add-hook 'sclang-mode-hook 'yas/minor-mode)
;; c-mode
(add-hook 'c-mode-hook
'(lambda ()
(define-key c-mode-map "\C-m" 'newline-and-indent)))
;; Latex
;(setq TeX-auto-save t)
;(setq TeX-parse-self t)
;(setq-default TeX-master nil)
;(add-hook 'LaTeX-mode-hook 'bib-cite-minor-mode)
;; Snippets
(add-to-list 'load-path (concat dotfiles-dir "/vendor/yasnippet.el"))
(require 'yasnippet)
(yas/initialize)
(yas/load-directory (concat dotfiles-dir "/vendor/yasnippet.el/snippets"))
;(yas/load-directory "~/.emacs.d/vendor/yasnippet.el/snippets")
;; Commands
;;(require 'unbound)
;; Minor Modes
(add-to-list 'load-path (concat dotfiles-dir "/vendor/textmate.el"))
(require 'textmate)
(textmate-mode)
(require 'whitespace)
;; Remove scrollbars and make hippie expand
;; work nicely with yasnippet
(scroll-bar-mode -1)
(require 'hippie-exp)
(setq hippie-expand-try-functions-list
'(yas/hippie-try-expand
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
;; try-expand-dabbrev-from-kill
;; try-complete-file-name
;; try-complete-file-name-partially
;; try-complete-lisp-symbol
;; try-complete-lisp-symbol-partially
;; try-expand-line
;; try-expand-line-all-buffers
;; try-expand-list
;; try-expand-list-all-buffers
;; try-expand-whole-kill
))
(add-hook 'octave-mode-hook
(lambda ()
(abbrev-mode 1)
(auto-fill-mode 1)
(if (eq window-system 'x)
(font-lock-mode 1))))
(add-hook 'inferior-octave-mode-hook
(lambda ()
(turn-on-font-lock)
(define-key inferior-octave-mode-map [up]
'comint-previous-input)
(define-key inferior-octave-mode-map [down]
'comint-next-input)))
(require 'textile-mode)
(add-to-list 'auto-mode-alist '("\\.textile\\'" . textile-mode))
(require 'cc-menus)
;; gist
(require 'gist)
;; Keyboard
;; Split Windows
(global-set-key [f6] 'split-window-horizontally)
(global-set-key [f7] 'split-window-vertically)
(global-set-key [f8] 'delete-window)
(global-set-key [f1] 'menu-bar-mode)
;; Full screen toggle
(defun toggle-fullscreen ()
(interactive)
(set-frame-parameter nil 'fullscreen (if (frame-parameter nil 'fullscreen)
nil
'fullboth)))
(global-set-key (kbd "M-n") 'toggle-fullscreen)
(server-start)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment