GNU bug report logs - #25765
[PATCH] Avoid errors when flyspell-generic-check-word-predicate is a lambda.

Previous Next

Package: emacs;

Reported by: Hong Xu <hong <at> topbug.net>

Date: Thu, 16 Feb 2017 21:31:01 UTC

Severity: minor

Tags: fixed, patch

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25765 in the body.
You can then email your comments to 25765 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25765; Package emacs. (Thu, 16 Feb 2017 21:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hong Xu <hong <at> topbug.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 16 Feb 2017 21:31:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hong Xu <hong <at> topbug.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Avoid errors when flyspell-generic-check-word-predicate is a
 lambda.
Date: Thu, 16 Feb 2017 13:30:26 -0800
	* flyspell.el (flyspell-auto-correct-word, flyspell-word): Quote
	flyspell-generic-check-word-predicate when applying fboundp on
	it. 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..f05624b55194 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 (fboundp '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)
+           (fboundp '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






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25765; Package emacs. (Thu, 16 Feb 2017 21:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 25765 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Hong Xu <hong <at> topbug.net>
Cc: 25765 <at> debbugs.gnu.org
Subject: Re: bug#25765: [PATCH] Avoid errors when
 flyspell-generic-check-word-predicate is a lambda.
Date: Thu, 16 Feb 2017 16:36:48 -0500
On Thu, Feb 16, 2017 at 4:30 PM, Hong Xu <hong <at> topbug.net> wrote:
> -             (and (fboundp flyspell-generic-check-word-predicate)
> -                  (not (funcall flyspell-generic-check-word-predicate))))
> +              (and (fboundp 'flyspell-generic-check-word-predicate)
> +                   (not (funcall flyspell-generic-check-word-predicate))))

> -           (fboundp flyspell-generic-check-word-predicate)
> +           (fboundp 'flyspell-generic-check-word-predicate)

I don't think that's the right fix, rather the fboundp should be
replaced with functionp.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25765; Package emacs. (Thu, 16 Feb 2017 22:04:02 GMT) Full text and rfc822 format available.

Message #11 received at 25765 <at> debbugs.gnu.org (full text, mbox):

From: Hong Xu <hong <at> topbug.net>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 25765 <at> debbugs.gnu.org
Subject: Re: bug#25765: [PATCH] Avoid errors when
 flyspell-generic-check-word-predicate is a lambda.
Date: Thu, 16 Feb 2017 14:03:00 -0800
[Message part 1 (text/plain, inline)]
On 2017-02-16 Thu 13:36 GMT-0800, Noam Postavsky <npostavs <at> users.sourceforge.net> wrote:

> On Thu, Feb 16, 2017 at 4:30 PM, Hong Xu <hong <at> topbug.net> 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.

[0001-Avoid-errors-when-flyspell-generic-check-word-predic.patch (text/x-diff, inline)]
From 3011a0c7ce7ce2c505b663743c79915b18fd0404 Mon Sep 17 00:00:00 2001
From: Hong Xu <hong <at> topbug.net>
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

[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25765; Package emacs. (Sat, 18 Feb 2017 02:56:03 GMT) Full text and rfc822 format available.

Message #14 received at 25765 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Hong Xu <hong <at> topbug.net>
Cc: 25765 <at> debbugs.gnu.org
Subject: Re: bug#25765: [PATCH] Avoid errors when
 flyspell-generic-check-word-predicate is a lambda.
Date: Fri, 17 Feb 2017 21:56:22 -0500
tags 25765 fixed
close 25765 26.1
# With this patch, new checks can be added via add-function
close 3425 26.1
quit

Hong Xu <hong <at> topbug.net> writes:

> On 2017-02-16 Thu 13:36 GMT-0800, Noam Postavsky <npostavs <at> users.sourceforge.net> wrote:
>
>> On Thu, Feb 16, 2017 at 4:30 PM, Hong Xu <hong <at> topbug.net> 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.
>

Thanks, pushed to master [1: a83b66923c].

1: 2017-02-17 21:50:46 -0500 a83b66923cfb71bb477d7a1f426f7426f91917da
  Avoid errors when flyspell-generic-check-word-predicate is a lambda.




Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 18 Feb 2017 02:56:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 25765 <at> debbugs.gnu.org and Hong Xu <hong <at> topbug.net> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 18 Feb 2017 02:56:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25765; Package emacs. (Sat, 18 Feb 2017 03:29:02 GMT) Full text and rfc822 format available.

Message #21 received at 25765 <at> debbugs.gnu.org (full text, mbox):

From: Hong Xu <hong <at> topbug.net>
To: npostavs <at> users.sourceforge.net
Cc: 25765 <at> debbugs.gnu.org
Subject: Re: bug#25765: [PATCH] Avoid errors when
 flyspell-generic-check-word-predicate is a lambda.
Date: Fri, 17 Feb 2017 19:27:50 -0800
[Message part 1 (text/plain, inline)]
On 02/17/2017 06:56 PM, npostavs <at> users.sourceforge.net wrote:
> tags 25765 fixed
> close 25765 26.1
> # With this patch, new checks can be added via add-function
> close 3425 26.1
> quit
> 
> Hong Xu <hong <at> topbug.net> writes:
> 
>> On 2017-02-16 Thu 13:36 GMT-0800, Noam Postavsky <npostavs <at> users.sourceforge.net> wrote:
>>
>>> On Thu, Feb 16, 2017 at 4:30 PM, Hong Xu <hong <at> topbug.net> 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.
>>
> 
> Thanks, pushed to master [1: a83b66923c].
> 
> 1: 2017-02-17 21:50:46 -0500 a83b66923cfb71bb477d7a1f426f7426f91917da
>   Avoid errors when flyspell-generic-check-word-predicate is a lambda.
> 

Is it possible to back port this fix to the emacs-25 branch? Looks like
this bug was introduced in 6d11f6ed9a1afa6f3903fffeb58159beedeb1d14
which is new in Emacs 25.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25765; Package emacs. (Sat, 18 Feb 2017 08:24:01 GMT) Full text and rfc822 format available.

Message #24 received at 25765 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Hong Xu <hong <at> topbug.net>
Cc: 25765 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net
Subject: Re: bug#25765: [PATCH] Avoid errors when
 flyspell-generic-check-word-predicate is a lambda.
Date: Sat, 18 Feb 2017 10:23:23 +0200
> From: Hong Xu <hong <at> topbug.net>
> Date: Fri, 17 Feb 2017 19:27:50 -0800
> Cc: 25765 <at> debbugs.gnu.org
> 
> > 1: 2017-02-17 21:50:46 -0500 a83b66923cfb71bb477d7a1f426f7426f91917da
> >   Avoid errors when flyspell-generic-check-word-predicate is a lambda.
> > 
> 
> Is it possible to back port this fix to the emacs-25 branch? Looks like
> this bug was introduced in 6d11f6ed9a1afa6f3903fffeb58159beedeb1d14
> which is new in Emacs 25.

Sorry, no.  It's too late for that: the emacs-25 branch is in deep
freeze now.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25765; Package emacs. (Sat, 18 Feb 2017 13:34:01 GMT) Full text and rfc822 format available.

Message #27 received at 25765 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25765 <at> debbugs.gnu.org, Hong Xu <hong <at> topbug.net>
Subject: Re: bug#25765: [PATCH] Avoid errors when
 flyspell-generic-check-word-predicate is a lambda.
Date: Sat, 18 Feb 2017 08:34:39 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> Is it possible to back port this fix to the emacs-25 branch? Looks like
>> this bug was introduced in 6d11f6ed9a1afa6f3903fffeb58159beedeb1d14
>> which is new in Emacs 25.
>
> Sorry, no.  It's too late for that: the emacs-25 branch is in deep
> freeze now.

Also, only the instance in `flyspell-auto-correct-word' was introduced
in Emacs 25; the other case in `flyspell-word' goes back to the original
revision of flyspell.el in 1998 [1: 60371a2e3d], when the variable was
still called `flyspell-generic-check-word-p'.

1: 1998-06-26 01:24:05 +0000 60371a2e3d30618c3f65a5d1c83a9e4c99ee95a2
  Initial revision




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 19 Mar 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 95 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.