branch: elpa/evil-nerd-commenter
commit 9450c91c7118b1f32e63ad65620311f0bfb91d90
Author: Christoph Ruegge <[email protected]>
Commit: Christoph Ruegge <[email protected]>

    Bufgix in evilnc--in-comment-p
    
    Take care of the case that there may be more than one font face at pos.
---
 evil-nerd-commenter.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index ae59aa829b..d9ab951596 100644
--- a/evil-nerd-commenter.el
+++ b/evil-nerd-commenter.el
@@ -146,12 +146,15 @@
 
 (defun evilnc--in-comment-p (pos)
   (interactive)
-  (let ((fontface (get-text-property pos 'face)))
-    ;; learn this trick from flyspell
-    (or (string= fontface 'font-lock-comment-face)
-        (string= fontface 'font-lock-comment-delimiter-face)
-        )
-    ))
+  (let ((fontfaces (get-text-property pos 'face)))
+    (when (not (listp fontfaces))
+      (setf fontfaces (list fontfaces)))
+    (delq nil
+          (mapcar #'(lambda (f)
+                      ;; learn this trick from flyspell
+                      (or (string= f 'font-lock-comment-face)
+                          (string= f 'font-lock-comment-delimiter-face)))
+                  fontfaces))))
 
 ;; @return (list beg end)
 (defun evilnc--extend-to-whole-comment (beg end)

Reply via email to