Skip to content

Commit

Permalink
better spelling check
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed Jan 22, 2014
1 parent 962d3d1 commit f520837
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions init-spelling.el
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
;; flyspell set up for web-mode
(defun web-mode-flyspefll-verify ()
(let ((f (get-text-property (- (point) 1) 'face)))
(not (memq f '(web-mode-html-attr-value-face
web-mode-html-tag-face
web-mode-html-attr-name-face
web-mode-doctype-face
web-mode-keyword-face
web-mode-function-name-face
web-mode-variable-name-face
web-mode-css-property-name-face
web-mode-css-selector-face
web-mode-css-color-face
web-mode-type-face
web-mode-block-control-face
)
))
(let ((f (get-text-property (- (point) 1) 'face))
rlt)
(cond
((not (memq f '(web-mode-html-attr-value-face
web-mode-html-tag-face
web-mode-html-attr-name-face
web-mode-constant-face
web-mode-doctype-face
web-mode-keyword-face
web-mode-comment-face ;; focus on get html label right
web-mode-function-name-face
web-mode-variable-name-face
web-mode-css-property-name-face
web-mode-css-selector-face
web-mode-css-color-face
web-mode-type-face
web-mode-block-control-face
)
))
(setq rlt t))
((memq f '(web-mode-html-attr-value-face))
(save-excursion
(search-backward-regexp "=['\"]" (line-beginning-position) t)
(backward-char)
(setq rlt (string= (thing-at-point 'word) "value"))
))
(t t))
rlt
))

(put 'web-mode 'flyspell-mode-predicate 'web-mode-flyspefll-verify)

(require 'flyspell-lazy)
Expand All @@ -31,19 +45,14 @@
;; 2. looks Kevin Atkinson still get some roadmap for aspell:
;; @see http://lists.gnu.org/archive/html/aspell-announce/2011-09/msg00000.html
(if (executable-find "aspell")
(progn
(setq ispell-program-name "aspell"
;; ispell-extra-args '("--sug-mode=ultra")
;; force the English dictionary
ispell-extra-args '("--sug-mode=ultra" "--lang=en_US")
)
)
ispell-extra-args '("--sug-mode=ultra" "--lang=en_US" "--run-together" "--run-together-limit=5" "--run-together-min=2"))
(if (executable-find "hunspell")
(progn
(setq ispell-program-name "hunspell"
ispell-extra-args '("-D en_US")
)
)))
)))


;;----------------------------------------------------------------------------
Expand Down

0 comments on commit f520837

Please sign in to comment.