• tcl-mode: wrong indentation

    From Ralf Fassel@ralfixx@gmx.de to gnu.emacs.help on Wed Nov 2 11:51:43 2022
    From Newsgroup: gnu.emacs.help

    emacs 27.2 on Opensuse 15.4, tcl.el like this:

    ;;; tcl.el --- Tcl code editing commands for Emacs
    ;; Copyright (C) 1994, 1998-2021 Free Software Foundation, Inc.
    ;; Author: Tom Tromey <tromey@redhat.com>
    ;; Chris Lindblad <cjl@lcs.mit.edu>
    ;; Maintainer: emacs-devel@gnu.org
    ;; Keywords: languages tcl modes


    In tcl-mode, the following code leads to incorrect indentation after the 'method' line:

    # --- cut here/1 ---
    proc xxx {} {
    yyy {
    method zzz
    }
    # previous line should indent like this, but stays at beginning of line
    # --- cut here/1 ---


    If I go on the line after "method zzz" and press TAB ('tcl-indent-command'), the line stays at the beginning of the line and does not indent like the previous 'method' line. If I change the 'method zzz' line to
    e.g. 'xmethod zzz, the next line indents correctly.

    If I change the code to

    # --- cut here/2 ---
    proc xxx {} {
    yyy { method zzz }
    # correct indent now
    # --- cut here/2 ---

    (which is the same as TCL is concerned), the indent works correctly

    This has something to do with 'tcl-calculate-indent', which in turn in
    some way uses 'tcl-proc-regexp' (containing amongst others the 'method' keyword), but I can't figure out the convoluted details of all the
    functions called.

    Maybe someone here can offer some insight or even a solution?

    TNX
    R'
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Ralf Fassel@ralfixx@gmx.de to gnu.emacs.help on Wed Nov 23 10:39:51 2022
    From Newsgroup: gnu.emacs.help

    * Ralf Fassel <ralfixx@gmx.de>
    | emacs 27.2 on Opensuse 15.4, tcl.el like this:

    | ;;; tcl.el --- Tcl code editing commands for Emacs
    | ;; Copyright (C) 1994, 1998-2021 Free Software Foundation, Inc.
    | ;; Author: Tom Tromey <tromey@redhat.com>
    | ;; Chris Lindblad <cjl@lcs.mit.edu>
    | ;; Maintainer: emacs-devel@gnu.org
    | ;; Keywords: languages tcl modes


    | In tcl-mode, the following code leads to incorrect indentation after the
    | 'method' line:

    | # --- cut here/1 ---
    | proc xxx {} {
    | yyy {
    | method zzz
    | }
    | # previous line should indent like this, but stays at beginning of line
    | # --- cut here/1 ---

    FWIW, this seems to be fixed in emacs 28.
    Hopefully Suse picks it up soon-ish.

    R'
    --- Synchronet 3.21d-Linux NewsLink 1.2