You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

109 lines
3.5 KiB

;;; tweaks.el
;; The settings in this file mostly correct bad defaults and add stuff I will
;; never really tinker with. Settings that are more subject to change can be
;; found in init.el.
;; Remove useless stuff.
(menu-bar-mode 0)
(tool-bar-mode 0)
(when (display-graphic-p)
(scroll-bar-mode 0))
(defun my/disable-scroll-bars (frame)
(modify-frame-parameters frame
'((vertical-scroll-bars . nil)
(horizontal-scroll-bars . nil))))
(add-hook 'after-make-frame-functions 'my/disable-scroll-bars)
;; Disable startup screen
(setq inhibit-startup-screen t)
;; Make sure UTF-8 is used.
(set-language-environment "UTF-8")
;; Disable italic text.
(set-face-italic 'font-lock-comment-face nil)
;; Disable bold text (looks huge, can't remember where I found it)
(defun remap-faces-default-attributes ()
(let ((family (face-attribute 'default :family))
(height (face-attribute 'default :height)))
(mapcar (lambda (face)
(face-remap-add-relative
face :family family :slant 'normal :weight 'normal :height height))
(face-list))))
(when (display-graphic-p)
(add-hook 'minibuffer-setup-hook 'remap-faces-default-attributes)
(add-hook 'change-major-mode-after-body-hook 'remap-faces-default-attributes))
;; Move backup files to another folder.
(setq backup-directory-alist '(("." . "~/.emacs.d/backups/")))
(setq auto-save-default nil)
;; don't create .#<filename> files.
(setq create-lockfiles nil)
;; save minibuffer history between sessions.
(savehist-mode 1)
;; Y or N instead of Yes or No.
(defalias 'yes-or-no-p 'y-or-n-p)
;; Smaller skips when cursor reaches end of screen.
(setq scroll-conservatively 100)
;; Disable bell.
(setq ring-bell-function 'ignore)
;; Subword for camelCase words (useful for Haskell).
(global-subword-mode t)
;; Make ansi-term not ask for shell every time it starts.
(defvar term-shell "/bin/mksh")
(defadvice ansi-term (before force-bash)
(interactive (list term-shell)))
(ad-activate 'ansi-term)
;; Set the character limit to 80 and autowrap at character limit when writing text.
(setq-default fill-column 80)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;; Ask before closing Emacs
(setq confirm-kill-emacs 'y-or-n-p)
;; Mark files with shebangs as executable automatically (thanks archenoth!)
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
;; Always require final newline
(setq-default require-final-newline t)
;; delete trailing whitespace before saving
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Start replacing text if it is marked
(delete-selection-mode 1)
;; Enable all commands
(setq disabled-command-function nil)
;; Disable line wrapping
(setq-default truncate-lines t)
;; Fix M-f
(global-set-key (kbd "M-f") (lambda () (interactive) (forward-to-word 1)))
;; Auto-indent pasted code.
(dolist (command '(yank yank-pop))
(eval
`(defadvice ,command (after indent-region activate)
(and (not current-prefix-arg)
(member major-mode
'(emacs-lisp-mode
lisp-mode
clojure-mode scheme-mode
haskell-mode ruby-mode
rspec-mode python-mode
c-mode c++-mode
objc-mode latex-mode
plain-tex-mode elisp-mode))
(let ((mark-even-if-inactive transient-mark-mode))
(indent-region (region-beginning) (region-end) nil))))))