[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35967: [PATCH] avoid flyspell error if point is at bob
From: |
Alex Branham |
Subject: |
bug#35967: [PATCH] avoid flyspell error if point is at bob |
Date: |
Fri, 14 Jun 2019 13:17:31 -0500 |
User-agent: |
mu4e 1.2.0; emacs 27.0.50 |
On Tue 11 Jun 2019 at 09:39, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: npostavs@gmail.com
>> Cc: Alex Branham <alex.branham@gmail.com>, 35967@debbugs.gnu.org
>> Date: Tue, 11 Jun 2019 10:12:12 -0400
>>
>> it seems fairly easy to remember that bobp should treat a narrowed
>> buffer the same way that beginning-of-buffer will.
>
> Not for this old curmudgeon, evidently.
Here's a new patch that checks for (equal (point) 1) rather than using
bobp. OK to push to master?
Alex
>From c7d7ccaf5b94a1146e4664ec21564f982686fcab Mon Sep 17 00:00:00 2001
From: Alex Branham <alex.branham@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..7237a0f8ab 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) 1)
+ ;; (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