unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Brady Trainor <mail@bradyt.com>
Cc: 31972@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	[thread overview]
Message-ID: <87lgb2pgdh.fsf@gmail.com> (raw)
In-Reply-To: <20180625232635.3778010261@mailuser.nyi.internal> (Brady Trainor's message of "Mon, 25 Jun 2018 16:26:34 -0700")

tags 31972 + notabug
quit

Brady Trainor <mail@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 ">")) 





      reply	other threads:[~2018-06-25 23:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 23:26 bug#31972: 27.0.50; syntax-ppss depth incorrect after font-lock syntax-alist Brady Trainor
2018-06-25 23:59 ` Noam Postavsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lgb2pgdh.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=31972@debbugs.gnu.org \
    --cc=mail@bradyt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).