unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35967: [PATCH] avoid flyspell error if point is at bob
@ 2019-05-28 20:43 Alex Branham
  2019-05-29 16:08 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Branham @ 2019-05-28 20:43 UTC (permalink / raw)
  To: 35967

[-- Attachment #1: Type: text/plain, Size: 192 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Avoid-a-flyspell-error-if-point-is-at-beginning-of-b.patch --]
[-- Type: text/x-patch, Size: 1288 bytes --]

From e130dfcb542af667fbef6e6eb867c46eee6d9746 Mon Sep 17 00:00:00 2001
From: Alex Branham <alex.branham@gmail.com>
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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-06-18 12:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-28 20:43 bug#35967: [PATCH] avoid flyspell error if point is at bob Alex Branham
2019-05-29 16:08 ` Eli Zaretskii
2019-05-30 11:58   ` Basil L. Contovounesios
2019-06-11 14:12   ` npostavs
2019-06-11 14:39     ` Eli Zaretskii
2019-06-14 18:17       ` Alex Branham
2019-06-14 18:31         ` npostavs
2019-06-14 18:41           ` Alex Branham
2019-06-14 19:14             ` Andreas Schwab
2019-06-17 19:04               ` Alex Branham
2019-06-18 12:18   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).