Re: [O] [PATCH] org.el: Don't flyspell check within source code blocks
On 25.5.2013, at 09:17, Trevor Murphy trevor.m.mur...@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
Re: [O] [PATCH] org.el: Don't flyspell check within source code blocks
Bastien b...@gnu.org writes: Hi Trevor, Trevor Murphy trevor.m.mur...@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.353597550.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
Re: [O] [PATCH] org.el: Don't flyspell check within source code blocks
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 b...@gnu.org wrote: Hi Trevor, Trevor Murphy trevor.m.mur...@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
[O] [PATCH] org.el: Don't flyspell check within source code blocks
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
[O] [PATCH] org.el: Don't flyspell check within source code blocks
* 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
Re: [O] [PATCH] org.el: Don't flyspell check within source code blocks
Ack, what? Please disregard, I slipped a double negative in somehow. On Sat, May 25, 2013 at 3:17 AM, Trevor Murphy trevor.m.mur...@gmail.comwrote: * 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
[O] [PATCH] org.el: Don't flyspell check within source code blocks
* 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
Re: [O] [PATCH] org.el: Don't flyspell check within source code blocks
Hi Trevor, Trevor Murphy trevor.m.mur...@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