Subject: Re: bug#25765: [PATCH] Avoid errors when flyspell-generic-check-word-predicate is a lambda.

From: Hong Xu <[email-masked]>
Date: Thu, 16 Feb 2017 14:03:00 -0800

On 2017-02-16 Thu 13:36 GMT-0800, Noam Postavsky <[email-masked]> wrote:

> On Thu, Feb 16, 2017 at 4:30 PM, Hong Xu <[email-masked]> wrote:
>
> I don't think that's the right fix, rather the fboundp should be
> replaced with functionp.

I agree. I've attached a new version of this patch.

From 3011a0c7ce7ce2c505b663743c79915b18fd0404 Mon Sep 17 00:00:00 2001
From: Hong Xu <[email-masked]>
Date: Thu, 16 Feb 2017 13:28:56 -0800
Subject: [PATCH] Avoid errors when flyspell-generic-check-word-predicate is a
 lambda.

	* flyspell.el (flyspell-auto-correct-word, flyspell-word):
	Apply functionp instead of fboundp on
	flyspell-generic-check-word-predicate. This
	avoids (wrong-type-argument symbolp) when
	flyspell-generic-check-word-predicate is a lambda.
---
 lisp/textmodes/flyspell.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index f7683d967905..fecfd2fc3ecb 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1097,8 +1097,8 @@ flyspell-word
            (flyspell-word (flyspell-get-word following))
            start end poss word ispell-filter)
       (if (or (eq flyspell-word nil)
- 	      (and (fboundp flyspell-generic-check-word-predicate)
- 		   (not (funcall flyspell-generic-check-word-predicate))))
+              (and (functionp flyspell-generic-check-word-predicate)
+                   (not (funcall flyspell-generic-check-word-predicate))))
 	  t
 	(progn
 	  ;; destructure return flyspell-word info list.
@@ -1914,7 +1914,7 @@ flyspell-auto-correct-word
   ;; invoke the original binding of M-TAB, if that was recorded.
   (if (and (local-variable-p 'flyspell--prev-meta-tab-binding)
            (commandp flyspell--prev-meta-tab-binding t)
-           (fboundp flyspell-generic-check-word-predicate)
+           (functionp flyspell-generic-check-word-predicate)
            (not (funcall flyspell-generic-check-word-predicate))
            (equal (where-is-internal 'flyspell-auto-correct-word nil t)
                   [?\M-\t]))
-- 
2.11.0