;; This file: http://user.it.uu.se/~embe8573/conf/emacs-init/spell-new.el (setq ispell-program-name "ispell") (defvar ispell-silently-savep) (setq ispell-silently-savep t) (setq ispell-skip-region-alist (nconc ispell-skip-region-alist (list '("`" . "\\(`\\|'\\)"))) ) (defvar swe-dict "svenska") (defvar eng-dict "american-insane") (defun do-spell-word (dict) "`ispell-word' the preceding word with DICT." (ispell-change-dictionary dict) (ispell-word) (forward-word) ) (defun ord () (interactive) (do-spell-word swe-dict)) (defun word () (interactive) (do-spell-word eng-dict)) (defun is-code () (member major-mode '( c++-mode Shell-script-mode emacs-lisp-mode sh-mode ))) ; add more! (defun is-message () (eq major-mode 'message-mode)) (defun do-spell-dict (dict) "Spell with DICT. If there is a region, `ispell-region'. if in a code mode, `ispell-comments-and-strings'. if in `message-mode', do `ispell-message'. Otherwise, spell everything with `ispell-buffer'." (ispell-change-dictionary dict) (save-excursion (cond (mark-active (ispell-region (region-beginning) (region-end))) ((is-message) (ispell-message)) ((is-code) (ispell-comments-and-strings nil)) ; ONLY-CURRENT (t (ispell-buffer)) ))) (defun spell-swedish () (interactive) (do-spell-dict swe-dict)) (defun spell-english () (interactive) (do-spell-dict eng-dict)) (provide 'spell-new)