emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org.el: Don't flyspell check within source code blocks
@ 2013-05-25  7:17 Trevor Murphy
  2013-05-25  7:17 ` Trevor Murphy
  2013-08-31  6:23 ` Carsten Dominik
  0 siblings, 2 replies; 8+ messages in thread
From: Trevor Murphy @ 2013-05-25  7:17 UTC (permalink / raw)
  To: emacs-orgmode


Hi, list.

I recently started using flyspell, but I wasn't pleased with the spell
checking in my source code blocks.  After digging a bit for a
solution, I found a post to the list with a nice solution[0].
However, it seems no patch was ever submitted.  So, here goes.

If there's a deeper reason this part of the code was never changed,
please enlighten me.  I didn't see any further mailing list
discussion, so I assumed it was still fair game.

Thanks,

Trevor

[0]: http://lists.gnu.org/archive/html/emacs-orgmode/2012-12/msg00764.html

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

* [PATCH] org.el: Don't flyspell check within source code blocks
  2013-05-25  7:17 [PATCH] org.el: Don't flyspell check within source code blocks Trevor Murphy
@ 2013-05-25  7:17 ` Trevor Murphy
  2013-05-25  7:24   ` Trevor Murphy
  2013-08-31  6:23 ` Carsten Dominik
  1 sibling, 1 reply; 8+ messages in thread
From: Trevor Murphy @ 2013-05-25  7:17 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Trevor Murphy

* lisp/org.el (org-mode-flyspell-verify): Check if
  `org-element-at-point' is of type `src-block', and don't flyspell if
  that's the case.

TINYCHANGE
---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 94078f9..81428f5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -23596,7 +23596,8 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
 	 (not (member-ignore-case word (org-get-export-keywords)))
 	 (not (member-ignore-case
 	       word (mapcar 'car org-element-block-name-alist)))
-	 (not (member-ignore-case word '("BEGIN" "END" "ATTR"))))))
+	 (not (member-ignore-case word '("BEGIN" "END" "ATTR")))
+	 (not (not (eq (org-element-type (org-element-at-point)) 'src-block))))))
 
 (defun org-remove-flyspell-overlays-in (beg end)
   "Remove flyspell overlays in region."
-- 
1.8.2.3

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

* [PATCH] org.el: Don't flyspell check within source code blocks
  2013-05-25  7:23 [PATCH] Take 2 on " Trevor Murphy
@ 2013-05-25  7:23 ` Trevor Murphy
  2013-05-25 15:52   ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Trevor Murphy @ 2013-05-25  7:23 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Trevor Murphy

* lisp/org.el (org-mode-flyspell-verify): Check if
  `org-element-at-point' is of type `src-block', and don't flyspell if
  that's the case.

TINYCHANGE
---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 94078f9..ce48bb0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -23596,7 +23596,8 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
 	 (not (member-ignore-case word (org-get-export-keywords)))
 	 (not (member-ignore-case
 	       word (mapcar 'car org-element-block-name-alist)))
-	 (not (member-ignore-case word '("BEGIN" "END" "ATTR"))))))
+	 (not (member-ignore-case word '("BEGIN" "END" "ATTR")))
+	 (not (eq (org-element-type (org-element-at-point)) 'src-block)))))
 
 (defun org-remove-flyspell-overlays-in (beg end)
   "Remove flyspell overlays in region."
-- 
1.8.2.3

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

* Re: [PATCH] org.el: Don't flyspell check within source code blocks
  2013-05-25  7:17 ` Trevor Murphy
@ 2013-05-25  7:24   ` Trevor Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Trevor Murphy @ 2013-05-25  7:24 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Trevor Murphy

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

Ack, what?  Please disregard, I slipped a double negative in somehow.


On Sat, May 25, 2013 at 3:17 AM, Trevor Murphy <trevor.m.murphy@gmail.com>wrote:

> * lisp/org.el (org-mode-flyspell-verify): Check if
>   `org-element-at-point' is of type `src-block', and don't flyspell if
>   that's the case.
>
> TINYCHANGE
> ---
>  lisp/org.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 94078f9..81428f5 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -23596,7 +23596,8 @@ To get rid of the restriction, use
> \\[org-agenda-remove-restriction-lock]."
>          (not (member-ignore-case word (org-get-export-keywords)))
>          (not (member-ignore-case
>                word (mapcar 'car org-element-block-name-alist)))
> -        (not (member-ignore-case word '("BEGIN" "END" "ATTR"))))))
> +        (not (member-ignore-case word '("BEGIN" "END" "ATTR")))
> +        (not (not (eq (org-element-type (org-element-at-point))
> 'src-block))))))
>
>  (defun org-remove-flyspell-overlays-in (beg end)
>    "Remove flyspell overlays in region."
> --
> 1.8.2.3
>
>

[-- Attachment #2: Type: text/html, Size: 1673 bytes --]

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

* Re: [PATCH] org.el: Don't flyspell check within source code blocks
  2013-05-25  7:23 ` [PATCH] " Trevor Murphy
@ 2013-05-25 15:52   ` Bastien
  2013-05-30  0:55     ` Trevor Murphy
  2013-05-30 15:54     ` Matt Lundin
  0 siblings, 2 replies; 8+ messages in thread
From: Bastien @ 2013-05-25 15:52 UTC (permalink / raw)
  To: Trevor Murphy; +Cc: emacs-orgmode

Hi Trevor,

Trevor Murphy <trevor.m.murphy@gmail.com> writes:

> +	 (not (eq (org-element-type (org-element-at-point)) 'src-block)))))

I think `org-in-src-block-p', while a bit less reliable, will be
faster, and reliable/fast enough for this use-case.

Let's see what others think/test.

Thanks,

-- 
 Bastien

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

* Re: [PATCH] org.el: Don't flyspell check within source code blocks
  2013-05-25 15:52   ` Bastien
@ 2013-05-30  0:55     ` Trevor Murphy
  2013-05-30 15:54     ` Matt Lundin
  1 sibling, 0 replies; 8+ messages in thread
From: Trevor Murphy @ 2013-05-30  0:55 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

Thanks, Bastien.  Your suggestion has been working perfectly fine for me.
 Updated patch sent in reply to the first in the chain (I hope ... still
trying to master git send-email).

Trevor

On Sat, May 25, 2013 at 11:52 AM, Bastien <bzg@gnu.org> wrote:

> Hi Trevor,
>
> Trevor Murphy <trevor.m.murphy@gmail.com> writes:
>
> > +      (not (eq (org-element-type (org-element-at-point)) 'src-block)))))
>
> I think `org-in-src-block-p', while a bit less reliable, will be
> faster, and reliable/fast enough for this use-case.
>
> Let's see what others think/test.
>
> Thanks,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1249 bytes --]

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

* Re: [PATCH] org.el: Don't flyspell check within source code blocks
  2013-05-25 15:52   ` Bastien
  2013-05-30  0:55     ` Trevor Murphy
@ 2013-05-30 15:54     ` Matt Lundin
  1 sibling, 0 replies; 8+ messages in thread
From: Matt Lundin @ 2013-05-30 15:54 UTC (permalink / raw)
  To: Bastien; +Cc: Trevor Murphy, emacs-orgmode

Bastien <bzg@gnu.org> writes:

> Hi Trevor,
>
> Trevor Murphy <trevor.m.murphy@gmail.com> writes:
>
>> +	 (not (eq (org-element-type (org-element-at-point)) 'src-block)))))
>
> I think `org-in-src-block-p', while a bit less reliable, will be
> faster, and reliable/fast enough for this use-case.
>
> Let's see what others think/test.

For the record, here are the results of a very unscientific profiling of
the patch above. On my woefully under-powered and aging Atom processor,
For each scenario I typed without errors "The quick brown fox jumps over
the lazy dog."

With the old behavior (i.e., no test for source blocks):

org-mode-flyspell-verify  27          0.005580378   0.0002066806

With the patch above:

org-mode-flyspell-verify  27          0.35359755    0.0130962055

Using (not (org-in-src-block-p)), as Bastien suggests:

org-mode-flyspell-verify  27          0.0112581490  0.0004169684

With org-in-src-block-p, a half of a hundredth of a second spread over
27 characters causes no noticeable slowdowns.

But using org-element-at-point causes the cursor to lag a bit.

So +1 is for (not (org-in-src-block-p)).

Best,
Matt

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

* Re: [PATCH] org.el: Don't flyspell check within source code blocks
  2013-05-25  7:17 [PATCH] org.el: Don't flyspell check within source code blocks Trevor Murphy
  2013-05-25  7:17 ` Trevor Murphy
@ 2013-08-31  6:23 ` Carsten Dominik
  1 sibling, 0 replies; 8+ messages in thread
From: Carsten Dominik @ 2013-08-31  6:23 UTC (permalink / raw)
  To: Trevor Murphy; +Cc: emacs-orgmode


On 25.5.2013, at 09:17, Trevor Murphy <trevor.m.murphy@gmail.com> wrote:

> 
> Hi, list.
> 
> I recently started using flyspell, but I wasn't pleased with the spell
> checking in my source code blocks.  After digging a bit for a
> solution, I found a post to the list with a nice solution[0].
> However, it seems no patch was ever submitted.  So, here goes.
> 
> If there's a deeper reason this part of the code was never changed,
> please enlighten me.  I didn't see any further mailing list
> discussion, so I assumed it was still fair game.

Hi Trevor,

I would be worried that this has noticeable impact in Emacs performance during normal typing.  Are you a fst typist?  Have you noticed anything in this direction?

Thanks!

- Carsten


> 
> Thanks,
> 
> Trevor
> 
> [0]: http://lists.gnu.org/archive/html/emacs-orgmode/2012-12/msg00764.html
> 

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

end of thread, other threads:[~2013-08-31  6:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-25  7:17 [PATCH] org.el: Don't flyspell check within source code blocks Trevor Murphy
2013-05-25  7:17 ` Trevor Murphy
2013-05-25  7:24   ` Trevor Murphy
2013-08-31  6:23 ` Carsten Dominik
  -- strict thread matches above, loose matches on Subject: below --
2013-05-25  7:23 [PATCH] Take 2 on " Trevor Murphy
2013-05-25  7:23 ` [PATCH] " Trevor Murphy
2013-05-25 15:52   ` Bastien
2013-05-30  0:55     ` Trevor Murphy
2013-05-30 15:54     ` Matt Lundin

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).