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.

Aliases

flyspell-mode-on (obsolete since 30.1)

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)
  (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)
  (flyspell-delay-commands)
  (flyspell-deplacement-commands)
  (if flyspell-check-changes
      (add-hook 'post-command-hook (function flyspell-check-changes) t t)
    (add-hook 'post-command-hook (function flyspell-post-command-hook) t t))
  (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t)
  (add-hook 'after-change-functions 'flyspell-after-change-function nil t)
  (add-hook 'hack-local-variables-hook
	    (function flyspell-hack-local-variables-hook) t t)
  (let ((mode-predicate (get major-mode 'flyspell-mode-predicate)))
    (if mode-predicate
	(setq flyspell-generic-check-word-predicate mode-predicate)))
  (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)))))))