From 307eac70f368d862fe116fd22c1075f03cce8cbe Mon Sep 17 00:00:00 2001 From: Mitch Tishmack Date: Sun, 15 Feb 2015 18:01:32 -0600 Subject: [PATCH] Add elisp mode defaults setup for things. --- emacs/.emacs.d/emacs.org | 87 ++++++++++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/emacs/.emacs.d/emacs.org b/emacs/.emacs.d/emacs.org index 5c67162..aa0dd01 100644 --- a/emacs/.emacs.d/emacs.org +++ b/emacs/.emacs.d/emacs.org @@ -601,18 +601,62 @@ Desktop saving of session information handy to keep the same buffers between ses Common mode defaults I think are sensible. -TODO: fixme kthxbai -#+BEGIN_SRC emacs-lisp :tangle no -(interactive) -(highlight-lines-matching-regexp ".\{81\}" 'hi-green-b) -(hl-line-mode) -;;(auto-complete-mode) -(whitespace-mode) -;;(smartparens-mode) -(visual-line-mode) -(customize-set-variable 'indent-tabs-mode nil) -(customize-set-variable 'tab-width 2) +#+BEGIN_SRC emacs-lisp + (add-hook 'prog-mode-hook + '(lambda () + (interactive) + (hl-line-mode) + (auto-complete-mode) + (whitespace-mode) + (smartparens-mode) + (visual-line-mode) + (customize-set-variable 'indent-tabs-mode nil) + (customize-set-variable 'tab-width 2) + (flycheck-mode) + ) + ) +#+END_SRC + +*** c + +#+BEGIN_SRC emacs-lisp + (add-to-list 'auto-mode-alist '("\\.[chm]\\'" . c-mode)) + (add-hook 'c-mode-common-hook + '(lambda () + (global-set-key "\C-x\C-m" 'compile) + (setq flycheck-clang-language-standard "c11") + (setq flycheck-idle-change-delay 2) + (setq flycheck-highlighting-mode 'symbols) + ;; later... + ;; (add-hook 'before-save-hook 'clang-format-buffer nil t) + (c-toggle-auto-state 1) + (setq-default c-basic-offset 2 + tab-width 2 + indent-tabs-mode nil + c-electric-flag t + indent-level 2 + c-default-style "bsd" + backward-delete-function nil) + )) #+END_SRC + +*** elisp + +#+BEGIN_SRC emacs-lisp +(add-hook 'emacs-lisp-hook + (lambda () + (define-key emacs-lisp-map + "\C-x\C-e" 'pp-eval-last-sexp) + (define-key emacs-lisp-map + "\r" 'reindent-then-newline-and-indent))) +#+END_SRC + +*** python + +#+BEGIN_SRC emacs-lisp + (add-hook 'python-mode-hook '(lambda () (flycheck-select-checker 'python-flake8))) +#+END_SRC + ** auto-insert-mode new file templates Use auto-insert-mode to insert in templates for blank files. @@ -636,7 +680,7 @@ Create the *auto-insert-alist* so all the mode lists are the same (setq auto-insert-alist (append '( - ((c-mode . "C") + ((c-mode . "c") nil "/*\n" "File: " (file-name-nondirectory buffer-file-name) "\n" @@ -654,12 +698,29 @@ Create the *auto-insert-alist* so all the mode lists are the same ) #+END_SRC +*** elisp +#+BEGIN_SRC emacs-lisp + (setq auto-insert-alist + (append + '( + ((emacs-lisp-mode . "elisp") + nil + ";;-*-mode: emacs-lisp; coding: utf-8;-*-\n" + ";; File: " (file-name-nondirectory buffer-file-name) "\n" + ";; Copyright: " (substring (current-time-string) -4) " " auto-insert-copyright "\n" + ";; Description: " _ "\n" + ) + ) + auto-insert-alist) + ) +#+END_SRC + *** python #+BEGIN_SRC emacs-lisp (setq auto-insert-alist (append - '(((python-mode . "Python") + '(((python-mode . "python") nil "#!/usr/bin/env python\n" "# -*-mode: Python; coding: utf-8;-*-\n"