Subject: bug#47836: tcl-mode indentation/quoting problems

From: Hadrien Lacour <[email-masked]>
Date: Sat, 17 Apr 2021 09:09:06 +0000

Hello, I have found the following problems in tcl-mode, examples show how Emacs
indents them and what text I get with tcl-explain-indentation set to t
(when relevant):
* Indentation after declaring a proc goes to column 0, example:
namespace eval myns {
	proc p1 {} {}
variable x
proc p2 {} {}
}

"Indentation type nil" all along

* Mismatched parentheses when quoted:
puts {hel[lo}
puts {hel(lo}

* Procs named ? , ' or ^ botch indentation (thankfully only inside):
proc ? {} {
	    puts hello
       }
puts world

"Indentation type tcl-expr" for these,
"Indentation type tcl-commands" for other proc names.

Sorry if I can't offer a patch, my elisp skill and available time is basically
nil. The comment associated with the `defconst tcl-omit-ws-regexp` line seem
related to (3).
Obviously, only (1) and (2) are really annoying, basically forcing me to use mg
for Tcl.

-------------------------------------------------------------------------------

In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, X toolkit)
 of 2021-03-26 built on localhost
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Gentoo/Linux

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
user-error: Beginning of history; no preceding item
Quit [2 times]
next-line: End of buffer
Making completion list...

Configured using:
 'configure --prefix=/usr --build=x86_64-pc-linux-gnu
 --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
 --localstatedir=/var/lib --disable-silent-rules
 --docdir=/usr/share/doc/emacs-27.2
 --htmldir=/usr/share/doc/emacs-27.2/html --libdir=/usr/lib64
 --program-suffix=-emacs-27 --includedir=/usr/include/emacs-27
 --infodir=/usr/share/info/emacs-27 --localstatedir=/var
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --without-compress-install --without-hesiod --without-pop
 --with-file-notification=inotify --with-pdumper --enable-acl
 --without-dbus --without-modules --without-gameuser --with-libgmp
 --without-gpm --with-json --without-kerberos --without-kerberos5
 --without-lcms2 --without-xml2 --without-mailutils --without-selinux
 --with-gnutls --without-libsystemd --with-threads --without-wide-int
 --with-zlib --with-sound=no --with-x --without-ns --without-gconf
 --without-gsettings --without-toolkit-scroll-bars --without-gif
 --without-jpeg --without-png --without-rsvg --without-tiff --with-xpm
 --without-imagemagick --with-xft --without-cairo --without-harfbuzz
 --without-libotf --without-m17n-flt --with-x-toolkit=lucid
 --without-xaw3d --with-dumping=pdumper 'CFLAGS=-march=native -pipe -O2'
 CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed''

Configured features:
XPM NOTIFY INOTIFY ACL GNUTLS FREETYPE XFT ZLIB LUCID X11 XDBE XIM
THREADS JSON PDUMPER GMP

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Tcl

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils tcl
easymenu comint ansi-color ring tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic 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 charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads inotify dynamic-setting font-render-setting x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 48863 10100)
 (symbols 48 6404 1)
 (strings 32 17346 2153)
 (string-bytes 1 551906)
 (vectors 16 10563)
 (vector-slots 8 134917 13058)
 (floats 8 22 48)
 (intervals 56 302 0)
 (buffers 1000 12))