typoel icon indicating copy to clipboard operation
typoel copied to clipboard

Typo mode doesn't work after a < character.

Open tmalsburg opened this issue 10 years ago • 5 comments
trafficstars

I have a document with about 130 lines of text and noticed that after a certain line typo-mode doesn't work anymore. This is the line:

“A one-way ANOVA showed ... (p<0.001)."

I played a bit with this to find out what's causing the problem and it seems the < character is the trigger. Typo-mode works before that character but not after. When I replace p<0.001 by p < 0.001 the problem is gone.

I'm using the most recent version of typo-mode from MELPA and a very recent development version of Emacs.

Thanks for typo-mode, by the way. I love it!

tmalsburg avatar Mar 06 '15 01:03 tmalsburg

Thanks for the report, and glad you like typo.el. This is a "feature" in typo.el to prevent typo from doing weird stuff inside an XML tag. If you change typo-disable-electricity-functions to nil, this should be gone.

Let me know if this fixes the problem :-)

jorgenschaefer avatar Mar 06 '15 08:03 jorgenschaefer

Hi Jorgen, what you suggested work.

If the special treatment of the < character is XML-specific, it would make sense to activate it only in XML documents.

By the way, I had a look at typo-in-xml-tag and see two small problems there:

  • XML tags must start with a letter or underscore but the regexp used in `xml-in-xml-tag' also matches digits. At least that's the case in org-mode. Other modes may have different syntax tables.
  • I'm not entirely sure but I think that whitespace between the < and the element name is allowed (< test >) but the regexp doesn't capture that case.

Perhaps, xml-mode has a regexp that you can recycle to match XML tags?

Thanks for the response!

tmalsburg avatar Mar 06 '15 17:03 tmalsburg

Thank you for the feedback :-)

It would indeed make sense to activate this only in XML- or HTML-like modes. Also, restricting the regexp to match only letters and underscore sounds reasonable. I'd rather not match spaces, though, as that's rare and I think it would lead to more false positives than it would avoid bad negatives.

jorgenschaefer avatar Mar 06 '15 17:03 jorgenschaefer

I agree about the spaces, better to ignore that case.

tmalsburg avatar Mar 06 '15 17:03 tmalsburg

@jorgenschaefer see #23, it would be nice to have buffer-local cycle lists, etc..

hendursaga avatar Feb 09 '22 19:02 hendursaga