GNU bug report logs - #75883
29.4; csharp-ts-mode missing indent rules for using statement and lambda

Previous Next

Package: emacs;

Reported by: dino chiesa <dpchiesa <at> hotmail.com>

Date: Sun, 26 Jan 2025 23:38:01 UTC

Severity: wishlist

Found in version 29.4

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75883 in the body.
You can then email your comments to 75883 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#75883; Package emacs. (Sun, 26 Jan 2025 23:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to dino chiesa <dpchiesa <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 26 Jan 2025 23:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: dino chiesa <dpchiesa <at> hotmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 29.4; csharp-ts-mode missing indent rules for using statement and
 lambda
Date: Sun, 26 Jan 2025 23:32:09 +0000
[Message part 1 (text/plain, inline)]
In csharp-ts-mode, the variable csharp-ts-mode--indent-rules holds the
indent rules relevant to csharp that get set into
treesit-simple-indent-rules.

In the csharp-ts-mode--indent-rules list, there is no rule handles using
statements, nor is there one for lambda expressions. The result is, when
I am editing a C# module with something like this:

    using (ZipFile zip = new ZipFile())
 {
         ...
        }


... and press TAB on the line with the open curly, nothing happens. I
would expect it to properly indent the curly, resulting in:

    using (ZipFile zip = new ZipFile())
    {
         ...
        }


The TAB properly invokes indent-for-tab-command, which cascades, via
indent-line-function, to treesit-indent. But it does nothing.

Similarly, if my code uses a lambda to set an Action type, like so:

    Action<Int64> createProgress = (x) =>
 {
        ...
  };


...pressing TAB on the line with the open curly does nothing. I would
expect it to properly indent the open curly.

My diagnosis is: there is no rule to handle the using
statement, nor is there a rule for the lambda_expression in csharp-ts-mode--indent-rules. As
a result, in either case, the open curly does not get properly indented.

If I modify csharp-ts-mode--indent-rules to include rules for these
syntax elements, like so:

  ((parent-is "using_statement") parent-bol 0)
  ((parent-is "lambda_expression") parent-bol 0)

...then a TAB will properly indent the open curlies in these situations.

This is how I monkey-patched it in my own init file:

  (eval-after-load "csharp-mode"
    '(progn
       (setf (cdr (car csharp-ts-mode--indent-rules))
             (cons
              '((parent-is "using_statement") parent-bol 0)
              (cdr (car csharp-ts-mode--indent-rules))))
       (setf (cdr (car csharp-ts-mode--indent-rules))
             (cons
              '((parent-is "lambda_expression") parent-bol 0)
              (cdr (car csharp-ts-mode--indent-rules))))
       (setq-local treesit-simple-indent-rules csharp-ts-mode--indent-rules)
  ))


After doing this, when I press TAB on the line with the open curlies in
the above situations, the open curly is properly indented.


In GNU Emacs 29.4 (build 2, x86_64-w64-mingw32) of 2024-07-05 built on
 AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.26100
System Description: Microsoft Windows 10 Home (v10.0.2009.26100.2894)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation=aot
 --without-compress-install --with-sqlite3 --with-tree-sitter
 CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

(NATIVE_COMP present but libgccjit not available)

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252

Major mode: ELisp/d

Minor modes in effect:
  display-line-numbers-mode: t
  global-hl-line-mode: t
  hl-line-mode: t
  recentf-mode: t
  auto-insert-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  override-global-mode: t
  default-text-scale-mode: t
  indent-bars-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
~/elisp/json-reformat hides c:/users/dpchi/.emacs.d/elpa/json-reformat-20220905.2342/json-reformat
~/elisp/protobuf-mode hides c:/users/dpchi/.emacs.d/elpa/protobuf-mode-20240823.1417/protobuf-mode
~/elisp/wgrep hides c:/users/dpchi/.emacs.d/elpa/wgrep-20230203.1214/wgrep
c:/users/dpchi/.emacs.d/elpa/transient-20241224.2234/transient hides c:/emacs/share/emacs/29.4/lisp/transient
c:/users/dpchi/.emacs.d/elpa/jsonrpc-1.0.25/jsonrpc hides c:/emacs/share/emacs/29.4/lisp/jsonrpc
c:/users/dpchi/.emacs.d/elpa/use-package-2.4.6/use-package hides c:/emacs/share/emacs/29.4/lisp/use-package/use-package
c:/users/dpchi/.emacs.d/elpa/use-package-2.4.6/use-package-lint hides c:/emacs/share/emacs/29.4/lisp/use-package/use-package-lint
c:/users/dpchi/.emacs.d/elpa/use-package-2.4.6/use-package-jump hides c:/emacs/share/emacs/29.4/lisp/use-package/use-package-jump
c:/users/dpchi/.emacs.d/elpa/use-package-2.4.6/use-package-ensure hides c:/emacs/share/emacs/29.4/lisp/use-package/use-package-ensure
c:/users/dpchi/.emacs.d/elpa/use-package-2.4.6/use-package-ensure-system-package hides c:/emacs/share/emacs/29.4/lisp/use-package/use-package-ensure-system-package
c:/users/dpchi/.emacs.d/elpa/use-package-2.4.6/use-package-diminish hides c:/emacs/share/emacs/29.4/lisp/use-package/use-package-diminish
c:/users/dpchi/.emacs.d/elpa/use-package-2.4.6/use-package-delight hides c:/emacs/share/emacs/29.4/lisp/use-package/use-package-delight
c:/users/dpchi/.emacs.d/elpa/use-package-2.4.6/use-package-core hides c:/emacs/share/emacs/29.4/lisp/use-package/use-package-core
c:/users/dpchi/.emacs.d/elpa/use-package-2.4.6/use-package-bind-key hides c:/emacs/share/emacs/29.4/lisp/use-package/use-package-bind-key
c:/users/dpchi/.emacs.d/elpa/xref-1.7.0/xref hides c:/emacs/share/emacs/29.4/lisp/progmodes/xref
c:/users/dpchi/.emacs.d/elpa/verilog-mode-2024.10.9.140346409/verilog-mode hides c:/emacs/share/emacs/29.4/lisp/progmodes/verilog-mode
c:/users/dpchi/.emacs.d/elpa/project-0.11.1/project hides c:/emacs/share/emacs/29.4/lisp/progmodes/project
c:/users/dpchi/.emacs.d/elpa/idlwave-6.5.1/idlwave hides c:/emacs/share/emacs/29.4/lisp/progmodes/idlwave
c:/users/dpchi/.emacs.d/elpa/idlwave-6.5.1/idlw-toolbar hides c:/emacs/share/emacs/29.4/lisp/progmodes/idlw-toolbar
c:/users/dpchi/.emacs.d/elpa/idlwave-6.5.1/idlw-shell hides c:/emacs/share/emacs/29.4/lisp/progmodes/idlw-shell
c:/users/dpchi/.emacs.d/elpa/idlwave-6.5.1/idlw-help hides c:/emacs/share/emacs/29.4/lisp/progmodes/idlw-help
c:/users/dpchi/.emacs.d/elpa/idlwave-6.5.1/idlw-complete-structtag hides c:/emacs/share/emacs/29.4/lisp/progmodes/idlw-complete-structtag
c:/users/dpchi/.emacs.d/elpa/flymake-1.3.7/flymake hides c:/emacs/share/emacs/29.4/lisp/progmodes/flymake
c:/users/dpchi/.emacs.d/elpa/eglot-1.17/eglot hides c:/emacs/share/emacs/29.4/lisp/progmodes/eglot
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox hides c:/emacs/share/emacs/29.4/lisp/org/ox
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-texinfo hides c:/emacs/share/emacs/29.4/lisp/org/ox-texinfo
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-publish hides c:/emacs/share/emacs/29.4/lisp/org/ox-publish
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-org hides c:/emacs/share/emacs/29.4/lisp/org/ox-org
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-odt hides c:/emacs/share/emacs/29.4/lisp/org/ox-odt
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-md hides c:/emacs/share/emacs/29.4/lisp/org/ox-md
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-man hides c:/emacs/share/emacs/29.4/lisp/org/ox-man
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-latex hides c:/emacs/share/emacs/29.4/lisp/org/ox-latex
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-koma-letter hides c:/emacs/share/emacs/29.4/lisp/org/ox-koma-letter
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-icalendar hides c:/emacs/share/emacs/29.4/lisp/org/ox-icalendar
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-html hides c:/emacs/share/emacs/29.4/lisp/org/ox-html
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-beamer hides c:/emacs/share/emacs/29.4/lisp/org/ox-beamer
c:/users/dpchi/.emacs.d/elpa/org-20210929/ox-ascii hides c:/emacs/share/emacs/29.4/lisp/org/ox-ascii
c:/users/dpchi/.emacs.d/elpa/org-20210929/org hides c:/emacs/share/emacs/29.4/lisp/org/org
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-version hides c:/emacs/share/emacs/29.4/lisp/org/org-version
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-timer hides c:/emacs/share/emacs/29.4/lisp/org/org-timer
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-tempo hides c:/emacs/share/emacs/29.4/lisp/org/org-tempo
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-table hides c:/emacs/share/emacs/29.4/lisp/org/org-table
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-src hides c:/emacs/share/emacs/29.4/lisp/org/org-src
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-refile hides c:/emacs/share/emacs/29.4/lisp/org/org-refile
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-protocol hides c:/emacs/share/emacs/29.4/lisp/org/org-protocol
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-plot hides c:/emacs/share/emacs/29.4/lisp/org/org-plot
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-pcomplete hides c:/emacs/share/emacs/29.4/lisp/org/org-pcomplete
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-num hides c:/emacs/share/emacs/29.4/lisp/org/org-num
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-mouse hides c:/emacs/share/emacs/29.4/lisp/org/org-mouse
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-mobile hides c:/emacs/share/emacs/29.4/lisp/org/org-mobile
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-macs hides c:/emacs/share/emacs/29.4/lisp/org/org-macs
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-macro hides c:/emacs/share/emacs/29.4/lisp/org/org-macro
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-loaddefs hides c:/emacs/share/emacs/29.4/lisp/org/org-loaddefs
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-list hides c:/emacs/share/emacs/29.4/lisp/org/org-list
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-lint hides c:/emacs/share/emacs/29.4/lisp/org/org-lint
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-keys hides c:/emacs/share/emacs/29.4/lisp/org/org-keys
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-inlinetask hides c:/emacs/share/emacs/29.4/lisp/org/org-inlinetask
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-indent hides c:/emacs/share/emacs/29.4/lisp/org/org-indent
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-id hides c:/emacs/share/emacs/29.4/lisp/org/org-id
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-habit hides c:/emacs/share/emacs/29.4/lisp/org/org-habit
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-goto hides c:/emacs/share/emacs/29.4/lisp/org/org-goto
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-footnote hides c:/emacs/share/emacs/29.4/lisp/org/org-footnote
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-feed hides c:/emacs/share/emacs/29.4/lisp/org/org-feed
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-faces hides c:/emacs/share/emacs/29.4/lisp/org/org-faces
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-entities hides c:/emacs/share/emacs/29.4/lisp/org/org-entities
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-element hides c:/emacs/share/emacs/29.4/lisp/org/org-element
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-duration hides c:/emacs/share/emacs/29.4/lisp/org/org-duration
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-datetree hides c:/emacs/share/emacs/29.4/lisp/org/org-datetree
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-ctags hides c:/emacs/share/emacs/29.4/lisp/org/org-ctags
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-crypt hides c:/emacs/share/emacs/29.4/lisp/org/org-crypt
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-compat hides c:/emacs/share/emacs/29.4/lisp/org/org-compat
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-colview hides c:/emacs/share/emacs/29.4/lisp/org/org-colview
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-clock hides c:/emacs/share/emacs/29.4/lisp/org/org-clock
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-capture hides c:/emacs/share/emacs/29.4/lisp/org/org-capture
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-attach hides c:/emacs/share/emacs/29.4/lisp/org/org-attach
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-attach-git hides c:/emacs/share/emacs/29.4/lisp/org/org-attach-git
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-archive hides c:/emacs/share/emacs/29.4/lisp/org/org-archive
c:/users/dpchi/.emacs.d/elpa/org-20210929/org-agenda hides c:/emacs/share/emacs/29.4/lisp/org/org-agenda
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol hides c:/emacs/share/emacs/29.4/lisp/org/ol
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-w3m hides c:/emacs/share/emacs/29.4/lisp/org/ol-w3m
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-rmail hides c:/emacs/share/emacs/29.4/lisp/org/ol-rmail
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-mhe hides c:/emacs/share/emacs/29.4/lisp/org/ol-mhe
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-irc hides c:/emacs/share/emacs/29.4/lisp/org/ol-irc
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-info hides c:/emacs/share/emacs/29.4/lisp/org/ol-info
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-gnus hides c:/emacs/share/emacs/29.4/lisp/org/ol-gnus
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-eww hides c:/emacs/share/emacs/29.4/lisp/org/ol-eww
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-eshell hides c:/emacs/share/emacs/29.4/lisp/org/ol-eshell
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-doi hides c:/emacs/share/emacs/29.4/lisp/org/ol-doi
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-docview hides c:/emacs/share/emacs/29.4/lisp/org/ol-docview
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-bibtex hides c:/emacs/share/emacs/29.4/lisp/org/ol-bibtex
c:/users/dpchi/.emacs.d/elpa/org-20210929/ol-bbdb hides c:/emacs/share/emacs/29.4/lisp/org/ol-bbdb
c:/users/dpchi/.emacs.d/elpa/org-20210929/oc hides c:/emacs/share/emacs/29.4/lisp/org/oc
c:/users/dpchi/.emacs.d/elpa/org-20210929/oc-natbib hides c:/emacs/share/emacs/29.4/lisp/org/oc-natbib
c:/users/dpchi/.emacs.d/elpa/org-20210929/oc-csl hides c:/emacs/share/emacs/29.4/lisp/org/oc-csl
c:/users/dpchi/.emacs.d/elpa/org-20210929/oc-biblatex hides c:/emacs/share/emacs/29.4/lisp/org/oc-biblatex
c:/users/dpchi/.emacs.d/elpa/org-20210929/oc-basic hides c:/emacs/share/emacs/29.4/lisp/org/oc-basic
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob hides c:/emacs/share/emacs/29.4/lisp/org/ob
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-tangle hides c:/emacs/share/emacs/29.4/lisp/org/ob-tangle
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-table hides c:/emacs/share/emacs/29.4/lisp/org/ob-table
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-sqlite hides c:/emacs/share/emacs/29.4/lisp/org/ob-sqlite
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-sql hides c:/emacs/share/emacs/29.4/lisp/org/ob-sql
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-shell hides c:/emacs/share/emacs/29.4/lisp/org/ob-shell
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-sed hides c:/emacs/share/emacs/29.4/lisp/org/ob-sed
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-screen hides c:/emacs/share/emacs/29.4/lisp/org/ob-screen
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-scheme hides c:/emacs/share/emacs/29.4/lisp/org/ob-scheme
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-sass hides c:/emacs/share/emacs/29.4/lisp/org/ob-sass
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-ruby hides c:/emacs/share/emacs/29.4/lisp/org/ob-ruby
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-ref hides c:/emacs/share/emacs/29.4/lisp/org/ob-ref
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-R hides c:/emacs/share/emacs/29.4/lisp/org/ob-R
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-python hides c:/emacs/share/emacs/29.4/lisp/org/ob-python
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-processing hides c:/emacs/share/emacs/29.4/lisp/org/ob-processing
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-plantuml hides c:/emacs/share/emacs/29.4/lisp/org/ob-plantuml
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-perl hides c:/emacs/share/emacs/29.4/lisp/org/ob-perl
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-org hides c:/emacs/share/emacs/29.4/lisp/org/ob-org
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-octave hides c:/emacs/share/emacs/29.4/lisp/org/ob-octave
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-ocaml hides c:/emacs/share/emacs/29.4/lisp/org/ob-ocaml
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-maxima hides c:/emacs/share/emacs/29.4/lisp/org/ob-maxima
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-matlab hides c:/emacs/share/emacs/29.4/lisp/org/ob-matlab
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-makefile hides c:/emacs/share/emacs/29.4/lisp/org/ob-makefile
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-lua hides c:/emacs/share/emacs/29.4/lisp/org/ob-lua
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-lob hides c:/emacs/share/emacs/29.4/lisp/org/ob-lob
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-lisp hides c:/emacs/share/emacs/29.4/lisp/org/ob-lisp
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-lilypond hides c:/emacs/share/emacs/29.4/lisp/org/ob-lilypond
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-latex hides c:/emacs/share/emacs/29.4/lisp/org/ob-latex
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-julia hides c:/emacs/share/emacs/29.4/lisp/org/ob-julia
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-js hides c:/emacs/share/emacs/29.4/lisp/org/ob-js
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-java hides c:/emacs/share/emacs/29.4/lisp/org/ob-java
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-haskell hides c:/emacs/share/emacs/29.4/lisp/org/ob-haskell
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-groovy hides c:/emacs/share/emacs/29.4/lisp/org/ob-groovy
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-gnuplot hides c:/emacs/share/emacs/29.4/lisp/org/ob-gnuplot
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-fortran hides c:/emacs/share/emacs/29.4/lisp/org/ob-fortran
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-forth hides c:/emacs/share/emacs/29.4/lisp/org/ob-forth
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-exp hides c:/emacs/share/emacs/29.4/lisp/org/ob-exp
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-eval hides c:/emacs/share/emacs/29.4/lisp/org/ob-eval
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-eshell hides c:/emacs/share/emacs/29.4/lisp/org/ob-eshell
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-emacs-lisp hides c:/emacs/share/emacs/29.4/lisp/org/ob-emacs-lisp
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-dot hides c:/emacs/share/emacs/29.4/lisp/org/ob-dot
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-ditaa hides c:/emacs/share/emacs/29.4/lisp/org/ob-ditaa
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-css hides c:/emacs/share/emacs/29.4/lisp/org/ob-css
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-core hides c:/emacs/share/emacs/29.4/lisp/org/ob-core
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-comint hides c:/emacs/share/emacs/29.4/lisp/org/ob-comint
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-clojure hides c:/emacs/share/emacs/29.4/lisp/org/ob-clojure
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-calc hides c:/emacs/share/emacs/29.4/lisp/org/ob-calc
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-C hides c:/emacs/share/emacs/29.4/lisp/org/ob-C
c:/users/dpchi/.emacs.d/elpa/org-20210929/ob-awk hides c:/emacs/share/emacs/29.4/lisp/org/ob-awk
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/trampver hides c:/emacs/share/emacs/29.4/lisp/net/trampver
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp hides c:/emacs/share/emacs/29.4/lisp/net/tramp
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-uu hides c:/emacs/share/emacs/29.4/lisp/net/tramp-uu
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-sudoedit hides c:/emacs/share/emacs/29.4/lisp/net/tramp-sudoedit
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-sshfs hides c:/emacs/share/emacs/29.4/lisp/net/tramp-sshfs
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-smb hides c:/emacs/share/emacs/29.4/lisp/net/tramp-smb
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-sh hides c:/emacs/share/emacs/29.4/lisp/net/tramp-sh
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-rclone hides c:/emacs/share/emacs/29.4/lisp/net/tramp-rclone
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-loaddefs hides c:/emacs/share/emacs/29.4/lisp/net/tramp-loaddefs
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-integration hides c:/emacs/share/emacs/29.4/lisp/net/tramp-integration
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-gvfs hides c:/emacs/share/emacs/29.4/lisp/net/tramp-gvfs
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-fuse hides c:/emacs/share/emacs/29.4/lisp/net/tramp-fuse
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-ftp hides c:/emacs/share/emacs/29.4/lisp/net/tramp-ftp
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-crypt hides c:/emacs/share/emacs/29.4/lisp/net/tramp-crypt
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-container hides c:/emacs/share/emacs/29.4/lisp/net/tramp-container
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-compat hides c:/emacs/share/emacs/29.4/lisp/net/tramp-compat
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-cmds hides c:/emacs/share/emacs/29.4/lisp/net/tramp-cmds
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-cache hides c:/emacs/share/emacs/29.4/lisp/net/tramp-cache
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-archive hides c:/emacs/share/emacs/29.4/lisp/net/tramp-archive
c:/users/dpchi/.emacs.d/elpa/tramp-2.7.1.5/tramp-adb hides c:/emacs/share/emacs/29.4/lisp/net/tramp-adb
c:/users/dpchi/.emacs.d/elpa/soap-client-3.2.3/soap-inspect hides c:/emacs/share/emacs/29.4/lisp/net/soap-inspect
c:/users/dpchi/.emacs.d/elpa/soap-client-3.2.3/soap-client hides c:/emacs/share/emacs/29.4/lisp/net/soap-client
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc hides c:/emacs/share/emacs/29.4/lisp/erc/erc
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-xdcc hides c:/emacs/share/emacs/29.4/lisp/erc/erc-xdcc
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-truncate hides c:/emacs/share/emacs/29.4/lisp/erc/erc-truncate
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-track hides c:/emacs/share/emacs/29.4/lisp/erc/erc-track
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-status-sidebar hides c:/emacs/share/emacs/29.4/lisp/erc/erc-status-sidebar
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-stamp hides c:/emacs/share/emacs/29.4/lisp/erc/erc-stamp
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-spelling hides c:/emacs/share/emacs/29.4/lisp/erc/erc-spelling
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-speedbar hides c:/emacs/share/emacs/29.4/lisp/erc/erc-speedbar
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-sound hides c:/emacs/share/emacs/29.4/lisp/erc/erc-sound
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-services hides c:/emacs/share/emacs/29.4/lisp/erc/erc-services
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-sasl hides c:/emacs/share/emacs/29.4/lisp/erc/erc-sasl
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-ring hides c:/emacs/share/emacs/29.4/lisp/erc/erc-ring
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-replace hides c:/emacs/share/emacs/29.4/lisp/erc/erc-replace
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-pcomplete hides c:/emacs/share/emacs/29.4/lisp/erc/erc-pcomplete
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-page hides c:/emacs/share/emacs/29.4/lisp/erc/erc-page
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-notify hides c:/emacs/share/emacs/29.4/lisp/erc/erc-notify
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-networks hides c:/emacs/share/emacs/29.4/lisp/erc/erc-networks
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-netsplit hides c:/emacs/share/emacs/29.4/lisp/erc/erc-netsplit
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-menu hides c:/emacs/share/emacs/29.4/lisp/erc/erc-menu
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-match hides c:/emacs/share/emacs/29.4/lisp/erc/erc-match
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-log hides c:/emacs/share/emacs/29.4/lisp/erc/erc-log
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-loaddefs hides c:/emacs/share/emacs/29.4/lisp/erc/erc-loaddefs
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-list hides c:/emacs/share/emacs/29.4/lisp/erc/erc-list
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-lang hides c:/emacs/share/emacs/29.4/lisp/erc/erc-lang
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-join hides c:/emacs/share/emacs/29.4/lisp/erc/erc-join
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-imenu hides c:/emacs/share/emacs/29.4/lisp/erc/erc-imenu
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-identd hides c:/emacs/share/emacs/29.4/lisp/erc/erc-identd
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-ibuffer hides c:/emacs/share/emacs/29.4/lisp/erc/erc-ibuffer
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-goodies hides c:/emacs/share/emacs/29.4/lisp/erc/erc-goodies
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-fill hides c:/emacs/share/emacs/29.4/lisp/erc/erc-fill
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-ezbounce hides c:/emacs/share/emacs/29.4/lisp/erc/erc-ezbounce
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-desktop-notifications hides c:/emacs/share/emacs/29.4/lisp/erc/erc-desktop-notifications
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-dcc hides c:/emacs/share/emacs/29.4/lisp/erc/erc-dcc
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-compat hides c:/emacs/share/emacs/29.4/lisp/erc/erc-compat
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-common hides c:/emacs/share/emacs/29.4/lisp/erc/erc-common
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-capab hides c:/emacs/share/emacs/29.4/lisp/erc/erc-capab
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-button hides c:/emacs/share/emacs/29.4/lisp/erc/erc-button
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-backend hides c:/emacs/share/emacs/29.4/lisp/erc/erc-backend
c:/users/dpchi/.emacs.d/elpa/erc-5.6/erc-autoaway hides c:/emacs/share/emacs/29.4/lisp/erc/erc-autoaway
c:/users/dpchi/.emacs.d/elpa/faceup-20170925.1946/faceup hides c:/emacs/share/emacs/29.4/lisp/emacs-lisp/faceup
c:/users/dpchi/.emacs.d/elpa/eldoc-1.15.0/eldoc hides c:/emacs/share/emacs/29.4/lisp/emacs-lisp/eldoc
c:/emacs/share/emacs/29.4/lisp/emacs-lisp/seq hides c:/users/dpchi/.emacs.d/elpa/seq-2.24/seq

Features:
(shadow sort mail-extr emacsbug ibuffer ibuffer-loaddefs mule-util
info-look cl-print shortdoc help-fns radix-tree arc-mode archive-mode
novice wdired image-mode exif network-stream nsm misearch multi-isearch
markdown-mode elec-pair company-box company-box-doc frame-local
company-box-icons company-oddmuse company-keywords company-etags
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company csharp-ts-mode-navigation
csharp-mode cc-langs tabify time-stamp vc-hg vc-bzr vc-src vc-sccs
vc-svn vc-cvs vc-rcs log-view vc-git vc vc-dispatcher bug-reference
magit-extras display-line-numbers hl-line recentf tree-widget lorem
cperl-mode-expansions cperl-mode dino-netrc restclient salted generic
smarter-compile highlight-chars dtrt-indent dino-dired-fixups dired-aux
auto-insert-plus autoinsert chatgpt-shell chatgpt-shell-openrouter
chatgpt-shell-perplexity chatgpt-shell-openai chatgpt-shell-ollama
chatgpt-shell-kagi let-alist chatgpt-shell-google
chatgpt-shell-anthropic chatgpt-shell-prompt-compose ob-core org-compat
ob-eval org-macs shell-maker view goto-addr ielm eshell em-prompt
esh-mode esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module
esh-groups esh-util files-x dpc-gemini wordnik dictionary
dictionary-connection thesaurus json-reformat cl json-mode json-snatcher
js-mode-expansions js c-ts-common css-mode-expansions css-mode
html-mode-expansions sgml-mode facemenu eww xdg url-queue shr pixel-fill
kinsoku url-file svg xml dom mm-url gnus nnheader range yaml-pretty-mode
yaml-mode-expansions yaml-mode hideshow sr-speedbar speedbar ezimage
dframe skeleton httpget web-mode-expansions web-mode
auto-complete-config auto-complete popup yasnippet go-mode find-file
etags fileloop generator wgrep grep expand-region text-mode-expansions
cc-mode-expansions er-basic-expansions expand-region-core
expand-region-custom dpc-jsonnet-mode-fixups jsonnet-mode smie eglot
external-completion jsonrpc xref flymake project ert ewoc debug
backtrace compile flycheck find-func magit-submodule magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log which-func imenu magit-diff smerge-mode diff
diff-mode git-commit log-edit message sendmail yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util text-property-search time-date mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor comp comp-cstr warnings shell pcomplete comint
ansi-osc ring server ansi-color magit-mode transient benchmark magit-git
magit-base magit-section format-spec cursor-sensor crm electric-operator
dash cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs icomplete-vertical icomplete embark ffap
thingatpt edmacro kmacro use-package-bind-key bind-key treesit
default-text-scale indent-bars compat compat-30 cus-edit pp cus-load
wid-edit face-remap noutline outline icons color use-package-ensure
finder-inf dino-utility cl-extra help-mode use-package-core s advice
apheleia-autoloads easy-mmode caddyfile-mode-autoloads
chatgpt-shell-autoloads command-log-mode-autoloads company-box-autoloads
company-autoloads dart-mode-autoloads dash-functional-autoloads
default-text-scale-autoloads eglot-autoloads electric-operator-autoloads
embark-autoloads erc-autoloads expand-region-autoloads faceup-autoloads
flycheck-autoloads flymake-autoloads frame-local-autoloads
go-autocomplete-autoloads go-mode-autoloads icomplete-vertical-autoloads
idlwave-autoloads indent-bars-autoloads json-mode-autoloads
json-snatcher-autoloads jsonnet-mode-autoloads jsonrpc-autoloads
logito-autoloads loop-autoloads lsp-mode-autoloads eldoc-autoloads
ht-autoloads f-autoloads lv-autoloads magit-autoloads pcase
magit-section-autoloads markdown-mode-autoloads
multiple-cursors-autoloads org-autoloads path-helper-autoloads
powershell-autoloads project-autoloads protobuf-mode-autoloads
rg-autoloads s-autoloads shell-maker-autoloads soap-client-autoloads
spinner-autoloads sr-speedbar-autoloads tablist-autoloads
tern-auto-complete-autoloads auto-complete-autoloads popup-autoloads
tern-autoloads tramp-autoloads rx transient-autoloads
typescript-mode-autoloads use-package-autoloads verilog-mode-autoloads
wgrep-autoloads with-editor-autoloads compat-autoloads xref-autoloads
yaml-mode-autoloads yasnippet-autoloads yaxception-autoloads info
dash-autoloads package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp
byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win
w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads w32notify w32 lcms2 multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 1483538 108511)
 (symbols 48 45334 6)
 (strings 32 283668 14180)
 (string-bytes 1 7516454)
 (vectors 16 118866)
 (vector-slots 8 2384632 255132)
 (floats 8 509 601)
 (intervals 56 112091 1414)
 (buffers 984 59))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75883; Package emacs. (Mon, 27 Jan 2025 12:26:02 GMT) Full text and rfc822 format available.

Message #8 received at 75883 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: dino chiesa <dpchiesa <at> hotmail.com>,
 Jostein Kjønigsen <jostein <at> kjonigsen.net>
 Yuan Fu <casouri <at> gmail.com>
Cc: 75883 <at> debbugs.gnu.org
Subject: Re: bug#75883: 29.4;
 csharp-ts-mode missing indent rules for using statement and lambda
Date: Mon, 27 Jan 2025 14:24:52 +0200
> From: dino chiesa <dpchiesa <at> hotmail.com>
> Date: Sun, 26 Jan 2025 23:32:09 +0000
> 
> In csharp-ts-mode, the variable csharp-ts-mode--indent-rules holds the
> indent rules relevant to csharp that get set into
> treesit-simple-indent-rules.
> 
> In the csharp-ts-mode--indent-rules list, there is no rule handles using
> statements, nor is there one for lambda expressions. The result is, when
> I am editing a C# module with something like this:
> 
>     using (ZipFile zip = new ZipFile())
>  {
>          ...
>         }
> 
> ... and press TAB on the line with the open curly, nothing happens. I
> would expect it to properly indent the curly, resulting in:
> 
>     using (ZipFile zip = new ZipFile())
>     {
>          ...
>         }
> 
> The TAB properly invokes indent-for-tab-command, which cascades, via
> indent-line-function, to treesit-indent. But it does nothing.
> 
> Similarly, if my code uses a lambda to set an Action type, like so:
> 
>     Action<Int64> createProgress = (x) =>
>  {
>         ...
>   };
> 
> ...pressing TAB on the line with the open curly does nothing. I would
> expect it to properly indent the open curly.
> 
> My diagnosis is: there is no rule to handle the using
> statement, nor is there a rule for the lambda_expression in csharp-ts-mode--indent-rules. As
> a result, in either case, the open curly does not get properly indented.
> 
> If I modify csharp-ts-mode--indent-rules to include rules for these
> syntax elements, like so:
> 
>   ((parent-is "using_statement") parent-bol 0)
>   ((parent-is "lambda_expression") parent-bol 0)
> 
> ...then a TAB will properly indent the open curlies in these situations.
> 
> This is how I monkey-patched it in my own init file:
> 
>   (eval-after-load "csharp-mode"
>     '(progn
>        (setf (cdr (car csharp-ts-mode--indent-rules))
>              (cons
>               '((parent-is "using_statement") parent-bol 0)
>               (cdr (car csharp-ts-mode--indent-rules))))
>        (setf (cdr (car csharp-ts-mode--indent-rules))
>              (cons
>               '((parent-is "lambda_expression") parent-bol 0)
>               (cdr (car csharp-ts-mode--indent-rules))))
>        (setq-local treesit-simple-indent-rules csharp-ts-mode--indent-rules)
>   ))
> 
> After doing this, when I press TAB on the line with the open curlies in
> the above situations, the open curly is properly indented.

Jostein and Yuan, could you please look into this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75883; Package emacs. (Sat, 08 Feb 2025 09:36:02 GMT) Full text and rfc822 format available.

Message #11 received at 75883 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jostein Kjønigsen <jostein <at> kjonigsen.net>,
 Yuan Fu <casouri <at> gmail.com>
Cc: 75883 <at> debbugs.gnu.org, dpchiesa <at> hotmail.com
Subject: Re: bug#75883: 29.4;
 csharp-ts-mode missing indent rules for using statement and lambda
Date: Sat, 08 Feb 2025 11:35:03 +0200
Ping!  Yuan and Jostein, could you please look into this?

> Cc: 75883 <at> debbugs.gnu.org
> Date: Mon, 27 Jan 2025 14:24:52 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > From: dino chiesa <dpchiesa <at> hotmail.com>
> > Date: Sun, 26 Jan 2025 23:32:09 +0000
> > 
> > In csharp-ts-mode, the variable csharp-ts-mode--indent-rules holds the
> > indent rules relevant to csharp that get set into
> > treesit-simple-indent-rules.
> > 
> > In the csharp-ts-mode--indent-rules list, there is no rule handles using
> > statements, nor is there one for lambda expressions. The result is, when
> > I am editing a C# module with something like this:
> > 
> >     using (ZipFile zip = new ZipFile())
> >  {
> >          ...
> >         }
> > 
> > ... and press TAB on the line with the open curly, nothing happens. I
> > would expect it to properly indent the curly, resulting in:
> > 
> >     using (ZipFile zip = new ZipFile())
> >     {
> >          ...
> >         }
> > 
> > The TAB properly invokes indent-for-tab-command, which cascades, via
> > indent-line-function, to treesit-indent. But it does nothing.
> > 
> > Similarly, if my code uses a lambda to set an Action type, like so:
> > 
> >     Action<Int64> createProgress = (x) =>
> >  {
> >         ...
> >   };
> > 
> > ...pressing TAB on the line with the open curly does nothing. I would
> > expect it to properly indent the open curly.
> > 
> > My diagnosis is: there is no rule to handle the using
> > statement, nor is there a rule for the lambda_expression in csharp-ts-mode--indent-rules. As
> > a result, in either case, the open curly does not get properly indented.
> > 
> > If I modify csharp-ts-mode--indent-rules to include rules for these
> > syntax elements, like so:
> > 
> >   ((parent-is "using_statement") parent-bol 0)
> >   ((parent-is "lambda_expression") parent-bol 0)
> > 
> > ...then a TAB will properly indent the open curlies in these situations.
> > 
> > This is how I monkey-patched it in my own init file:
> > 
> >   (eval-after-load "csharp-mode"
> >     '(progn
> >        (setf (cdr (car csharp-ts-mode--indent-rules))
> >              (cons
> >               '((parent-is "using_statement") parent-bol 0)
> >               (cdr (car csharp-ts-mode--indent-rules))))
> >        (setf (cdr (car csharp-ts-mode--indent-rules))
> >              (cons
> >               '((parent-is "lambda_expression") parent-bol 0)
> >               (cdr (car csharp-ts-mode--indent-rules))))
> >        (setq-local treesit-simple-indent-rules csharp-ts-mode--indent-rules)
> >   ))
> > 
> > After doing this, when I press TAB on the line with the open curlies in
> > the above situations, the open curly is properly indented.
> 
> Jostein and Yuan, could you please look into this?
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75883; Package emacs. (Sat, 08 Feb 2025 12:20:02 GMT) Full text and rfc822 format available.

Message #14 received at 75883 <at> debbugs.gnu.org (full text, mbox):

From: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
To: Eli Zaretskii <eliz <at> gnu.org>, dpchiesa <at> hotmail.com
Cc: Jostein Kjønigsen <jostein <at> kjonigsen.net>,
 Yuan Fu <casouri <at> gmail.com>, 75883 <at> debbugs.gnu.org
Subject: Re: bug#75883: 29.4; csharp-ts-mode missing indent rules for using
 statement and lambda
Date: Sat, 8 Feb 2025 13:19:33 +0100
Hey Eli!

I've tested myself and can confirm Dino is absolutely correct about 
this. This particular grammar is not correctly supported. I've also 
tested his patch, and from what I can see, it works fine. I'd be happy 
to merge that.

I could author a patch myself based on existing Emacs-sources, but I 
think it would be better to give credit where credit is due, and let 
Dino author the patch and have his name to it :)

--
Jostein

On 2/8/25 10:35, Eli Zaretskii wrote:
> Ping!  Yuan and Jostein, could you please look into this?
>
>> Cc: 75883 <at> debbugs.gnu.org
>> Date: Mon, 27 Jan 2025 14:24:52 +0200
>> From: Eli Zaretskii <eliz <at> gnu.org>
>>
>>> From: dino chiesa <dpchiesa <at> hotmail.com>
>>> Date: Sun, 26 Jan 2025 23:32:09 +0000
>>>
>>> In csharp-ts-mode, the variable csharp-ts-mode--indent-rules holds the
>>> indent rules relevant to csharp that get set into
>>> treesit-simple-indent-rules.
>>>
>>> In the csharp-ts-mode--indent-rules list, there is no rule handles using
>>> statements, nor is there one for lambda expressions. The result is, when
>>> I am editing a C# module with something like this:
>>>
>>>      using (ZipFile zip = new ZipFile())
>>>   {
>>>           ...
>>>          }
>>>
>>> ... and press TAB on the line with the open curly, nothing happens. I
>>> would expect it to properly indent the curly, resulting in:
>>>
>>>      using (ZipFile zip = new ZipFile())
>>>      {
>>>           ...
>>>          }
>>>
>>> The TAB properly invokes indent-for-tab-command, which cascades, via
>>> indent-line-function, to treesit-indent. But it does nothing.
>>>
>>> Similarly, if my code uses a lambda to set an Action type, like so:
>>>
>>>      Action<Int64> createProgress = (x) =>
>>>   {
>>>          ...
>>>    };
>>>
>>> ...pressing TAB on the line with the open curly does nothing. I would
>>> expect it to properly indent the open curly.
>>>
>>> My diagnosis is: there is no rule to handle the using
>>> statement, nor is there a rule for the lambda_expression in csharp-ts-mode--indent-rules. As
>>> a result, in either case, the open curly does not get properly indented.
>>>
>>> If I modify csharp-ts-mode--indent-rules to include rules for these
>>> syntax elements, like so:
>>>
>>>    ((parent-is "using_statement") parent-bol 0)
>>>    ((parent-is "lambda_expression") parent-bol 0)
>>>
>>> ...then a TAB will properly indent the open curlies in these situations.
>>>
>>> This is how I monkey-patched it in my own init file:
>>>
>>>    (eval-after-load "csharp-mode"
>>>      '(progn
>>>         (setf (cdr (car csharp-ts-mode--indent-rules))
>>>               (cons
>>>                '((parent-is "using_statement") parent-bol 0)
>>>                (cdr (car csharp-ts-mode--indent-rules))))
>>>         (setf (cdr (car csharp-ts-mode--indent-rules))
>>>               (cons
>>>                '((parent-is "lambda_expression") parent-bol 0)
>>>                (cdr (car csharp-ts-mode--indent-rules))))
>>>         (setq-local treesit-simple-indent-rules csharp-ts-mode--indent-rules)
>>>    ))
>>>
>>> After doing this, when I press TAB on the line with the open curlies in
>>> the above situations, the open curly is properly indented.
>> Jostein and Yuan, could you please look into this?
>>
>>
>>
>>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75883; Package emacs. (Sat, 08 Feb 2025 12:23:02 GMT) Full text and rfc822 format available.

Message #17 received at 75883 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
Cc: jostein <at> kjonigsen.net, casouri <at> gmail.com, 75883 <at> debbugs.gnu.org,
 dpchiesa <at> hotmail.com
Subject: Re: bug#75883: 29.4; csharp-ts-mode missing indent rules for using
 statement and lambda
Date: Sat, 08 Feb 2025 14:22:17 +0200
> Date: Sat, 8 Feb 2025 13:19:33 +0100
> Cc: 75883 <at> debbugs.gnu.org, Jostein Kjønigsen
>  <jostein <at> kjonigsen.net>, Yuan Fu <casouri <at> gmail.com>
> From: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
> 
> I've tested myself and can confirm Dino is absolutely correct about 
> this. This particular grammar is not correctly supported. I've also 
> tested his patch, and from what I can see, it works fine. I'd be happy 
> to merge that.

Fine by me.

> I could author a patch myself based on existing Emacs-sources, but I 
> think it would be better to give credit where credit is due, and let 
> Dino author the patch and have his name to it :)

Sure, if Dino has a patch to fix this, let's use that.




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 11 Feb 2025 07:16:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75883; Package emacs. (Fri, 21 Feb 2025 14:14:01 GMT) Full text and rfc822 format available.

Message #22 received at 75883 <at> debbugs.gnu.org (full text, mbox):

From: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Jostein Kjønigsen <jostein <at> kjonigsen.net>,
 Yuan Fu <casouri <at> gmail.com>, 75883 <at> debbugs.gnu.org, dpchiesa <at> hotmail.com
Subject: Re: bug#75883: 29.4; csharp-ts-mode missing indent rules for using
 statement and lambda
Date: Fri, 21 Feb 2025 15:12:59 +0100
[Message part 1 (text/plain, inline)]
I don't see Dino chiming in, so I took his code and made a patch out of it, based on latest code in git master.

It might be installable in other branches too (like emacs-30), but I haven't tried that.



—
Kind Regards
Jostein Kjønigsen

> On 8 Feb 2025, at 13:22, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Date: Sat, 8 Feb 2025 13:19:33 +0100
>> Cc: 75883 <at> debbugs.gnu.org, Jostein Kjønigsen
>> <jostein <at> kjonigsen.net>, Yuan Fu <casouri <at> gmail.com>
>> From: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
>> 
>> I've tested myself and can confirm Dino is absolutely correct about 
>> this. This particular grammar is not correctly supported. I've also 
>> tested his patch, and from what I can see, it works fine. I'd be happy 
>> to merge that.
> 
> Fine by me.
> 
>> I could author a patch myself based on existing Emacs-sources, but I 
>> think it would be better to give credit where credit is due, and let 
>> Dino author the patch and have his name to it :)
> 
> Sure, if Dino has a patch to fix this, let's use that.

[Message part 2 (text/html, inline)]
[0001-lisp-progmodes-csharp-mode.el-Fix-identation.patch (application/octet-stream, attachment)]
[Message part 4 (text/html, inline)]

Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Fri, 21 Feb 2025 16:56:03 GMT) Full text and rfc822 format available.

Notification sent to dino chiesa <dpchiesa <at> hotmail.com>:
bug acknowledged by developer. (Fri, 21 Feb 2025 16:56:04 GMT) Full text and rfc822 format available.

Message #27 received at 75883-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>, 
 Eli Zaretskii <eliz <at> gnu.org>
Cc: 75883-done <at> debbugs.gnu.org, Yuan Fu <casouri <at> gmail.com>,
 Jostein Kjønigsen <jostein <at> kjonigsen.net>,
 dpchiesa <at> hotmail.com
Subject: Re: bug#75883: 29.4; csharp-ts-mode missing indent rules for using
 statement and lambda
Date: Fri, 21 Feb 2025 08:55:31 -0800
Jostein Kjønigsen <jostein <at> secure.kjonigsen.net> writes:

> I don't see Dino chiming in, so I took his code and made a patch out of it, based on latest code in git master.
>
> It might be installable in other branches too (like emacs-30), but I haven't tried that.

Thanks, installed on master (commit ecddc8227d9).  Closing.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 22 Mar 2025 11:24:21 GMT) Full text and rfc822 format available.

This bug report was last modified 113 days ago.

Previous Next


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