diff options
Diffstat (limited to '.emacs.local.d/general.el')
-rw-r--r-- | .emacs.local.d/general.el | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/.emacs.local.d/general.el b/.emacs.local.d/general.el new file mode 100644 index 0000000..558490b --- /dev/null +++ b/.emacs.local.d/general.el @@ -0,0 +1,165 @@ +(message nil);; Debian packages: elpa-use-package elpa-fill-column-indicator + +;; This is only needed once, near the top of the file +(eval-when-compile + (require 'use-package)) + +;; Added by Package.el. This must come before configurations of +;; installed packages. Don't delete this line. If you don't want it, +;; just comment it out by adding a semicolon to the start of the line. +;; You may delete these explanatory comments. +(package-initialize) + +(add-to-list 'package-archives + '("melpa-stable" . "https://stable.melpa.org/packages/") t) + +(add-to-list 'load-path "~/.emacs.local.d/elisp") + +;; ------ +;; Require misc stuff +;; ------ +(require 'fill-column-indicator) + +;; Place backups in ~/.backups/ directory, like a civilized program. +;; ------ +(if (file-directory-p "~/.backup") + (setq backup-directory-alist '(("." . "~/.backup"))) + (message "Directory does not exist: ~/.backup")) + +(filesets-init) + +(setq backup-by-copying t ; Don't delink hardlinks + delete-old-versions t ; Clean up the backups + version-control t ; Use version numbers on backups, + kept-new-versions 3 ; keep some new versions + kept-old-versions 2) ; and some old ones, too + +;;; backup/autosave - old studd, just in case +;; (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))) + + +;; --------- +;; Generic keybindings +;; --------- +(global-set-key (kbd "C-c d") 'diff-buffer-with-file) +(global-set-key (kbd "C-c R") 'revert-buffer) + +(global-set-key (kbd "C-<next>") 'next-buffer) +(global-set-key (kbd "C-<prior>") 'previous-buffer) + +;; compile +(global-set-key [f12] 'compile) + +;; ------ +;; General config BS +;; ------ + +(setq fill-column 79) + +;; Make sure that pressing middle mouse button pastes right at point, +;; not where the mouse cursor is. +(setq mouse-yank-at-point t) +(setq column-number-mode 1) +(setq line-number-mode 1) +(setq-default indent-tabs-mode nil) +(setq-default tab-width 4) + +(setq-default c-basic-offset 4) + +;; ------ +;; Initialize some things +;; ------ + + +(setenv "TMPDIR" (concat (getenv "HOME") "/tmp")) +(server-start) + +;; ------ +;; Terminal / window specific stuff +;; ------ + +;; Don't minimize my emacs! Honestly wtf +(when window-system + (progn + (global-unset-key (kbd "C-z")) + (setq scroll-bar-mode nil) + (tool-bar-mode nil) + (menu-bar-mode nil))) + +;; ------ +;; Helper for compilation. +;; ------ +;; Close the compilation window if there was no error at all. +(defun compilation-exit-autoclose (status code msg) + ;; If M-x compile exists with a 0 + (when (and (eq status 'exit) (zerop code)) + ;; then bury the *compilation* buffer, so that C-x b doesn't go there + (bury-buffer) + ;; and delete the *compilation* window + (delete-window (get-buffer-window (get-buffer "*compilation*")))) + ;; Always return the anticipated result of compilation-exit-message-function + (cons msg code)) +;; Specify my function (maybe I should have done a lambda function) +(setq compilation-exit-message-function 'compilation-exit-autoclose) +(setq compilation-read-command nil) + +;; Themes +(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") + +;; Remove scratch message +(setq initial-scratch-message "") + +;; Turn of scroll bar +(when (featurep 'scroll-bar) (scroll-bar-mode -1)) + +;; Ask y or n instead of yes or no +(defalias 'yes-or-no-p 'y-or-n-p) + +;; Fancier buffer selection +(global-set-key (kbd "C-x C-b") 'bs-show) + +;;; Stefan Monnier <foo at acm.org>. It is the opposite of fill-paragraph +(defun unfill-paragraph (&optional region) + "Takes a multi-line paragraph and makes it into a single line of text." + (interactive (progn (barf-if-buffer-read-only) '(t))) + (let ((fill-column (point-max)) + ;; This would override `fill-column' if it's an integer. + (emacs-lisp-docstring-fill-column t)) + (fill-paragraph nil region))) + +;; Handy key definition +(define-key global-map "\M-Q" 'unfill-paragraph) + +(setq custom-file "~/.emacs.d/custom.el") +(load custom-file 'noerror) + +(menu-bar-mode -1) +(tool-bar-mode -1) + + +;; Start maximized +(add-to-list 'default-frame-alist '(fullscreen . maximized)) + +;; Only flash the mode line +(setq ring-bell-function + (lambda () + (let ((orig-fg (face-foreground 'mode-line))) + (set-face-foreground 'mode-line "#F2804F") + (run-with-idle-timer 0.1 nil + (lambda (fg) (set-face-foreground 'mode-line fg)) + orig-fg)))) + +;; Highlight parens +(setq show-paren-delay 0) +(show-paren-mode 1) + +;; Use default brwoser +;;(setq browse-url-browser-function 'browse-url-generic browse-url-generic-program "chromium") + +;; Mutt support. +(setq auto-mode-alist (append '((".*tmp/mutt.*" . mail-mode)) auto-mode-alist)) +(setq auto-mode-alist (append '((".*tmp/neomutt.*" . mail-mode)) auto-mode-alist)) |