emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Miquel" <sebastien.miquel@posteo.eu>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-compat.el (org-mode-flyspell-verify): Do not spell check code in headline
Date: Sun, 7 Mar 2021 17:27:18 +0100	[thread overview]
Message-ID: <8d13a201-8243-9c7a-93eb-48f1d7fb9ec5@posteo.eu> (raw)

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


Currently code and verbatim snippets, and LaTeX fragments are spell
checked by `flyspell` if they're in a headline.

The attached patch fixes that.

Sébastien Miquel

[-- Attachment #2: 0001-org-compat.el-org-mode-flyspell-verify-Do-not-check-.patch --]
[-- Type: text/x-patch, Size: 1625 bytes --]

From b4291ce0ea455af499e75d3c9313183a0e8f46ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= <sebastien.miquel@posteo.eu>
Date: Sun, 7 Mar 2021 17:06:34 +0100
Subject: [PATCH] org-compat.el (org-mode-flyspell-verify): Do not check code
 in headline

* lisp/org-compat.el (org-mode-flyspell-verify): Do not spell check
code, verbatim and LaTeX fragments in headline title.
 lisp/org-compat.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 8cbf33137..3d45bed7f 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -1025,8 +1025,7 @@ ELEMENT is the element at point."
 (defun org-mode-flyspell-verify ()
   "Function used for `flyspell-generic-check-word-predicate'."
   (if (org-at-heading-p)
-      ;; At a headline or an inlinetask, check title only.  This is
-      ;; faster than relying on `org-element-at-point'.
+      ;; At a headline or an inlinetask, check title only.
       (and (save-excursion (beginning-of-line)
 			   (and (let ((case-fold-search t))
 				  (not (looking-at-p "\\*+ END[ \t]*$")))
@@ -1035,7 +1034,9 @@ ELEMENT is the element at point."
 	   (match-beginning 4)
 	   (>= (point) (match-beginning 4))
 	   (or (not (match-beginning 5))
-	       (< (point) (match-beginning 5))))
+	       (< (point) (match-beginning 5)))
+           ;; Ignore checks in code, verbatim and others.
+           (org--flyspell-object-check-p (org-element-at-point)))
     (let* ((element (org-element-at-point))
 	   (post-affiliated (org-element-property :post-affiliated element)))

             reply	other threads:[~2021-03-07 16:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 16:27 Sébastien Miquel [this message]
2021-03-15  2:56 ` [PATCH] org-compat.el (org-mode-flyspell-verify): Do not spell check code in headline Kyle Meyer
2021-03-15  6:40   ` Sébastien Miquel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d13a201-8243-9c7a-93eb-48f1d7fb9ec5@posteo.eu \
    --to=sebastien.miquel@posteo.eu \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).