help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to check whether the current line is a comment-only one?


From: Stefan Monnier
Subject: Re: How to check whether the current line is a comment-only one?
Date: Thu, 18 Aug 2016 03:44:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> is there a predicate function to determine whether the line the point is
> in is entirely a comment line?

I don't think there is one yet.  Depending on what you mean by "entirely
a comment", it could be:

    (save-excursion
      (forward-line 0)
      (< (line-end-position)
         (let ((ppss (syntax-ppss)))
           (when (nth 4 ppss)
             (goto-char (nth 8 ppss)))
           (forward-comment (point-max))
           (point))))


-- Stefan




reply via email to

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