From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: flyspell and code blocks Date: Sat, 22 Dec 2012 19:34:48 +0530 Message-ID: <87k3sa41vf.fsf@gmail.com> References: <4F955FC4.7050600@hafro.is> <81397ua64z.fsf@gmail.com> <87licr5scz.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmPfi-0006Gp-VQ for emacs-orgmode@gnu.org; Sat, 22 Dec 2012 09:03:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TmPfc-0002nn-9S for emacs-orgmode@gnu.org; Sat, 22 Dec 2012 09:03:26 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:54809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmPfc-0002nf-2P for emacs-orgmode@gnu.org; Sat, 22 Dec 2012 09:03:20 -0500 Received: by mail-pa0-f44.google.com with SMTP id hz11so3369946pad.3 for ; Sat, 22 Dec 2012 06:03:19 -0800 (PST) In-Reply-To: <87licr5scz.fsf@somewhere.org> (Francesco Pizzolante's message of "Fri, 21 Dec 2012 16:37:16 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org mode "Francesco Pizzolante" writes: > Hi, > > Jambunathan K wrote: >> Julian Burgos 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=3D10804 > > I'm not sure whether this issue has been fixed or not. > > But, while I was testing Jambunathan's following code: > > =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 > =E2=94=82 (defadvice org-mode-flyspell-verify > =E2=94=82 (after my-org-mode-flyspell-verify activate) > =E2=94=82 "Don't spell check src blocks." > =E2=94=82 (setq ad-return-value > =E2=94=82 (and ad-return-value > =E2=94=82 (not (org-in-src-block-p)) > =E2=94=82 (not (member 'org-block-begin-line (text-properties-a= t (point)))) > =E2=94=82 (not (member 'org-block-end-line (text-properties-at = (point))))))) > =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 > > I found that it only works when setting the org-src-fontify-natively vari= able: > > =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 > =E2=94=82 (setq org-src-fontify-natively t) > =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 > > 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 > > --=20