From 9cd4c8ed8ca61df9a2839cb3b151b71f15c5e0a6 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sat, 2 Feb 2013 01:08:59 +0100 Subject: [PATCH] emacs: Move flymake settings to init.org --- .emacs.d/init.el | 48 ------------------------ .emacs.d/init.org | 77 +++++++++++++++++++++++++++++++++++++++ .emacs.d/site-lisp/oni.el | 22 ----------- 3 files changed, 77 insertions(+), 70 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 5d6a328..4f109f6 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -23,7 +23,6 @@ "Face for the supposedly empty line in commit messages." :group 'local) -(eval-after-load "flymake" '(oni:flymake-init)) (eval-after-load "ido" '(oni:ido-init)) (eval-after-load "jabber" '(oni:jabber-init)) (eval-after-load "newst-treeview" '(require 'newsticker-init)) @@ -105,52 +104,6 @@ (setq erc-timestamp-format "[%H:%M] ") (setq erc-timestamp-only-if-changed-flag nil) (setq fci-rule-color "darkred") -(setq flymake-gui-warnings-enabled nil) -(setq flymake-info-line-regexp - (eval-when-compile - (regexp-opt - '("Invalid name" - "String statement has no effect" - "Missing docstring" - "Empty docstring" - "multiple imports on one line" - "expected 2 blank lines, found 1" - "expected 2 blank lines, found 0" - "TODO:" - "whitespace after '{'" - "whitespace before '}'" - "whitespace before ':'" - "whitespace after '('" - "whitespace before ')'" - "whitespace after '['" - "whitespace before ']'" - "the backslash is redundant between brackets" - "continuation line over-indented for visual indent" - "continuation line under-indented for visual indent" - "Too many statements" - "comparison to None should be" - "missing whitespace around operator" - "missing whitespace after ','" - "line too long" - "at least two spaces before inline comment" - "trailing whitespace" - "imported but unused" - "Unused import" - "too many blank lines")))) -(setq flymake-log-file-name (expand-file-name "~/.emacs.d/flymake.log")) -(setq flymake-log-level 0) -(setq flymake-warn-line-regexp - (eval-when-compile - (regexp-opt '("warning" - "Warning" - "redefinition of unused" - "Redefining built-in" - "Redefining name" - "Unused argument" - "Unused variable" - "Dangerous default value {} as argument" - "no newline at end of file" - "Access to a protected member")))) (setq frame-title-format '(:eval (concat "emacs: " (buffer-name)))) (setq geiser-repl-history-filename "~/.emacs.d/geiser-history") (setq gnus-init-file "~/.emacs.d/gnus") @@ -229,7 +182,6 @@ (add-hook 'diary-display-hook 'oni:diary-display-func) (add-hook 'emacs-lisp-mode-hook 'oni:emacs-lisp-mode-func) (add-hook 'erc-mode-hook 'oni:erc-mode-func) -(add-hook 'flymake-mode-hook 'oni:flymake-mode-func) (add-hook 'go-mode-hook 'oni:go-mode-func) (add-hook 'gtags-mode-hook 'oni:gtags-mode-func) (add-hook 'html-mode-hook 'oni:html-mode-func) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 50a4161..5edf00e 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -129,6 +129,83 @@ (global-set-key (kbd "") 'oni:start-emms) #+END_SRC + Load ~flymake-cursor~ after loading ~flymake~, add Python and Go to + "allowed" files and add go error output to error patterns. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (defun oni:flymake-init () + "Initialization function for flymake." + (require 'flymake-cursor) + + (add-to-list ; Make sure pyflakes is loaded + 'flymake-allowed-file-name-masks ; for python files. + '("\\.py\\'" ext:flymake-pyflakes-init)) + + (add-to-list ; Error line repexp for go + 'flymake-err-line-patterns ; compilation. + '("^\\([a-zA-Z0-9_]+\\.go\\):\\([0-9]+\\):\\(.*\\)$" + 1 2 nil 3)) + + (add-to-list ; Go uses makefiles, makes + 'flymake-allowed-file-name-masks ; flymaking 'easy'. + '("\\.go$" flymake-simple-make-init))) + + (eval-after-load "flymake" '(oni:flymake-init)) + #+END_SRC + + Disable the GUI for flymake errors, add a bunch of pep8, flymake + and pyflakes messages to warning and info patterns, set the log + file to somewhere in my home directory and set logging level to 0. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (setq flymake-gui-warnings-enabled nil) + (setq flymake-info-line-regexp + (eval-when-compile + (regexp-opt + '("Invalid name" + "String statement has no effect" + "Missing docstring" + "Empty docstring" + "multiple imports on one line" + "expected 2 blank lines, found 1" + "expected 2 blank lines, found 0" + "TODO:" + "whitespace after '{'" + "whitespace before '}'" + "whitespace before ':'" + "whitespace after '('" + "whitespace before ')'" + "whitespace after '['" + "whitespace before ']'" + "the backslash is redundant between brackets" + "continuation line over-indented for visual indent" + "continuation line under-indented for visual indent" + "Too many statements" + "comparison to None should be" + "missing whitespace around operator" + "missing whitespace after ','" + "line too long" + "at least two spaces before inline comment" + "trailing whitespace" + "imported but unused" + "Unused import" + "too many blank lines")))) + (setq flymake-log-file-name (expand-file-name "~/.emacs.d/flymake.log")) + (setq flymake-log-level 0) + (setq flymake-warn-line-regexp + (eval-when-compile + (regexp-opt '("warning" + "Warning" + "redefinition of unused" + "Redefining built-in" + "Redefining name" + "Unused argument" + "Unused variable" + "Dangerous default value {} as argument" + "no newline at end of file" + "Access to a protected member")))) + #+END_SRC + ** Eshell Add ~unison~ to the list of =eshell-visual-commands= because it diff --git a/.emacs.d/site-lisp/oni.el b/.emacs.d/site-lisp/oni.el index 78dcb8f..b1c8b14 100644 --- a/.emacs.d/site-lisp/oni.el +++ b/.emacs.d/site-lisp/oni.el @@ -110,28 +110,6 @@ DOT are intentionally being skipped." (visual-line-mode) (setq truncate-lines nil)) -(defun oni:flymake-init () - "Initialization function for flymake." - (require 'flymake-cursor) - - (add-to-list ; Make sure pyflakes is loaded - 'flymake-allowed-file-name-masks ; for python files. - '("\\.py\\'" ext:flymake-pyflakes-init)) - - (add-to-list ; Error line repexp for go - 'flymake-err-line-patterns ; compilation. - '("^\\([a-zA-Z0-9_]+\\.go\\):\\([0-9]+\\):\\(.*\\)$" - 1 2 nil 3)) - - (add-to-list ; Go uses makefiles, makes - 'flymake-allowed-file-name-masks ; flymaking 'easy'. - '("\\.go$" flymake-simple-make-init))) - -(defun oni:flymake-mode-func () - "Function for `flymake-mode-hook'." - (local-set-key [M-P] 'flymake-goto-prev-error) - (local-set-key [M-N] 'flymake-goto-next-error)) - (defun oni:go-mode-func () "Function for `go-mode-hook'." (setq indent-tabs-mode nil)