* [PATCH] Take 2 on org.el: Don't flyspell check within source code blocks
@ 2013-05-25 7:23 Trevor Murphy
2013-05-25 7:23 ` [PATCH] " Trevor Murphy
2013-05-30 0:49 ` [PATCH v2] " Trevor Murphy
0 siblings, 2 replies; 8+ messages in thread
From: Trevor Murphy @ 2013-05-25 7:23 UTC (permalink / raw)
To: emacs-orgmode
Very sorry about the email spam. This fixes the blindingly obvious
double negative in my previous submission.
Thanks,
Trevor
^ permalink raw reply [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 org.el: Don't flyspell check within source code blocks Trevor Murphy
@ 2013-05-25 7:23 ` Trevor Murphy
2013-05-25 15:52 ` Bastien
2013-05-30 0:49 ` [PATCH v2] " Trevor Murphy
1 sibling, 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: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
* [PATCH v2] org.el: Don't flyspell check within source code blocks
2013-05-25 7:23 [PATCH] Take 2 on org.el: Don't flyspell check within source code blocks Trevor Murphy
2013-05-25 7:23 ` [PATCH] " Trevor Murphy
@ 2013-05-30 0:49 ` Trevor Murphy
2013-06-01 6:15 ` Carsten Dominik
1 sibling, 1 reply; 8+ messages in thread
From: Trevor Murphy @ 2013-05-30 0:49 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Trevor Murphy
* lisp/org.el (org-mode-flyspell-verify): Add check for
`org-in-src-block-p'.
TINYCHANGE
---
lisp/org.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/org.el b/lisp/org.el
index 94078f9..77de2d7 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 (org-in-src-block-p)))))
(defun org-remove-flyspell-overlays-in (beg end)
"Remove flyspell overlays in region."
--
1.8.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] org.el: Don't flyspell check within source code blocks
2013-05-30 0:49 ` [PATCH v2] " Trevor Murphy
@ 2013-06-01 6:15 ` Carsten Dominik
2013-06-01 6:35 ` Carsten Dominik
0 siblings, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2013-06-01 6:15 UTC (permalink / raw)
To: Trevor Murphy; +Cc: emacs-orgmode
Hi Trevor,
have you noticed an impact of this patch on normal typing performance?
This is something we need to be extremely careful about.
- Carsten
On 30.5.2013, at 02:49, Trevor Murphy <trevor.m.murphy@gmail.com> wrote:
> * lisp/org.el (org-mode-flyspell-verify): Add check for
> `org-in-src-block-p'.
>
> TINYCHANGE
> ---
> lisp/org.el | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 94078f9..77de2d7 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 (org-in-src-block-p)))))
>
> (defun org-remove-flyspell-overlays-in (beg end)
> "Remove flyspell overlays in region."
> --
> 1.8.3
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] org.el: Don't flyspell check within source code blocks
2013-06-01 6:15 ` Carsten Dominik
@ 2013-06-01 6:35 ` Carsten Dominik
0 siblings, 0 replies; 8+ messages in thread
From: Carsten Dominik @ 2013-06-01 6:35 UTC (permalink / raw)
To: Trevor Murphy; +Cc: emacs-orgmode
On 1.6.2013, at 08:15, Carsten Dominik <carsten.dominik@gmail.com> wrote:
> Hi Trevor,
>
> have you noticed an impact of this patch on normal typing performance?
> This is something we need to be extremely careful about.
Sorry, I see that Matt has already done some profiling. OK, I have applied this patch - lets see how it behaves.
- Carsten
>
> - Carsten
>
> On 30.5.2013, at 02:49, Trevor Murphy <trevor.m.murphy@gmail.com> wrote:
>
>> * lisp/org.el (org-mode-flyspell-verify): Add check for
>> `org-in-src-block-p'.
>>
>> TINYCHANGE
>> ---
>> lisp/org.el | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/lisp/org.el b/lisp/org.el
>> index 94078f9..77de2d7 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 (org-in-src-block-p)))))
>>
>> (defun org-remove-flyspell-overlays-in (beg end)
>> "Remove flyspell overlays in region."
>> --
>> 1.8.3
>>
>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-06-01 6:35 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:23 [PATCH] Take 2 on org.el: Don't flyspell check within source code blocks 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
2013-05-30 0:49 ` [PATCH v2] " Trevor Murphy
2013-06-01 6:15 ` Carsten Dominik
2013-06-01 6:35 ` Carsten Dominik
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).