# gitk: Failure of new tabbed preferences dialog

8 messages from 2012-03-29 to 2012-04-03. Participants: Ramsay Jones, Pat Thoyts, Junio C Hamano, Paul Mackerras.
Thread: https://gitlist.dev/t/30099

## Ramsay Jones, 2012-03-29 17:31

Subject: gitk: Failure of new tabbed preferences dialog
Message-ID: <4F749C71.7050201@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/4F749C71.7050201%40ramsay1.demon.co.uk

```
Hi Pat,

I just tried the new gitk (master @fae9d76) and, since I don't have
themed widgets, the preferences menu item uses the emulated tabbed
dialog code, which fails like so:

    can't read "col": no such variable
    can't read "col": no such variable
        (reading value of variable to increment)
        invoked from within
    "incr col"
        (procedure "doprefs" line 36)
        invoked from within
    "doprefs"
        (menu invoke)

I tried the following (maybe *too* obvious) fix:

-- >8 --
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 651b740..68cd1a1 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -11012,6 +11012,7 @@ proc doprefs {} {
     lappend pages [prefspage_general $notebook] [mc "General"]
     lappend pages [prefspage_colors $notebook] [mc "Colors"]
     lappend pages [prefspage_fonts $notebook] [mc "Fonts"]
+    set col 0
     foreach {page title} $pages {
 	if {$use_notebook} {
 	    $notebook add $page -text $title
-- 8< --

which seems to work.

HTH

ATB,
Ramsay Jones

```

## Pat Thoyts, 2012-04-01 22:00

Subject: Re: gitk: Failure of new tabbed preferences dialog
Message-ID: <1333317652-1464-1-git-send-email-patthoyts@users.sourceforge.net>
URL: https://gitlist.dev/e/1333317652-1464-1-git-send-email-patthoyts%40users.sourceforge.net
In-Reply-To: <4F749C71.7050201@ramsay1.demon.co.uk>

```

> I just tried the new gitk (master @fae9d76) and, since I don't have
> themed widgets, the preferences menu item uses the emulated tabbed
> dialog code, which fails like so:
>
>     can't read "col": no such variable
>

The issue here is that the incr command has changed between tcl 8.4
and 8.5 and in more recent versions automatically creates the named
variable if it did not exist. The fix you suggest is correct. I've
also included another that I realised had been applied to msysGit and
was not posted upstream.

Pat Thoyts.

```

## Pat Thoyts, 2012-04-01 22:00

Subject: [PATCH 1/2] gitk: fix tabbed preferences construction when using tcl 8.4
Message-ID: <1333317652-1464-2-git-send-email-patthoyts@users.sourceforge.net>
URL: https://gitlist.dev/e/1333317652-1464-2-git-send-email-patthoyts%40users.sourceforge.net
In-Reply-To: <1333317652-1464-1-git-send-email-patthoyts@users.sourceforge.net>

```
In 8.5 the incr command creates the target variable if it does not exist
but in 8.4 using incr on a non-existing variable raises an error. Ensure
we have created our counter variable when creating the tabbed dialog for
non-themed preferences.

Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 gitk |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/gitk b/gitk
index 651b740..68cd1a1 100755
--- a/gitk
+++ b/gitk
@@ -11012,6 +11012,7 @@ proc doprefs {} {
     lappend pages [prefspage_general $notebook] [mc "General"]
     lappend pages [prefspage_colors $notebook] [mc "Colors"]
     lappend pages [prefspage_fonts $notebook] [mc "Fonts"]
+    set col 0
     foreach {page title} $pages {
 	if {$use_notebook} {
 	    $notebook add $page -text $title
-- 
1.7.9.msysgit.0

```

## Pat Thoyts, 2012-04-01 22:00

Subject: [PATCH 2/2] gitk: fix setting font display with new tabbed dialog layout.
Message-ID: <1333317652-1464-3-git-send-email-patthoyts@users.sourceforge.net>
URL: https://gitlist.dev/e/1333317652-1464-3-git-send-email-patthoyts%40users.sourceforge.net
In-Reply-To: <1333317652-1464-1-git-send-email-patthoyts@users.sourceforge.net>

```
The changes to the dialog window tree broke the preview of the selected
font on the button. This corrects that issue.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 gitk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gitk b/gitk
index 68cd1a1..22270ce 100755
--- a/gitk
+++ b/gitk
@@ -10795,7 +10795,7 @@ proc fontok {} {
     if {$fontparam(slant) eq "italic"} {
 	lappend fontpref($f) "italic"
     }
-    set w $prefstop.$f
+    set w $prefstop.notebook.fonts.$f
     $w conf -text $fontparam(family) -font $fontpref($f)
 
     fontcan
-- 
1.7.9.msysgit.0

```

## Junio C Hamano, 2012-04-02 16:19

Subject: Re: gitk: Failure of new tabbed preferences dialog
Message-ID: <7vty12gl8r.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vty12gl8r.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1333317652-1464-1-git-send-email-patthoyts@users.sourceforge.net>

```
Pat Thoyts <patthoyts@users.sourceforge.net> writes:

>> I just tried the new gitk (master @fae9d76) and, since I don't have
>> themed widgets, the preferences menu item uses the emulated tabbed
>> dialog code, which fails like so:
>>
>>     can't read "col": no such variable
>
> The issue here is that the incr command has changed between tcl 8.4
> and 8.5 and in more recent versions automatically creates the named
> variable if it did not exist. The fix you suggest is correct. I've
> also included another that I realised had been applied to msysGit and
> was not posted upstream.

This seems severe enough that we should put it in the coming release.
I can queue them directory to gitk tree (and later ask Paul to pull it
from me), and merge the result to expedite the roundtrip.

```

## Junio C Hamano, 2012-04-02 22:03

Subject: Re: gitk: Failure of new tabbed preferences dialog
Message-ID: <7vzkatdc51.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vzkatdc51.fsf%40alter.siamese.dyndns.org
In-Reply-To: <7vty12gl8r.fsf@alter.siamese.dyndns.org>

```
Paul, Ramsay and Pat noticed and fixed two buglets that made the "Font"
setting dialog unusable in the version in 1.7.10-rc3.  I've queued the
fixes below, tested them (before and after applying the patches) locally.

I would like to merge them and tag 1.7.10-rc4 tonight.

In order to keep us in sync, could you please pull back from me?  The
branch "pt/gitk" corresponds to your repository (i.e. without the rest of
git.git, and gitk-git/Makefile as the top-level Makefile).

Thanks.

-- -- --

The following changes since commit b2b76d10696d945bf19318831b64d009d119e051:

  gitk: Teach gitk to respect log.showroot (2012-03-24 16:44:12 +1100)

are available in the git repository at:

  git://github.com/gitster/git.git pt/gitk

for you to fetch changes up to 39ddf99c1db8b230ec7bdefc6ce3c769d1cf4ab6:

  gitk: fix setting font display with new tabbed dialog layout. (2012-04-02 10:21:10 -0700)

----------------------------------------------------------------
Pat Thoyts (2):
      gitk: fix tabbed preferences construction when using tcl 8.4
      gitk: fix setting font display with new tabbed dialog layout.

 gitk |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gitk b/gitk
index 651b740..22270ce 100755
--- a/gitk
+++ b/gitk
@@ -10795,7 +10795,7 @@ proc fontok {} {
     if {$fontparam(slant) eq "italic"} {
 	lappend fontpref($f) "italic"
     }
-    set w $prefstop.$f
+    set w $prefstop.notebook.fonts.$f
     $w conf -text $fontparam(family) -font $fontpref($f)
 
     fontcan
@@ -11012,6 +11012,7 @@ proc doprefs {} {
     lappend pages [prefspage_general $notebook] [mc "General"]
     lappend pages [prefspage_colors $notebook] [mc "Colors"]
     lappend pages [prefspage_fonts $notebook] [mc "Fonts"]
+    set col 0
     foreach {page title} $pages {
 	if {$use_notebook} {
 	    $notebook add $page -text $title

```

## Paul Mackerras, 2012-04-03 12:19

Subject: Re: gitk: Failure of new tabbed preferences dialog
Message-ID: <20120403121944.GC24141@bloggs.ozlabs.ibm.com>
URL: https://gitlist.dev/e/20120403121944.GC24141%40bloggs.ozlabs.ibm.com
In-Reply-To: <7vty12gl8r.fsf@alter.siamese.dyndns.org>

```
On Mon, Apr 02, 2012 at 09:19:00AM -0700, Junio C Hamano wrote:
> Pat Thoyts <patthoyts@users.sourceforge.net> writes:
> 
> >> I just tried the new gitk (master @fae9d76) and, since I don't have
> >> themed widgets, the preferences menu item uses the emulated tabbed
> >> dialog code, which fails like so:
> >>
> >>     can't read "col": no such variable
> >
> > The issue here is that the incr command has changed between tcl 8.4
> > and 8.5 and in more recent versions automatically creates the named
> > variable if it did not exist. The fix you suggest is correct. I've
> > also included another that I realised had been applied to msysGit and
> > was not posted upstream.
> 
> This seems severe enough that we should put it in the coming release.
> I can queue them directory to gitk tree (and later ask Paul to pull it
> from me), and merge the result to expedite the roundtrip.

OK; the patches look fine to me.  If that's what you're doing, I won't
apply them to my tree, to avoid duplication.

Paul.

```

## Junio C Hamano, 2012-04-03 16:53

Subject: Re: gitk: Failure of new tabbed preferences dialog
Message-ID: <7vaa2sdaeu.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vaa2sdaeu.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20120403121944.GC24141@bloggs.ozlabs.ibm.com>

```
Paul Mackerras <paulus@samba.org> writes:

> On Mon, Apr 02, 2012 at 09:19:00AM -0700, Junio C Hamano wrote:
>> 
>> This seems severe enough that we should put it in the coming release.
>> I can queue them directory to gitk tree (and later ask Paul to pull it
>> from me), and merge the result to expedite the roundtrip.
>
> OK; the patches look fine to me.  If that's what you're doing, I won't
> apply them to my tree, to avoid duplication.

Thanks.

```
