branch: master
commit 567474608b0fc1e69cbf8109b6df3ed4d7725f71
Author: Ian Dunn <du...@gnu.org>
Commit: Ian Dunn <du...@gnu.org>

    Added function to check if point is in a comment
    
    * paced.el (paced-in-comment-p): New defun.
      (paced-exclude-function): Mention it as a possible value.
---
 paced.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/paced.el b/paced.el
index 3c086f8..a2b970a 100644
--- a/paced.el
+++ b/paced.el
@@ -440,7 +440,15 @@ since population mostly uses temporary buffers.")
 This should be a function of no arguments that returns non-nil if
 the current thing-at-point should be excluded from paced dictionaries.
 
-By default, this allows everything.")
+By default, this allows everything.
+
+A useful function for this is `paced-in-comment-p'.")
+
+(defun paced-in-comment-p (&optional pos)
+  "Return non-nil if POS is in a comment.
+
+If POS is not specified, defaults to `point'."
+  (nth 8 (syntax-ppss (or pos (point)))))
 
 (defun paced-excluded-p ()
   "Return non-nil to exclude current thing at point.

Reply via email to