]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Remove useless indentation in lib/tuiterm.exp
authorTom de Vries <tdevries@suse.de>
Thu, 14 Aug 2025 16:38:30 +0000 (18:38 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 14 Aug 2025 16:38:30 +0000 (18:38 +0200)
commit5ed142657c5dd9dfd5e0897ab45f2f269a8b97d2
tree955b88787df12f6e57034de771f2e86adae51566
parent809c1abc19d487daeed75842da867ce633159210
[gdb/testsuite] Remove useless indentation in lib/tuiterm.exp

In lib/tuiterm.exp we have:
...
namespace eval Term {
    variable ...
    ...
}
...
with everything within the namespace (which is basically the entire file)
indented, which wastes screen space and makes editing more involved.

We could maybe fix this by moving the "namespace eval Term" to tuiterm_env,
but I don't think it's a good idea to move it out of the file.

Another idea is to have the file include itself, wrapped in the namespace:
...
if { ![info exists Term::_in_namespace] } {
    namespace eval Term {
       # Read the rest of this file, wrapped in this namespace.
       variable _in_namespace
       set _in_namespace 1
       source $::srcdir/lib/tuiterm.exp
       unset _in_namespace
       return
    }
}

variable ...
...
but this was considered unnecessarily complex.

Fix this in the style of lib/ton.tcl and lib/completion-support.exp:
- only declare the variables in the namespace, and
- define the procs using a Term:: prefix.

As a side-effect, this works around an emacs bug that makes editing
lib/tuiterm.exp in its current form problematic because the auto-indentation
keeps removing required indentation of all but the first proc [1].

Tested on x86_64-linux.

[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-11/msg01674.html
gdb/testsuite/lib/tuiterm.exp