Skip to content

Instantly share code, notes, and snippets.

@jorvis
Created February 3, 2018 00:36
Show Gist options
  • Save jorvis/eafc5fb8d66f801eb5882a7b41cd3de0 to your computer and use it in GitHub Desktop.
Save jorvis/eafc5fb8d66f801eb5882a7b41cd3de0 to your computer and use it in GitHub Desktop.
My .emacs file
(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.
'(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.
'(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" )))))
;; hide the menu bar
;; (menu-bar-mode -1)
;; use spaces instead of tabs
(setq-default indent-tabs-mode nil)
;; set tab-width to 4
(setq-default tab-width 4)
;; put the auto-backup files in a specific place
;; (setq-default backup-directory-alist '(("." . "~/.emacs-backups")))
(defvar backup-dir (expand-file-name "~/.emacs.d/backup/"))
(defvar autosave-dir (expand-file-name "~/.emacs.d/autosave/"))
(setq backup-directory-alist (list (cons ".*" backup-dir)))
(setq auto-save-list-file-prefix autosave-dir)
(setq auto-save-file-name-transforms `((".*" ,autosave-dir t)))
;; turn on highlighting for all modes that support it
(global-font-lock-mode 1)
;; I want undo to work this way
(global-unset-key "\C-z")
(global-set-key "\C-z" 'undo)
;; don't wrap long lines, but still show their contents
(set-default 'truncate-lines t)
;; (require 'auto-show)
;; (auto-show-mode 1)
;; (setq-default auto-show-mode t)
;; ALT-F4 = death
(global-set-key [M-f4] 'save-buffers-kill-emacs)
;; ========== Line by line scrolling ==========
;; This makes the buffer scroll by only a single line when the up or
;; down cursor keys push the cursor (tool-bar-mode) outside the
;; buffer. The standard emacs behaviour is to reposition the cursor in
;; the center of the screen, but this can make the scrolling confusing
(setq scroll-step 1)
;; put scroll bars on the right
(set-scroll-bar-mode 'right)
;; set the title bar to show file name if available, buffer name otherwise
;(setq frame-title-format '(buffer-name "%f" ("%b")))
;; from: http://emacs-fu.blogspot.com/2011/01/setting-frame-title.html
;; make sure your text files end in a newline
(setq require-final-newline 't)
(add-hook 'window-configuration-change-hook
(lambda ()
(setq frame-title-format
(concat
; invocation-name "@" system-name ": "
(replace-regexp-in-string
(concat "/home/" user-login-name) "~"
(or buffer-file-name "%b"))))))
;; assume cgi scripts are python
(add-to-list 'auto-mode-alist '("\\.cgi\\'" . python-mode))
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment