fix(emacs/lean-mode): remove whitespace-cleanup-mode dependency

- When customization variable 'lean-delete-trailing-whitespace' is
   non-nil, trailing-whitespaces are removed before save.

 - It doesn't change TABs.

Close #226
This commit is contained in:
Soonho Kong 2014-11-09 00:21:43 -05:00
parent 36476b9115
commit d25e74b921
5 changed files with 9 additions and 12 deletions

View file

@ -10,7 +10,6 @@
(depends-on "flycheck")
(depends-on "flymake")
(depends-on "fill-column-indicator")
(depends-on "whitespace-cleanup-mode")
(depends-on "lua-mode")
(depends-on "mmm-mode")
(depends-on "s"))

View file

@ -27,19 +27,17 @@ to use full features of ``lean-mode``.
- [fill-column-indicator][fci]
- [lua-mode][lua-mode]
- [mmm-mode][mmm-mode]
- [whitespace-cleanup-mode][wcm]
[company]: http://company-mode.github.io/
[flycheck]: http://flycheck.readthedocs.org/en/latest
[fci]: https://github.com/alpaker/Fill-Column-Indicator
[lua-mode]: http://immerrr.github.io/lua-mode/
[mmm-mode]: https://github.com/purcell/mmm-mode
[wcm]: https://github.com/purcell/whitespace-cleanup-mode
Install
=======
Put the following elisp code on your emacs setup
Put the following elisp code on your emacs setup
(e.g. ``.emacs.d/init.el`` [GNU Emacs], ``~/Library/Preferences/Aquamacs Emacs/Preferences.el`` [Aquamacs]) :
```elisp
@ -50,8 +48,8 @@ Put the following elisp code on your emacs setup
;; Install required/optional packages for lean-mode
(defvar lean-mode-required-packages
'(company dash dash-functional flycheck whitespace-cleanup-mode
f fill-column-indicator s lua-mode mmm-mode))
'(company dash dash-functional flycheck f
fill-column-indicator s lua-mode mmm-mode))
(let ((need-to-refresh t))
(dolist (p lean-mode-required-packages)
(when (not (package-installed-p p))

View file

@ -127,6 +127,7 @@
(defconst lean-hooks-alist
'(
;; Handle events that may start automatic syntax checks
(before-save-hook . lean-whitespace-cleanup)
(after-save-hook . lean-server-after-save)
;; ;; Handle events that may triggered pending deferred checks
;; (window-configuration-change-hook . lean-perform-deferred-syntax-check)
@ -169,10 +170,6 @@ enabled and disabled respectively.")
(setq fci-rule-column lean-rule-column)
(setq fci-rule-color lean-rule-color)
(fci-mode t))))
;; Delete Trailing Whitespace
(if lean-delete-trailing-whitespace
(progn (require 'whitespace-cleanup-mode)
(whitespace-cleanup-mode t)))
;; eldoc
(when lean-eldoc-use
(set (make-local-variable 'eldoc-documentation-function)

View file

@ -24,8 +24,7 @@
(lean-mode-check-package 'package)
(lean-mode-check-package 'dash)
(let ((required-packages '(cl-lib compile dash dash-functional f flymake s))
(optional-packages '(flycheck whitespace-cleanup-mode fill-column-indicator
lua-mode mmm-mode)))
(optional-packages '(flycheck fill-column-indicator lua-mode mmm-mode)))
(-each required-packages 'lean-mode-require-package)
(-each optional-packages 'lean-mode-check-package)))

View file

@ -180,4 +180,8 @@
(pos (point)))
(- pos bol-pos)))
(defun lean-whitespace-cleanup ()
(when lean-delete-trailing-whitespace
(delete-trailing-whitespace)))
(provide 'lean-util)