6

Original Response: I was trying to figure out how in auctex mode latex doesn't seem to highlight any latex functions with flyspell turned on. Is this a custom dictionary file or how is this implemented? Can this be easily incorporated into an org-mode file so it doesn't highlight inserted latex code that will get exported.

Edit: Simple example taken from top of file and in the text. Basically so latex syntax like ref or label inside {} won't be spell checked (this has been fixed by using (setq ispell-parser tex). Then also setting up a function that specific labels with #+ as the first text on the line won't be checked. I would want the caption checked but not #+LABEL: or #+TYP_TODO: (not shown. Also a way to add TODO keywords to not get checked. I can think of a way to do this is on startup add these to the LOCALWORDS: ispell places at the bottom of the file if not already there but is there an easier or better way to do this.

#+TAGS: NOTE REPORT export noexport MEETING
#+TYP_TODO: TODO Weekly WAITING NEXT | Meeting DONE
#+STARTUP: hidestars content hideblocks

The exponential running mean is shown for various alpha values in Figure \ref{fig:saturation_varying_alphaval_00f6set2}.  
     #+CAPTION:    Plot of varying alpha values for the exponential running mean ($EM$) with $S_{min} = 0.0008 \text{ and } P_m = 0.20$
     #+LABEL:      fig:saturation_varying_alphaval_00f6set2
     #+ATTR_LaTeX: width=0.4\textwidth placement=[h!tb]
J Spen
  • 2,614
  • 4
  • 26
  • 41

2 Answers2

3

flyspell internally uses ispell-mode. To change the way that ispell parses files set the variable ispell-parser to 'tex.

(add-hook 'org-mode-hook (lambda () (setq ispell-parser 'tex)))
pmr
  • 58,701
  • 10
  • 113
  • 156
2

Most likely auctex is using flyspell-mode-predicate to define what portions of the buffer shouldn't be spellchecked. (This answer shows how to do something similar for MoinMoinWiki.) org-mode already has such a function, org-mode-flyspell-verify, which apparently doesn't work properly for you... A quick look at the source suggests that org-remove-flyspell-overlays-in should be called for buffer portions containing code samples etc.

Sorry about the handwavy answer; marking this as community wiki to invite improvements.

Community
  • 1
  • 1
legoscia
  • 39,593
  • 22
  • 116
  • 167
  • No worries, that helped but yeah for some reason doesn't remove keywords in org like #+TYP_TODO at the top of the buffer. I think anything in this format or labeled as a tag at the top of the buffer should be ignored. This is atleast from my look at it as well what it says org-mode-flyspell-verify does. It does work for making sure doesn't overlay errors in spelling in links so makes me think function is working correctly which it also says it does. The answer below works well to get it to recognize tex just curious if anyone has implemented something specifically for org. – J Spen Jul 25 '12 at 15:25
  • 1
    Will need to comb through that code because not entirely sure what is going on when the elisp gets that complicated because not extremely proficient in it. I think it should be easy to update to #+ but I would need to have a list of keywords that behind that it wouldn't check. I'll keep this updated if I can figure out how to do it from that. – J Spen Jul 25 '12 at 15:40