GNU bug report logs - #35967
[PATCH] avoid flyspell error if point is at bob

Previous Next

Package: emacs;

Reported by: Alex Branham <alex.branham <at> gmail.com>

Date: Tue, 28 May 2019 20:45:01 UTC

Severity: normal

Tags: patch

Done: Alex Branham <alex.branham <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Alex Branham <alex.branham <at> gmail.com>
To: npostavs <at> gmail.com
Cc: Eli Zaretskii <eliz <at> gnu.org>, 35967 <at> debbugs.gnu.org
Subject: Re: bug#35967: [PATCH] avoid flyspell error if point is at bob
Date: Fri, 14 Jun 2019 13:41:29 -0500
[Message part 1 (text/plain, inline)]
On Fri 14 Jun 2019 at 13:31, npostavs <at> gmail.com wrote:

> Alex Branham <alex.branham <at> gmail.com> writes:
>
>> Here's a new patch that checks for (equal (point) 1) rather than using
>> bobp. OK to push to master?
>
>> +  (unless (eql (point) 1)
>> +    ;; (point) is next char after the word. Must check one char before.
>> +    (let ((f (get-text-property (- (point) 1) 'face)))
>
> This will do the wrong thing when point is at the beginning of a
> narrowed buffer.  Score one point for bobp?

Oh, of course. Here it is with (point-min), which should work I think.

Alex

[0001-Avoid-a-flyspell-error-if-point-is-at-beginning-of-b.patch (text/x-patch, inline)]
From f4ecc0a1657e736173f6daeabbe870dae4e8a7f1 Mon Sep 17 00:00:00 2001
From: Alex Branham <alex.branham <at> gmail.com>
Date: Fri, 14 Jun 2019 13:15:36 -0500
Subject: [PATCH] Avoid a flyspell error if point is at beginning of buffer

* lisp/textmodes/flyspell.el (flyspell-generic-progmode-verify): Check
if point is at the beginning of the buffer.  This prevents an error
when e.g. 'flyspell-auto-correct-word' gets called with point at the
beginning of the buffer.
---
 lisp/textmodes/flyspell.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index d18916dfd0..22f9db4363 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -423,9 +423,10 @@ flyspell-prog-text-faces
 
 (defun flyspell-generic-progmode-verify ()
   "Used for `flyspell-generic-check-word-predicate' in programming modes."
-  ;; (point) is next char after the word. Must check one char before.
-  (let ((f (get-text-property (- (point) 1) 'face)))
-    (memq f flyspell-prog-text-faces)))
+  (unless (eql (point) (point-min))
+    ;; (point) is next char after the word. Must check one char before.
+    (let ((f (get-text-property (- (point) 1) 'face)))
+      (memq f flyspell-prog-text-faces))))
 
 ;; Records the binding of M-TAB in effect before flyspell was activated.
 (defvar flyspell--prev-meta-tab-binding)
-- 
2.21.0


This bug report was last modified 6 years and 56 days ago.

Previous Next


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