Function: flyspell-mode-on
flyspell-mode-on is a byte-compiled function defined in
flyspell.el.gz.
Signature
(flyspell-mode-on &optional SHOW-MSG)
Documentation
Turn Flyspell mode on. Do not use this; use flyspell-mode(var)/flyspell-mode(fun) instead.
If optional argument SHOW-MSG is non-nil, show a welcome message
if flyspell-issue-message-flag and flyspell-issue-welcome-flag
are both non-nil.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/flyspell.el.gz
;;*---------------------------------------------------------------------*/
;;* flyspell-mode-on ... */
;;*---------------------------------------------------------------------*/
(defun flyspell-mode-on (&optional show-msg)
"Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead.
If optional argument SHOW-MSG is non-nil, show a welcome message
if `flyspell-issue-message-flag' and `flyspell-issue-welcome-flag'
are both non-nil."
(ispell-set-spellchecker-params) ; Initialize variables and dicts alists
(setq ispell-highlight-face 'flyspell-incorrect)
;; local dictionaries setup
(or ispell-local-dictionary ispell-dictionary
(if flyspell-default-dictionary
(ispell-change-dictionary flyspell-default-dictionary)))
;; we have to force ispell to accept the local definition or
;; otherwise it could be too late, the local dictionary may
;; be forgotten!
;; Pass the `force' argument for the case where flyspell was active already
;; but the buffer's local-defs have been edited.
(flyspell-accept-buffer-local-defs 'force)
;; we put the `flyspell-delayed' property on some commands
(flyspell-delay-commands)
;; we put the `flyspell-deplacement' property on some commands
(flyspell-deplacement-commands)
;; we bound flyspell action to post-command hook
(add-hook 'post-command-hook (function flyspell-post-command-hook) t t)
;; we bound flyspell action to pre-command hook
(add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t)
;; we bound flyspell action to after-change hook
(add-hook 'after-change-functions 'flyspell-after-change-function nil t)
;; we bound flyspell action to hack-local-variables-hook
(add-hook 'hack-local-variables-hook
(function flyspell-hack-local-variables-hook) t t)
;; set flyspell-generic-check-word-predicate based on the major mode
(let ((mode-predicate (get major-mode 'flyspell-mode-predicate)))
(if mode-predicate
(setq flyspell-generic-check-word-predicate mode-predicate)))
;; the welcome message
(if (and flyspell-issue-message-flag
flyspell-issue-welcome-flag
show-msg)
(let* ((binding (where-is-internal 'flyspell-auto-correct-word
nil 'non-ascii))
(mouse-button (if context-menu-mode "Mouse-3" "Mouse-2")))
(message (format-message
"Welcome to Flyspell. Use %s to correct words."
(if binding
(format "`%s' or `%s'" (key-description binding) mouse-button)
(format "`%s'" mouse-button)))))))