GNU bug report logs - #31972
27.0.50; syntax-ppss depth incorrect after font-lock syntax-alist

Previous Next

Package: emacs;

Reported by: Brady Trainor <mail <at> bradyt.com>

Date: Mon, 25 Jun 2018 23:32:01 UTC

Severity: normal

Tags: notabug

Found in version 27.0.50

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: Brady Trainor <mail <at> bradyt.com>
Cc: 31972 <at> debbugs.gnu.org
Subject: bug#31972: 27.0.50; syntax-ppss depth incorrect after font-lock syntax-alist
Date: Mon, 25 Jun 2018 19:59:22 -0400
tags 31972 + notabug
quit

Brady Trainor <mail <at> bradyt.com> writes:

> (define-derived-mode dart-mode prog-mode "Dart"
>   ""
>   (setq comment-start "//")
>   (setq comment-end "")
>   (setq font-lock-defaults '(nil nil nil ((?/ . "_ 12")
>                                           (?\n . ">"))))
>   ;; (modify-syntax-entry ?/ "_ 12")
>   ;; (modify-syntax-entry ?\n ">")
>   )

> I open a file and `M-x dart-mode RET`, with contents say
>
> // A comment (with a parenthesized
> // note).
>
> Then with point on beginning of second line, I try `M-: (car
> (syntax-ppss)) RET` and find that depth is reported as 1, rather than 0.
> If I comment out the `font-lock-defaults` expression and instead use
> `modify-syntax-entry` expressions, I get depth 0 throughout.

That looks all correct to me.  In the first case, the "//" doesn't start
a comment, it's only fontified as if it starts a comment.  So of course
when you're inside a paren you'll see depth 1.  In the second case, you
set "//" as a comment start, so you see depth 0.

I think you want

(define-derived-mode dart-mode prog-mode "Dart"
  ""
  (setq comment-start "//")
  (setq comment-end "")
  (setq font-lock-defaults '(nil nil nil nil)) ; Same as '(nil).
  (modify-syntax-entry ?/ "_ 12")
  (modify-syntax-entry ?\n ">")) 




This bug report was last modified 6 years and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.