Function: evil-in-comment-p

evil-in-comment-p is a byte-compiled function defined in evil-common.el.

Signature

(evil-in-comment-p &optional POS)

Documentation

Check if POS is within a comment according to current syntax.

If POS is nil, (point) is used. The return value is the beginning position of the comment.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-in-comment-p (&optional pos)
  "Check if POS is within a comment according to current syntax.
If POS is nil, (point) is used. The return value is the beginning
position of the comment."
  (setq pos (or pos (point)))
  (let ((chkpos
         (cond
          ((eobp) pos)
          ((= (char-syntax (char-after)) ?<) (1+ pos))
          ((and (not (zerop (logand (car (syntax-after (point)))
                                    (ash 1 16))))
                (not (zerop (logand (or (car (syntax-after (1+ (point)))) 0)
                                    (ash 1 17)))))
           (+ pos 2))
          ((and (not (zerop (logand (car (syntax-after (point)))
                                    (ash 1 17))))
                (not (zerop (logand (or (car (syntax-after (1- (point)))) 0)
                                    (ash 1 16)))))
           (1+ pos))
          (t pos))))
    (let ((syn (save-excursion (syntax-ppss chkpos))))
      (and (nth 4 syn) (nth 8 syn)))))