Subject: bug#35967: closed (Re: bug#35967: [PATCH] avoid flyspell error if point is at bob)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 17 Jun 2019 19:06:02 +0000

Your bug report

#35967: [PATCH] avoid flyspell error if point is at bob

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
35967: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35967
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#35967: [PATCH] avoid flyspell error if point is at bob
From: Alex Branham <[email-masked]>
To: Andreas Schwab <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 17 Jun 2019 14:04:53 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

On Fri 14 Jun 2019 at 14:14, Andreas Schwab <[email-masked]> wrote:

>> +    (let ((f (get-text-property (- (point) 1) 'face)))
>
> Perhaps change this to (1- (point)).

Thanks, I made that change and pushed as 1942f4ccba52896e3e97789dc6b51926ad74c591 on the master branch.

Alex

Subject: [PATCH] avoid flyspell error if point is at bob
From: Alex Branham <[email-masked]>
To: [email-masked]
Date: Tue, 28 May 2019 15:43:53 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello -

The attached patch avoids an args-out-of-range error (from
`get-text-property') if `flyspell-prog-mode' is on and point is in a
comment at the beginning of the buffer.

Thanks,
Alex

>From e130dfcb542af667fbef6e6eb867c46eee6d9746 Mon Sep 17 00:00:00 2001
From: Alex Branham <[email-masked]>
Date: Tue, 28 May 2019 15:40:26 -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 bob.  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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index d18916dfd0..e711fe72b2 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -424,8 +424,9 @@ like <img alt=\"Some thing.\">."
 (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 (bobp)
+    (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