Hacker News new | ask | show | jobs
by _delirium 4307 days ago
> Specifically, language recognition is not just regexes in emacs.

I know there's Semantic [1], but do the typical major modes actually use it? The first line of Semantic's manual says: Ordinarily, Emacs uses regular expressions (and syntax tables) to analyze source code for purposes such as syntax highlighting.

[1] http://www.gnu.org/software/emacs/manual/html_mono/semantic....

2 comments

Yes, tit the default mode is through regexs, and most of the modes use it.

But I think the OP's point was you are not limited by it, besides semantic (which I haven't never bothered to setup, there is js2-mode[0] as examples of modes that don't use regexps to operate on the language. There is even js2-refactor[1] built on top of it. You can read about js2-mode origin story here[2], and you would see that lack of threads in elisp hindered its development.

[0]: https://github.com/mooz/js2-mode [1]: https://github.com/magnars/js2-refactor.el [2]: http://steve-yegge.blogspot.com/2008/03/js2-mode-new-javascr...

Apologies for not responding earlier. As indicated in a sibling post; yes, I believe most language recognition is done with the old style. Mainly because it is fast and works for the majority of use cases, though, and not because it is required to be that way.

I understand, on principle, why this is not ideal. In practice, I have trouble disagreeing with it. I do find autocomplete nice; though, I have also found that in the instances where I'm having to rely on autocomplete, I'd have been better off using the documentation of whatever I'm doing for a bit to actually have solid grounding before embarking on code.

My point was exactly as the sibling said, that this is by no means all emacs can do.