{"thread":{"id":"39222","subject":"[PATCH] gitk: Remove mc parameter from proc show_error","startedAt":"2015-05-02T03:13:20Z","lastAt":"2015-05-03T04:24:33Z","messageCount":3,"participants":["Alex Henrie","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"260414","messageId":"1430536400-22008-1-git-send-email-alexhenrie24@gmail.com","threadId":"39222","inReplyTo":null,"subject":"[PATCH] gitk: Remove mc parameter from proc show_error","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2015-05-02T03:13:20Z","receivedAt":"2015-05-02T03:13:20Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"This is a better fix for 8d849957d81fc0480a52570d66cc3c2a688ecb1b.\n\nAll that was required to fix the original issue was to remove the extra\nmc call, i.e. change [mc \"Sorry, gitk cannot run...\"] to simply\n\"Sorry, gitk cannot run...\" Changing the signature of proc show_error\nwas unnecessary and introduced two new bugs: It made \"OK\" untranslatable\nand \"mc\" translatable when the opposite should be true.\n\nThis new fix makes the string \"OK\" translatable and the string \"mc\" not\ntranslatable, while leaving the string \"Sorry, gitk cannot run...\" not\ntranslatable. It will take effect the next time `make update-po` is run.\n\nSigned-off-by: Alex Henrie <alexhenrie24@gmail.com>\n---\n gitk | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 30fcd30..096389f 100755\n--- a/gitk\n+++ b/gitk\n@@ -1894,13 +1894,13 @@ proc make_transient {window origin} {\n     }\n }\n \n-proc show_error {w top msg {mc mc}} {\n+proc show_error {w top msg} {\n     global NS\n     if {![info exists NS]} {set NS \"\"}\n     if {[wm state $top] eq \"withdrawn\"} { wm deiconify $top }\n     message $w.m -text $msg -justify center -aspect 400\n     pack $w.m -side top -fill x -padx 20 -pady 20\n-    ${NS}::button $w.ok -default active -text [$mc OK] -command \"destroy $top\"\n+    ${NS}::button $w.ok -default active -text [mc OK] -command \"destroy $top\"\n     pack $w.ok -side bottom -fill x\n     bind $top <Visibility> \"grab $top; focus $top\"\n     bind $top <Key-Return> \"destroy $top\"\n@@ -12011,7 +12011,7 @@ proc get_path_encoding {path} {\n # First check that Tcl/Tk is recent enough\n if {[catch {package require Tk 8.4} err]} {\n     show_error {} . \"Sorry, gitk cannot run with this version of Tcl/Tk.\\n\\\n-\t\t     Gitk requires at least Tcl/Tk 8.4.\" list\n+\t\t     Gitk requires at least Tcl/Tk 8.4.\"\n     exit 1\n }\n \n-- \n2.3.7\n"},{"id":"260423","messageId":"20150502100513.GA19038@iris.ozlabs.ibm.com","threadId":"39222","inReplyTo":"1430536400-22008-1-git-send-email-alexhenrie24@gmail.com","subject":"Re: [PATCH] gitk: Remove mc parameter from proc show_error","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2015-05-02T10:05:13Z","receivedAt":"2015-05-02T10:05:13Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Fri, May 01, 2015 at 09:13:20PM -0600, Alex Henrie wrote:\n> This is a better fix for 8d849957d81fc0480a52570d66cc3c2a688ecb1b.\n> \n> All that was required to fix the original issue was to remove the extra\n> mc call, i.e. change [mc \"Sorry, gitk cannot run...\"] to simply\n> \"Sorry, gitk cannot run...\" Changing the signature of proc show_error\n> was unnecessary and introduced two new bugs: It made \"OK\" untranslatable\n> and \"mc\" translatable when the opposite should be true.\n> \n> This new fix makes the string \"OK\" translatable and the string \"mc\" not\n> translatable, while leaving the string \"Sorry, gitk cannot run...\" not\n> translatable. It will take effect the next time `make update-po` is run.\n\nTo test this, I changed {package require Tk 8.4} to {package require\nTk 8.7}, in order to deliberately trigger the error.  When I run gitk\nwith that change (and your patch applied), I get this in the xterm\nwhere I run gitk:\n\n$ ./gitk\nError in startup script: invalid command name \"mc\"\n    while executing\n\"mc OK\"\n    (procedure \"show_error\" line 7)\n    invoked from within\n\"show_error {} . \"Sorry, gitk cannot run with this version of Tcl/Tk.\\n Gitk requires at least Tcl/Tk 8.4.\"\"\n    invoked from within\n\"if {[catch {package require Tk 8.7} err]} {\n    show_error {} . \"Sorry, gitk cannot run with this version of Tcl/Tk.\\n\\\n                     Gitk requires at least ...\"\n    (file \"./gitk\" line 12012)\n\nand no pop-up window.  So this patch still isn't quite right.\n\nGiven that old versions of tcl/tk probably don't have [mc], I think\nit's inevitable that \"OK\" will have to be untranslated for that\nparticular error path.\n\nPaul.\n"},{"id":"260456","messageId":"CAMMLpeQj2N9Qa+KKiaCRUOjx_=cAf=GTW6QADBySE9VsY_Xg=w@mail.gmail.com","threadId":"39222","inReplyTo":"20150502100513.GA19038@iris.ozlabs.ibm.com","subject":"Re: [PATCH] gitk: Remove mc parameter from proc show_error","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2015-05-03T04:24:33Z","receivedAt":"2015-05-03T04:24:33Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"2015-05-02 4:05 GMT-06:00 Paul Mackerras <paulus@samba.org>:\n> To test this, I changed {package require Tk 8.4} to {package require\n> Tk 8.7}, in order to deliberately trigger the error.  When I run gitk\n> with that change (and your patch applied), I get this in the xterm\n> where I run gitk:\n>\n> $ ./gitk\n> Error in startup script: invalid command name \"mc\"\n>     while executing\n> \"mc OK\"\n>     (procedure \"show_error\" line 7)\n>     invoked from within\n> \"show_error {} . \"Sorry, gitk cannot run with this version of Tcl/Tk.\\n Gitk requires at least Tcl/Tk 8.4.\"\"\n>     invoked from within\n> \"if {[catch {package require Tk 8.7} err]} {\n>     show_error {} . \"Sorry, gitk cannot run with this version of Tcl/Tk.\\n\\\n>                      Gitk requires at least ...\"\n>     (file \"./gitk\" line 12012)\n>\n> and no pop-up window.  So this patch still isn't quite right.\n\nGood point. We can fix this by importing ::msgcat::mc earlier.\n\n> Given that old versions of tcl/tk probably don't have [mc], I think\n> it's inevitable that \"OK\" will have to be untranslated for that\n> particular error path.\n\nmsgcat and ::msgcat::mc were added in Tcl 8.1a2, released Febuary 23,\n1998. See the \"changes\" file in\n<ftp://ftp.tcl.tk/pub/tcl/tcl8_1/tcl8.1.tar.gz>. Surely you are not\ntrying to support Tcl 8.0 and earlier, so we should be able to use mc\nall we want.\n\n-Alex\n"}]}