From 40d9a1b3fef4b833c12051a3c6a5e1f76ed5771c Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 30 Jun 2015 15:25:57 +0200 Subject: Add flycheck section to init.org --- emacs/.emacs.d/init.el | 26 ++++---------- emacs/.emacs.d/init.org | 96 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 85 insertions(+), 37 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 353ffa4..b61bbf4 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -1112,13 +1112,6 @@ from myaethon2.core.decorators import ( (push "migrations" (cadr (assoc 'directories fiplr-ignored-globs))) (push "vendor-lisp" (cadr (assoc 'directories fiplr-ignored-globs)))) -(stante-after flycheck - (mapc (lambda (c) (delq c flycheck-checkers)) - '(python-pylint python-pyflakes)) - (setf flycheck-highlighting-mode 'columns) - (require 'flycheck-commit-check) - (setq flycheck-display-errors-function (lambda (_) nil))) - (stante-after geiser-repl (setq geiser-repl-history-filename "~/.emacs.d/geiser-history")) @@ -1298,7 +1291,6 @@ from myaethon2.core.decorators import ( (add-hook 'before-save-hook 'oni:before-save-func) (add-hook 'css-mode-hook #'rainbow-mode) (add-hook 'diary-display-hook 'oni:diary-display-func) -(add-hook 'flycheck-mode-hook #'flycheck-cask-setup) (add-hook 'git-commit-mode-hook #'oni:set-ispell-local-en-dict) (add-hook 'gnus-exit-group-hook 'update-mailcount) (add-hook 'gnus-exit-gnus-hook 'update-mailcount) @@ -1314,10 +1306,6 @@ from myaethon2.core.decorators import ( (add-hook 'ert-results-mode-hook (lambda () (setq truncate-lines nil))) (add-hook 'ruby-mode-hook (lambda () (setq-local fci-rule-column 80))) -(oni:add-function-to-hooks #'flycheck-mode - 'perl-mode-hook 'rst-mode-hook 'rust-mode-hook 'sh-mode-hook - 'git-commit-mode-hook) - (oni:add-function-to-hooks #'oni:make-readable 'Info-mode-hook 'gnus-article-mode-hook 'gnus-group-mode-hook 'org-agenda-mode-hook) @@ -1335,7 +1323,7 @@ from myaethon2.core.decorators import ( ac-source-variables ac-source-symbols))) #'oni:locally-enable-double-spaces #'oni:set-emacs-lisp-symbols - #'paredit-mode #'flycheck-mode #'eldoc-mode #'oni:set-emacs-lisp-keys) + #'paredit-mode #'eldoc-mode #'oni:set-emacs-lisp-keys) (oni:add-hooks 'eshell-mode-hook #'buffer-disable-undo #'oni:set-keys-for-eshell @@ -1349,10 +1337,10 @@ from myaethon2.core.decorators import ( (gnus-summary-next-subject 1))))) (oni:add-hooks 'go-mode-hook - #'oni:go-mode-func #'flycheck-mode) + #'oni:go-mode-func) (oni:add-hooks 'html-mode-hook - #'flycheck-mode #'oni:maybe-fci-mode #'tagedit-mode #'turn-off-flyspell + #'oni:maybe-fci-mode #'tagedit-mode #'turn-off-flyspell #'turn-off-auto-fill) (oni:add-hooks 'hy-mode-hook @@ -1373,13 +1361,13 @@ from myaethon2.core.decorators import ( #'oni:set-emacs-lisp-symbols #'paredit-mode) (oni:add-hooks 'lua-mode-hook - #'oni:lua-mode-func #'flycheck-mode) + #'oni:lua-mode-func) (oni:add-hooks 'markdown-mode-hook #'whitespace-mode #'oni:markdown-mode-func) (oni:add-hooks 'php-mode-hook - #'oni:php-mode-func #'flycheck-mode) + #'oni:php-mode-func) (oni:add-hooks 'prog-mode-hook #'oni:prog-mode-func #'oni:maybe-fci-mode #'rainbow-delimiters-mode @@ -1387,7 +1375,7 @@ from myaethon2.core.decorators import ( (oni:add-hooks 'python-mode-hook (lambda () (setq ac-sources '(ac-source-jedi-direct))) - #'oni:set-python-symbols #'flycheck-mode #'whitespace-mode + #'oni:set-python-symbols #'whitespace-mode #'oni:python-mode-func #'oni:set-python-imenu-function #'jedi:setup #'subword-mode) @@ -1399,7 +1387,7 @@ from myaethon2.core.decorators import ( #'tagedit-add-paredit-like-keybindings #'oni:set-keys-for-tagedit) (oni:add-hooks 'texinfo-mode-hook - #'flycheck-mode #'outline-minor-mode) + #'outline-minor-mode) (oni:add-hooks 'text-mode-hook #'auto-fill-mode #'flyspell-mode #'oni:make-readable) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 1aab2b8..974d025 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1024,24 +1024,6 @@ (add-hook 'scss-mode-hook #'scss-imenu-setup) #+END_SRC -** Haml - - - Check syntax on the fly - - #+BEGIN_SRC emacs-lisp - (declare-function flycheck-mode "flycheck") - - (add-hook 'haml-mode-hook #'flycheck-mode) - #+END_SRC - -** Ruby - - - Enable flycheck - - #+BEGIN_SRC emacs-lisp - (add-hook 'ruby-mode-hook #'flycheck-mode) - #+END_SRC - ** PHP *** Show tabs and spaces in indent @@ -1329,6 +1311,84 @@ (add-hook 'comint-mode-hook #'oni:turn-on-compilation-shell-for-pony) #+END_SRC +** Automatic syntax checking on-the-fly + + #+BEGIN_SRC emacs-lisp :tangle no + (depends-on "flycheck") + (depends-on "flycheck-cask") + (depends-on "flycheck-commit-check" :git "git://github.com/ryuslash/flycheck-commit-check.git") + #+END_SRC + + Flycheck provides awesome syntax checkers for many languages. + Enable it for the languages I use. + + #+BEGIN_SRC emacs-lisp + (add-hook 'haml-mode-hook 'flycheck-mode) + (add-hook 'emacs-lisp-mode-hook 'flycheck-mode) + (add-hook 'git-commit-mode-hook 'flycheck-mode) + (add-hook 'go-mode-hook 'flycheck-mode) + (add-hook 'html-mode-hook 'flycheck-mode) + (add-hook 'js2-mode-hook 'flycheck-mode) + (add-hook 'lua-mode-hook 'flycheck-mode) + (add-hook 'perl-mode-hook 'flycheck-mode) + (add-hook 'php-mode-hook 'flycheck-mode) + (add-hook 'python-mode-hook 'flycheck-mode) + (add-hook 'rst-mode-hook 'flycheck-mode) + (add-hook 'ruby-mode-hook 'flycheck-mode) + (add-hook 'rust-mode-hook 'flycheck-mode) + (add-hook 'sh-mode-hook 'flycheck-mode) + (add-hook 'texinfo-mode-hook 'flycheck-mode) + #+END_SRC + + Whenever flycheck is started, try using it with Cask. + + #+BEGIN_SRC emacs-lisp + (add-hook 'flycheck-mode-hook 'flycheck-cask-setup) + #+END_SRC + + Load my own git commit checker. + + #+NAME: flycheck-commit-checker + #+BEGIN_SRC emacs-lisp :tangle no + (require 'flycheck-commit-check) + #+END_SRC + + Disable certain checkers. + + #+NAME: flycheck-delete-checkers + #+BEGIN_SRC emacs-lisp :tangle no + (mapc (lambda (c) (delq c flycheck-checkers)) + '(python-pylint python-pyflakes)) + #+END_SRC + + Set the highlighting mode to columns so I can see (if possible) + where errors/warnings belong. + + #+NAME: flycheck-columns + #+BEGIN_SRC emacs-lisp :tangle no + (setq flycheck-highlighting-mode 'columns) + #+END_SRC + + Try not to display the errors. A jumpy echo area makes me nervous + and {{{key(C-c ! l)}}} is a nicer way to look at it usually. It + still doesn't keep it from being displayed, only when nothing else + is displayed though. + + #+NAME: flycheck-display + #+BEGIN_SRC emacs-lisp :tangle no + (setq flycheck-display-errors-function (lambda (_) nil)) + #+END_SRC + + Do most of these things after flycheck is loaded. + + #+BEGIN_SRC emacs-lisp :noweb yes + (stante-after flycheck + <> + <> + <> + <>) + #+END_SRC + * Use Conkeror to browse URLs Use the generic browse-url function to open URLs in Conkeror. -- cgit v1.2.3-54-g00ecf