emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 5674746 49/62: Added function to check if point is in a co


From: Ian Dunn
Subject: [elpa] master 5674746 49/62: Added function to check if point is in a comment
Date: Sat, 9 Dec 2017 14:34:05 -0500 (EST)

branch: master
commit 567474608b0fc1e69cbf8109b6df3ed4d7725f71
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    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

[Prev in Thread] Current Thread [Next in Thread]