Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Don't nest double quotes in tuiterm.exp
Date: Thu, 31 Jul 2025 07:16:27 +0200	[thread overview]
Message-ID: <33d74239-c166-4d5a-897d-977c000327df@suse.de> (raw)
In-Reply-To: <20250730180715.3443362-1-tromey@adacore.com>

On 7/30/25 20:07, Tom Tromey wrote:
> I found a line in tuiterm.exp that causes Emacs paren-matching to go
> awry.

Hi Tom,

thanks for finding this.

I played around a bit with this and was able to observe the following.

If I type foo between the double quotes:
...
             verbose -log "$fmt [get_line_1 $y "foo" $attrs]"
...
I observe that the foo gets highlighted as not part of a string.

If I change the double quotes to curly braces, that changes.  I'm not 
sure if that is the issue you observed though.

But yeah, I agree there is a problem with syntax highlighting.

Anyway, normally I don't observe this because I use emacs with 
TERM=xterm-old forcing monochrome to be able to read diffs.

> This patch fixes the problem by changing some apparent nested
> double quotes (which I think isn't really possible in Tcl but this
> seems to be the intent) to be more correct; which fixes the Emacs
> issue as well.

This was my code, so I build a small tcl example to understand if it 
made a difference or not:
...
#!/usr/bin/tclsh

proc verbose { args } {
     foreach arg $args {
	puts "$arg"
     }
}

set y "y z"
set attrs "attrs attrs2"

proc get_line_1 { args } {
     set str ""
     foreach arg $args {
	set str "$str<$arg>"
     }
     return $str
}

verbose -log "[get_line_1 $y "" $attrs]"
verbose -log "[get_line_1 $y {} $attrs]"
...
and it seems not:
...
$ ./test.tcl
-log
<y z><><attrs attrs2>
-log
<y z><><attrs attrs2>
...

Anyway, my understanding of TCL is purely operational, so you may be 
right that it's not proper TCL. FWIW, I looked here ( 
https://www.tcl-lang.org/man/tcl8.6/TclCmd/Tcl.htm#M11 ) and didn't see 
anything forbidding this usage.

I'll try to avoid this in the future.

LGTM.

Approved-By: Tom de Vries <tdevries@suse.de>


Thanks,
- Tom

> ---
>   gdb/testsuite/lib/tuiterm.exp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
> index cc8e852690a..b83b8afdcec 100644
> --- a/gdb/testsuite/lib/tuiterm.exp
> +++ b/gdb/testsuite/lib/tuiterm.exp
> @@ -1291,7 +1291,7 @@ namespace eval Term {
>   
>   	for {set y 0} {$y < $_rows} {incr y} {
>   	    set fmt [format %5d $y]
> -	    verbose -log "$fmt [get_line_1 $y "" $attrs]"
> +	    verbose -log "$fmt [get_line_1 $y {} $attrs]"
>   	}
>       }
>   
> 
> base-commit: 303045d9539d9032208b8b67f222943ff4c96b05


  reply	other threads:[~2025-07-31  5:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 18:07 Tom Tromey
2025-07-31  5:16 ` Tom de Vries [this message]
2025-09-09  7:18   ` Tom de Vries
2025-09-09 17:56     ` Tom Tromey
2025-09-09 19:01       ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33d74239-c166-4d5a-897d-977c000327df@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox