emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* flyspell and code blocks
@ 2012-04-23 13:57 Julian Burgos
  2012-04-23 14:13 ` Jambunathan K
  0 siblings, 1 reply; 4+ messages in thread
From: Julian Burgos @ 2012-04-23 13:57 UTC (permalink / raw)
  To: Org Mode Mailing List

Hello fellow org'ers,

It is possible to make flyspell to ignore (i.e. do not spell check) the 
text within code blocks (I mean blocks of texts separated by #+begin_src 
and #+end src)?  I did my homework but could not find a good answer.
Many thanks,

Julian

-- 
Julian Mariano Burgos, PhD
Hafrannsóknastofnunin/Marine Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: julian@hafro.is

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

* Re: flyspell and code blocks
  2012-04-23 13:57 flyspell and code blocks Julian Burgos
@ 2012-04-23 14:13 ` Jambunathan K
       [not found]   ` <81397ua64z.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jambunathan K @ 2012-04-23 14:13 UTC (permalink / raw)
  To: Julian Burgos; +Cc: Org Mode Mailing List

Julian Burgos <julian@hafro.is> writes:

> Hello fellow org'ers,
>
> It is possible to make flyspell to ignore (i.e. do not spell check)
> the text within code blocks (I mean blocks of texts separated by
> #+begin_src and #+end src)?  I did my homework but could not find a
> good answer.
> Many thanks,

See 
http://lists.gnu.org/archive/html/help-gnu-emacs/2012-02/msg00162.html

which links to the following bug report
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10804

> Julian

-- 

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

* Re: flyspell and code blocks
       [not found]   ` <81397ua64z.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-12-21 15:37     ` Francesco Pizzolante
  2012-12-22 14:04       ` Jambunathan K
  0 siblings, 1 reply; 4+ messages in thread
From: Francesco Pizzolante @ 2012-12-21 15:37 UTC (permalink / raw)
  To: Jambunathan K; +Cc: Julian Burgos, Org Mode Mailing List

Hi,

Jambunathan K wrote:
> Julian Burgos <julian-YmfcbN36PDQ@public.gmane.org> writes:
>
>> It is possible to make flyspell to ignore (i.e. do not spell check)
>> the text within code blocks (I mean blocks of texts separated by
>> #+begin_src and #+end src)?  I did my homework but could not find a
>> good answer.
>
> See
> http://lists.gnu.org/archive/html/help-gnu-emacs/2012-02/msg00162.html
>
> which links to the following bug report
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10804

I'm not sure whether this issue has been fixed or not.

But, while I was testing Jambunathan's following code:

    ╭────
    │ (defadvice org-mode-flyspell-verify
    │   (after my-org-mode-flyspell-verify activate)
    │   "Don't spell check src blocks."
    │   (setq ad-return-value
    │ 	(and ad-return-value
    │ 	     (not (org-in-src-block-p))
    │ 	     (not (member 'org-block-begin-line (text-properties-at (point))))
    │ 	     (not (member 'org-block-end-line (text-properties-at (point)))))))
    ╰────

I found that it only works when setting the org-src-fontify-natively variable:

    ╭────
    │        (setq org-src-fontify-natively t)
    ╰────

I hope this helps.

An even better solution would be to use flyspell-prog-mode (to spellcheck
comments and strings in source code) within the Org source blocks.

Any idea how to achieve this?

Thanks,
 Francesco

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

* Re: flyspell and code blocks
  2012-12-21 15:37     ` Francesco Pizzolante
@ 2012-12-22 14:04       ` Jambunathan K
  0 siblings, 0 replies; 4+ messages in thread
From: Jambunathan K @ 2012-12-22 14:04 UTC (permalink / raw)
  To: Org mode

"Francesco Pizzolante"
<fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org> writes:

> Hi,
>
> Jambunathan K wrote:
>> Julian Burgos <julian-YmfcbN36PDQ@public.gmane.org> writes:
>>
>>> It is possible to make flyspell to ignore (i.e. do not spell check)
>>> the text within code blocks (I mean blocks of texts separated by
>>> #+begin_src and #+end src)?  I did my homework but could not find a
>>> good answer.
>>
>> See
>> http://lists.gnu.org/archive/html/help-gnu-emacs/2012-02/msg00162.html
>>
>> which links to the following bug report
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10804
>
> I'm not sure whether this issue has been fixed or not.
>
> But, while I was testing Jambunathan's following code:
>
>     ╭────
>     │ (defadvice org-mode-flyspell-verify
>     │   (after my-org-mode-flyspell-verify activate)
>     │   "Don't spell check src blocks."
>     │   (setq ad-return-value
>     │ 	(and ad-return-value
>     │ 	     (not (org-in-src-block-p))
>     │ 	     (not (member 'org-block-begin-line (text-properties-at (point))))
>     │ 	     (not (member 'org-block-end-line (text-properties-at (point)))))))
>     ╰────
>
> I found that it only works when setting the org-src-fontify-natively variable:
>
>     ╭────
>     │        (setq org-src-fontify-natively t)
>     ╰────
>
> I hope this helps.


The following replacement wouldn't depend on fontification.

(defadvice org-mode-flyspell-verify
  (after my-org-mode-flyspell-verify activate)
  "Don't spell check src blocks."
  (setq ad-return-value
	(and ad-return-value
	     (not (eq (org-element-type (org-element-at-point)) 'src-block)))))


>
> an even better solution would be to use flyspell-prog-mode (to spellcheck
> comments and strings in source code) within the Org source blocks.
>
> Any idea how to achieve this?
>
> Thanks,
>  Francesco
>
>

-- 

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

end of thread, other threads:[~2012-12-22 14:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 13:57 flyspell and code blocks Julian Burgos
2012-04-23 14:13 ` Jambunathan K
     [not found]   ` <81397ua64z.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-21 15:37     ` Francesco Pizzolante
2012-12-22 14:04       ` Jambunathan K

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