emacs-devel
[Top][All Lists]
Advanced

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

Re: beginning-of-defun-comments bug [was: Re: 26.0.90: mark-defun proble


From: Stefan Monnier
Subject: Re: beginning-of-defun-comments bug [was: Re: 26.0.90: mark-defun problem in c-mode]
Date: Sat, 30 Dec 2017 23:26:24 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> +      (if (nth 3 ppss)                  ; in a string
> +          start
> +        (when (nth 4 ppss)              ; in a comment
> +          (setq ppss
> +                (parse-partial-sexp (point) eol nil nil ppss 'syntax-table)))
> +        (catch 'got-it
> +          (while (< (point) eol)
> +            (setq start (point))
> +            (setq ppss (parse-partial-sexp (point) eol nil nil ppss t))
> +            (setq end (if (nth 4 ppss) (nth 8 ppss) eol))
> +            (goto-char start)
> +            (skip-syntax-forward "-" end)
> +            (when (< (point) end)
> +              (throw 'got-it (point)))
> +            (unless (forward-comment 1) ; comment straddles line break.
> +              (throw 'got-it nil))
> +            (setq ppss (syntax-ppss))))))))

Why not use something like

   (>= (forward-comment (point-max)) (line-end-position))

?


        Stefan



reply via email to

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