Fastest but still reliable way to check if in a comment
Philip Kaludercic <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
The conventional way to check if we are in a comment would be to
evaluate
(nth 4 (syntax-ppss))
and see if the result is non-nil. The computation is not cheap, which
is an issue if we are using this function in a loop. Does anyone have
another idea what to do in that case? My best guess would be to check
the face at point:
(memq (get-text-property (point) 'face)
'(font-lock-comment-delimiter-face
font-lock-comment-face))