From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Branham Newsgroups: gmane.emacs.bugs Subject: bug#35967: [PATCH] avoid flyspell error if point is at bob Date: Fri, 14 Jun 2019 13:41:29 -0500 Message-ID: <87pnngqaau.fsf@gmail.com> References: <87h89e8g3a.fsf@gmail.com> <83pno1xmz1.fsf@gnu.org> <857e9sb48z.fsf@gmail.com> <83d0jk9oft.fsf@gnu.org> <87tvcsqbes.fsf@gmail.com> <858su4c92c.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="104584"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: mu4e 1.2.0; emacs 27.0.50 Cc: 35967@debbugs.gnu.org To: npostavs@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 14 20:54:00 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hbrKq-000R2i-F4 for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Jun 2019 20:54:00 +0200 Original-Received: from localhost ([::1]:54334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbrKp-0003Zd-FP for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Jun 2019 14:53:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57840) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbr9J-0001QB-J8 for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2019 14:42:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbr9H-0005QQ-Le for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2019 14:42:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52480) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbr9G-0005PU-G5 for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2019 14:42:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hbr9G-00061i-Bj for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2019 14:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Branham Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jun 2019 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35967 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35967-submit@debbugs.gnu.org id=B35967.156053769823131 (code B ref 35967); Fri, 14 Jun 2019 18:42:02 +0000 Original-Received: (at 35967) by debbugs.gnu.org; 14 Jun 2019 18:41:38 +0000 Original-Received: from localhost ([127.0.0.1]:37791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hbr8s-000611-G3 for submit@debbugs.gnu.org; Fri, 14 Jun 2019 14:41:38 -0400 Original-Received: from mail-oi1-f169.google.com ([209.85.167.169]:36440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hbr8q-00060o-S0 for 35967@debbugs.gnu.org; Fri, 14 Jun 2019 14:41:37 -0400 Original-Received: by mail-oi1-f169.google.com with SMTP id w7so2693010oic.3 for <35967@debbugs.gnu.org>; Fri, 14 Jun 2019 11:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=E9XWCpmGbA4rOtoql6EmPZfzAbnSRmNd80foNO4a7o8=; b=n/thdmF0trlHXaBacQqR7NZlcZeu3uY/DejYmg3armWQSQLOSM9yAnllafO+c1xUTD lCic5zDxtIg7298BSBB5goWvcvkTD+roIZAFlMMZZxjb48YxmY/2FSxGVhyURR+9VLeX uCX+wAbAEfv297Pg6ll5DJBT08VHl56RuSbzQnTYv3Z2t79l6rCg/BLVFXyGV6W+fCKK rUw9GfZsmGQ/FbdqCkP7TqPtFlOONnc0plMlNTB66C1EZZkv7cz/ZeI7kba1ifYVQG0h xqWqaJVDSDPqqPwjUDSH4aY3/mbxEqUC1ovzHWdH0QZ5lerUyzxOsehaW+hVzqkR5Y5A /7Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=E9XWCpmGbA4rOtoql6EmPZfzAbnSRmNd80foNO4a7o8=; b=QoqII00v6b1uB9hx28Tk3hV5nH5vArWaMFmpXBrTq9BkFzgQ2o+HGsQ4/AIDSrN1Y4 T/3/Tm/hK8SzreaMHzHwO09p/mEaW1PfT/wqUUWm5zp+ul4d4yA4A4ZummthNcHQFitC 1ipcC8apj+E1Hx73xs2d8XeTVi8JODfYHgEEPV8pN9NLCHHtqRWokFNeCiMANHahQaiH IcBGCRnWhvOWd/5Jd+OHeHzKC7l6oNZ4RVTqXrV6z2Ngru9123jurdco1QigmUOvb4AF SCnTYt95hR5xDbWituxvEMwrYPAp3ySn1hO8SNVF6TUtCGgYOlN1NHtkPAm4oWnKFpw6 HOAQ== X-Gm-Message-State: APjAAAVHD50NaNIZlrmw7X6PAv/uhb1IWn5tWwVJlt8cc/ebaiIQkghC JuvJmA5x2KfK9TA5aRbP5uteR5RW X-Google-Smtp-Source: APXvYqxq0Vro2Y0TTqTuy5vVCWu5AP0JKt4vY/xZUWeGkcpiCADZ8kRON5UUgbatDeIjqRY8b5HIEg== X-Received: by 2002:aca:3143:: with SMTP id x64mr2736390oix.73.1560537690952; Fri, 14 Jun 2019 11:41:30 -0700 (PDT) Original-Received: from mars (cpe-70-114-192-208.austin.res.rr.com. [70.114.192.208]) by smtp.gmail.com with ESMTPSA id s64sm1475475oie.40.2019.06.14.11.41.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 11:41:30 -0700 (PDT) In-reply-to: <858su4c92c.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:160567 Archived-At: --=-=-= Content-Type: text/plain On Fri 14 Jun 2019 at 13:31, npostavs@gmail.com wrote: > Alex Branham 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Avoid-a-flyspell-error-if-point-is-at-beginning-of-b.patch >From f4ecc0a1657e736173f6daeabbe870dae4e8a7f1 Mon Sep 17 00:00:00 2001 From: Alex Branham 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 --=-=-=--