From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andreas Matthias Newsgroups: gmane.emacs.help Subject: SMIE: Indentation after comments Date: Tue, 6 Oct 2020 17:34:06 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27093"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 06 17:35:24 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPozs-0006wF-A7 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 06 Oct 2020 17:35:24 +0200 Original-Received: from localhost ([::1]:48112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPozr-0003zI-Af for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 06 Oct 2020 11:35:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPoyr-0003fM-Qx for help-gnu-emacs@gnu.org; Tue, 06 Oct 2020 11:34:21 -0400 Original-Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:34391) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPoyp-0006nX-OT for help-gnu-emacs@gnu.org; Tue, 06 Oct 2020 11:34:21 -0400 Original-Received: by mail-ed1-x535.google.com with SMTP id x1so387377eds.1 for ; Tue, 06 Oct 2020 08:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=z03LUY2dKUSyDp1BlfRkEceRAfq1z/4nutszOjwHu+4=; b=K3i9+iOTzyVY+06DvN1aVCkjRNOeIBhzEkHZFA4Tz086ERcScmXI061l6lvcWQf7fH tQknOcR0IATk5+juv+sEvq4tQ0CskhFpbeE/fpuv6gYqMqdsv+vbvVq9Xxu9Ezoa+K6r 4QC4ZdGr0fnX7M5vEg62eK5Jbhq7zLCbNryeVjhshuPfFZBlsntEB7uPWkqhVjyPwMBy hiiMeOdNHRnD5eC9jl8h1BihpOzS8ahQ7Qs86fAtyjqN+ydYgvaIlTAW314ZpAUQJCO4 m/bBUuin8K5VZvPtRQHurC0q9+A1EFMpE8gFRe1ciCC9ZJ22aFD9dy5a0j+5gf/6BcUI DrCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=z03LUY2dKUSyDp1BlfRkEceRAfq1z/4nutszOjwHu+4=; b=EioXTW0mdwGm2ROH9PZSTdFQkyvQ2KAToUxbdnXfWAAfPoTEc4DRY11pvBHEw5tzk1 QqdLTX4c32HFf1gYc9IIuDAP+jK6tBVR5LIOm5zUlCoOH5g0MTWpR8BzmdRSYuSUhHwc L8ADVkXsBlQcYXzv3p4z30WiYT0zkZHhQ+SMVAtwIfVDpJIoaqt3Zr7KYVeo+SfLvNj8 +zZmTeGVQXZdoW4lHYTNBb9rFid67CVSxVRewpwdPAmSbunqTJqui192J0nVTcks1O/J MjLpmN7VE/z2+fvSnYpapq7h7S3+ae5hOCVm01ecR/eIwG43DwIGGxSQ5M5B5wgku/GS ZvVA== X-Gm-Message-State: AOAM533Xq+ZrO1uSU2V8ulCc+JCVhjGqRs3g72jm7Gxff5j75z36zzZK NF18xlWzsmAPapb3MSi9O9BRmoP/dvYxofvVT0NY9wcCI+XFhQ== X-Google-Smtp-Source: ABdhPJxJv9eHN9H+Dup0UU/cin+LdiW/oSFv8bsa6AwHB1Gce2YVpuh4RdF4VLzWn2VROiGJlh5hCwz5Ye+sDQrYb6E= X-Received: by 2002:aa7:d30f:: with SMTP id p15mr5964374edq.256.1601998457723; Tue, 06 Oct 2020 08:34:17 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=andreas.matthias@gmail.com; helo=mail-ed1-x535.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124334 Archived-At: The last line of the following example is not indented correctly whereas the second line is correct. The difference is just a space before the semi-colon. How can I fix this? ============================================================ int a /**/ ; int b; int a /**/; int b; ============================================================ Here is the code: (require 'smie) (setq foobar-grammar (smie-prec2->grammar (smie-bnf->prec2 `((insts (insts ";" insts) (inst)) (inst ("int" id)) (id)) '((assoc ";"))))) (defun foobar-rules (kind token) (message "rule: (%s . %s) at point %d" kind token (point)) (pcase (cons kind token) ;; ??? )) (define-derived-mode foobar-mode prog-mode "foobar" :syntax-table nil (modify-syntax-entry ?/ ". 124") (modify-syntax-entry ?* ". 23b") (modify-syntax-entry ?\n ">") (setq comment-start "//") (smie-setup foobar-grammar #'foobar-rules) (font-lock-add-keywords nil '(("int" . font-lock-keyword-face))) (font-lock-mode) (font-lock-ensure (point-min) (point-max)))