{"thread":{"id":"51799","subject":"Re: [PATCH] Add hotkey to toggle \"Amend Last Commit\" radio selector","startedAt":"2019-09-04T06:00:44Z","lastAt":"2019-09-05T20:14:20Z","messageCount":5,"participants":["Birger Skogeng Pedersen","Pratyush Yadav","Bert Wesarg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"381793","messageId":"CAGr--=JFVK6JoribkFQHpf-JRutO9XfKcFh9_adV3T2gYjvYcQ@mail.gmail.com","threadId":"51799","inReplyTo":null,"subject":"Re: [PATCH] Add hotkey to toggle \"Amend Last Commit\" radio selector","fromName":"Birger Skogeng Pedersen","fromEmail":"birger.sp@gmail.com","sentAt":"2019-09-04T05:58:17Z","receivedAt":"2019-09-04T06:00:44Z","isPatch":true,"sender":{"key":"birger.sp@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5260237?v=4"},"body":"Hi Pratyush,\n\n\nSo how does this work? Should I email the patch that Bert has created?\nOr is it okay that it just remains on Github. (Considering the git\nmail archives)\n\n\nBirger\n"},{"id":"381803","messageId":"20190904173642.2hkrqm5klatw33w7@yadavpratyush.com","threadId":"51799","inReplyTo":"CAGr--=JFVK6JoribkFQHpf-JRutO9XfKcFh9_adV3T2gYjvYcQ@mail.gmail.com","subject":"Re: [PATCH] Add hotkey to toggle \"Amend Last Commit\" radio selector","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2019-09-04T17:36:42Z","receivedAt":"2019-09-04T17:36:48Z","isPatch":true,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"On 04/09/19 07:58AM, Birger Skogeng Pedersen wrote:\n> Hi Pratyush,\n> \n> \n> So how does this work? Should I email the patch that Bert has created?\n> Or is it okay that it just remains on Github. (Considering the git\n> mail archives)\n\nI think it would be a good idea to send it on the list once before we go \nahead with it.  This way other people who are interested can take a \nlook.  They might not necessarily pay enough attention to the threads to \nnotice the GitHub link.  And there is, as you mentioned, the added \nbenefit of having it on the mailing list archives.\n\n-- \nRegards,\nPratyush Yadav\n"},{"id":"381808","messageId":"20190904175943.11924-1-birger.sp@gmail.com","threadId":"51799","inReplyTo":"20190904173642.2hkrqm5klatw33w7@yadavpratyush.com","subject":"[PATCH v2] git-gui: add hotkey to toggle \"Amend Last Commit\" radio selector","fromName":"Birger Skogeng Pedersen","fromEmail":"birger.sp@gmail.com","sentAt":"2019-09-04T17:59:43Z","receivedAt":"2019-09-04T18:25:07Z","isPatch":true,"sender":{"key":"birger.sp@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5260237?v=4"},"body":"Selecting whether to do a \"New Commit\" or \"Amend Last Commit\" does not have\na hotkey.\n\nWith this patch, the user may toggle between the two options with\nCTRL/CMD+e.\n\nSigned-off-by: Birger Skogeng Pedersen <birger.sp@gmail.com>\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n git-gui.sh | 40 +++++++++++++++++++++++++++++++++++-----\n 1 file changed, 35 insertions(+), 5 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 5bc21b8..47c5db0 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -1445,7 +1445,7 @@ proc force_amend {} {\n \tset commit_type $newType\n \n \tset selected_commit_type amend\n-\tdo_select_commit_type\n+\tui_select_commit_type\n }\n \n proc rescan {after {honor_trustmtime 1}} {\n@@ -2640,6 +2640,16 @@ proc show_less_context {} {\n \t}\n }\n \n+proc toggle_commit_type {} {\n+\tglobal selected_commit_type\n+\tif {[string match amend* $selected_commit_type]} {\n+\t\tset selected_commit_type new\n+\t} else {\n+\t\tset selected_commit_type amend\n+\t}\n+\tui_select_commit_type\n+}\n+\n ######################################################################\n ##\n ## ui construction\n@@ -2824,13 +2834,31 @@ proc commit_btn_caption {} {\n \t}\n }\n \n+proc ui_select_commit_type {} {\n+\tglobal selected_commit_type\n+\tglobal ui_commit_type_commit ui_commit_type_amend\n+\n+\tdo_select_commit_type\n+\tif {$selected_commit_type eq {new}} {\n+\t\t.mbar.commit entryconf [mc \"New Commit\"] \\\n+\t\t\t-accelerator {}\n+\t\t.mbar.commit entryconf [mc \"Amend Last Commit\"] \\\n+\t\t\t-accelerator $::M1T-E\n+\t} elseif {$selected_commit_type eq {amend}} {\n+\t\t.mbar.commit entryconf [mc \"New Commit\"] \\\n+\t\t\t-accelerator $::M1T-E\n+\t\t.mbar.commit entryconf [mc \"Amend Last Commit\"] \\\n+\t\t\t-accelerator {}\n+\t}\n+}\n+\n if {[is_enabled multicommit] || [is_enabled singlecommit]} {\n \tmenu .mbar.commit\n \n \tif {![is_enabled nocommit]} {\n \t\t.mbar.commit add radiobutton \\\n \t\t\t-label [mc \"New Commit\"] \\\n-\t\t\t-command do_select_commit_type \\\n+\t\t\t-command ui_select_commit_type \\\n \t\t\t-variable selected_commit_type \\\n \t\t\t-value new\n \t\tlappend disable_on_lock \\\n@@ -2838,7 +2866,8 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {\n \n \t\t.mbar.commit add radiobutton \\\n \t\t\t-label [mc \"Amend Last Commit\"] \\\n-\t\t\t-command do_select_commit_type \\\n+\t\t\t-accelerator $M1T-E \\\n+\t\t\t-command ui_select_commit_type \\\n \t\t\t-variable selected_commit_type \\\n \t\t\t-value amend\n \t\tlappend disable_on_lock \\\n@@ -3315,14 +3344,14 @@ set ui_coml .vpane.lower.commarea.buffer.header.l\n if {![is_enabled nocommit]} {\n \t${NS}::radiobutton .vpane.lower.commarea.buffer.header.new \\\n \t\t-text [mc \"New Commit\"] \\\n-\t\t-command do_select_commit_type \\\n+\t\t-command ui_select_commit_type \\\n \t\t-variable selected_commit_type \\\n \t\t-value new\n \tlappend disable_on_lock \\\n \t\t[list .vpane.lower.commarea.buffer.header.new conf -state]\n \t${NS}::radiobutton .vpane.lower.commarea.buffer.header.amend \\\n \t\t-text [mc \"Amend Last Commit\"] \\\n-\t\t-command do_select_commit_type \\\n+\t\t-command ui_select_commit_type \\\n \t\t-variable selected_commit_type \\\n \t\t-value amend\n \tlappend disable_on_lock \\\n@@ -3843,6 +3872,7 @@ bind .   <$M1B-Key-equal> {show_more_context;break}\n bind .   <$M1B-Key-plus> {show_more_context;break}\n bind .   <$M1B-Key-KP_Add> {show_more_context;break}\n bind .   <$M1B-Key-Return> do_commit\n+bind .   <$M1B-Key-e> toggle_commit_type\n foreach i [list $ui_index $ui_workdir] {\n \tbind $i <Button-1>       { toggle_or_diff click %W %x %y; break }\n \tbind $i <$M1B-Button-1>  { add_one_to_selection %W %x %y; break }\n-- \n2.21.0.windows.1\n\n"},{"id":"381811","messageId":"CAKPyHN0+Wj8YtGF6Ke45o1f3kLuE+9KU6cYUMhyqCdDXSqj-PQ@mail.gmail.com","threadId":"51799","inReplyTo":"20190904173642.2hkrqm5klatw33w7@yadavpratyush.com","subject":"Re: [PATCH] Add hotkey to toggle \"Amend Last Commit\" radio selector","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-09-04T18:55:52Z","receivedAt":"2019-09-04T18:56:06Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Wed, Sep 4, 2019 at 7:36 PM Pratyush Yadav <me@yadavpratyush.com> wrote:\n>\n> On 04/09/19 07:58AM, Birger Skogeng Pedersen wrote:\n> > Hi Pratyush,\n> >\n> >\n> > So how does this work? Should I email the patch that Bert has created?\n> > Or is it okay that it just remains on Github. (Considering the git\n> > mail archives)\n>\n> I think it would be a good idea to send it on the list once before we go\n> ahead with it.  This way other people who are interested can take a\n> look.  They might not necessarily pay enough attention to the threads to\n> notice the GitHub link.  And there is, as you mentioned, the added\n> benefit of having it on the mailing list archives.\n\nI'm finally able to send patches around again. Though I find the idea\nfrom Johannes appealing to convert this to a check button. Are you\nwith this?\n\nBert\n\n>\n> --\n> Regards,\n> Pratyush Yadav\n"},{"id":"381913","messageId":"CAKPyHN2EFKnkgAoCCJ4zdO7hvMsATuSweraxkR_KJZUhuzizPA@mail.gmail.com","threadId":"51799","inReplyTo":"20190904175943.11924-1-birger.sp@gmail.com","subject":"Re: [PATCH v2] git-gui: add hotkey to toggle \"Amend Last Commit\" radio selector","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-09-05T20:14:06Z","receivedAt":"2019-09-05T20:14:20Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Wed, Sep 4, 2019 at 8:00 PM Birger Skogeng Pedersen\n<birger.sp@gmail.com> wrote:\n>\n> Selecting whether to do a \"New Commit\" or \"Amend Last Commit\" does not have\n> a hotkey.\n>\n> With this patch, the user may toggle between the two options with\n> CTRL/CMD+e.\n>\n> Signed-off-by: Birger Skogeng Pedersen <birger.sp@gmail.com>\n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> ---\n>  git-gui.sh | 40 +++++++++++++++++++++++++++++++++++-----\n>  1 file changed, 35 insertions(+), 5 deletions(-)\n>\n> diff --git a/git-gui.sh b/git-gui.sh\n> index 5bc21b8..47c5db0 100755\n> --- a/git-gui.sh\n> +++ b/git-gui.sh\n> @@ -1445,7 +1445,7 @@ proc force_amend {} {\n>         set commit_type $newType\n>\n>         set selected_commit_type amend\n> -       do_select_commit_type\n> +       ui_select_commit_type\n>  }\n>\n>  proc rescan {after {honor_trustmtime 1}} {\n> @@ -2640,6 +2640,16 @@ proc show_less_context {} {\n>         }\n>  }\n>\n> +proc toggle_commit_type {} {\n> +       global selected_commit_type\n> +       if {[string match amend* $selected_commit_type]} {\n\nonly $commit_type has multiple incarnations of amend, thus this should\nhave been $commit_type here.\n\nThough I posted new patches which convert it first to b a checkbutton\nand than addedyour keybinding patch on top of it.\n\nBert\n\n> +               set selected_commit_type new\n> +       } else {\n> +               set selected_commit_type amend\n> +       }\n> +       ui_select_commit_type\n> +}\n> +\n>  ######################################################################\n>  ##\n>  ## ui construction\n> @@ -2824,13 +2834,31 @@ proc commit_btn_caption {} {\n>         }\n>  }\n>\n> +proc ui_select_commit_type {} {\n> +       global selected_commit_type\n> +       global ui_commit_type_commit ui_commit_type_amend\n> +\n> +       do_select_commit_type\n> +       if {$selected_commit_type eq {new}} {\n> +               .mbar.commit entryconf [mc \"New Commit\"] \\\n> +                       -accelerator {}\n> +               .mbar.commit entryconf [mc \"Amend Last Commit\"] \\\n> +                       -accelerator $::M1T-E\n> +       } elseif {$selected_commit_type eq {amend}} {\n> +               .mbar.commit entryconf [mc \"New Commit\"] \\\n> +                       -accelerator $::M1T-E\n> +               .mbar.commit entryconf [mc \"Amend Last Commit\"] \\\n> +                       -accelerator {}\n> +       }\n> +}\n> +\n>  if {[is_enabled multicommit] || [is_enabled singlecommit]} {\n>         menu .mbar.commit\n>\n>         if {![is_enabled nocommit]} {\n>                 .mbar.commit add radiobutton \\\n>                         -label [mc \"New Commit\"] \\\n> -                       -command do_select_commit_type \\\n> +                       -command ui_select_commit_type \\\n>                         -variable selected_commit_type \\\n>                         -value new\n>                 lappend disable_on_lock \\\n> @@ -2838,7 +2866,8 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {\n>\n>                 .mbar.commit add radiobutton \\\n>                         -label [mc \"Amend Last Commit\"] \\\n> -                       -command do_select_commit_type \\\n> +                       -accelerator $M1T-E \\\n> +                       -command ui_select_commit_type \\\n>                         -variable selected_commit_type \\\n>                         -value amend\n>                 lappend disable_on_lock \\\n> @@ -3315,14 +3344,14 @@ set ui_coml .vpane.lower.commarea.buffer.header.l\n>  if {![is_enabled nocommit]} {\n>         ${NS}::radiobutton .vpane.lower.commarea.buffer.header.new \\\n>                 -text [mc \"New Commit\"] \\\n> -               -command do_select_commit_type \\\n> +               -command ui_select_commit_type \\\n>                 -variable selected_commit_type \\\n>                 -value new\n>         lappend disable_on_lock \\\n>                 [list .vpane.lower.commarea.buffer.header.new conf -state]\n>         ${NS}::radiobutton .vpane.lower.commarea.buffer.header.amend \\\n>                 -text [mc \"Amend Last Commit\"] \\\n> -               -command do_select_commit_type \\\n> +               -command ui_select_commit_type \\\n>                 -variable selected_commit_type \\\n>                 -value amend\n>         lappend disable_on_lock \\\n> @@ -3843,6 +3872,7 @@ bind .   <$M1B-Key-equal> {show_more_context;break}\n>  bind .   <$M1B-Key-plus> {show_more_context;break}\n>  bind .   <$M1B-Key-KP_Add> {show_more_context;break}\n>  bind .   <$M1B-Key-Return> do_commit\n> +bind .   <$M1B-Key-e> toggle_commit_type\n>  foreach i [list $ui_index $ui_workdir] {\n>         bind $i <Button-1>       { toggle_or_diff click %W %x %y; break }\n>         bind $i <$M1B-Button-1>  { add_one_to_selection %W %x %y; break }\n> --\n> 2.21.0.windows.1\n>\n"}]}