emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4766006: Fix flyspell welcome message


From: Stefan Kangas
Subject: master 4766006: Fix flyspell welcome message
Date: Thu, 27 Aug 2020 05:15:31 -0400 (EDT)

branch: master
commit 4766006d3c79db8162aa72e01242806b9f0d2f76
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Fix flyspell welcome message
    
    * lisp/textmodes/flyspell.el (flyspell-mode, flyspell-mode-on):
    Fix showing welcome message when `flyspell-issue-welcome-flag' and
    `flyspell-issue-message-flag' are both non-nil.  (Bug#43065)
---
 lisp/textmodes/flyspell.el | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 78a74de..f90a128 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -533,7 +533,7 @@ in your init file.
           (progn
             (when flyspell-use-mouse-3-for-menu
               (flyspell--set-use-mouse-3-for-menu 
'flyspell-use-mouse-3-for-menu t))
-           (flyspell-mode-on))
+            (flyspell-mode-on t))
        (error (message "Error enabling Flyspell mode:\n%s" (cdr err))
               (flyspell-mode -1)))
     (flyspell-mode-off)))
@@ -611,8 +611,12 @@ in your init file.
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-mode-on ...                                             */
 ;;*---------------------------------------------------------------------*/
-(defun flyspell-mode-on ()
-  "Turn Flyspell mode on.  Do not use this; use `flyspell-mode' instead."
+(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
@@ -644,16 +648,17 @@ in your init file.
        (setq flyspell-generic-check-word-predicate mode-predicate)))
   ;; the welcome message
   (if (and flyspell-issue-message-flag
-          flyspell-issue-welcome-flag
-           (called-interactively-p 'interactive))
+           flyspell-issue-welcome-flag
+           show-msg)
       (let* ((binding (where-is-internal 'flyspell-auto-correct-word
                                          nil 'non-ascii))
              (mouse-button (if flyspell-use-mouse-3-for-menu
                                "Mouse-3" "Mouse-2")))
-        (message "Welcome to Flyspell. Use %s to correct words."
-                 (if binding
-                     (format "%s or %s" (key-description binding) mouse-button)
-                   (format "%s" mouse-button))))))
+        (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)))))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-delay-commands ...                                      */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]