git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Pratyush Yadav <me@yadavpratyush.com>
Cc: Harish Karumuthil <harish2704@gmail.com>,
	git@vger.kernel.org, David Aguilar <davvid@gmail.com>
Subject: Re: [PATCH] Feature: custom guitool commands can now have custom keyboard shortcuts
Date: Sun, 6 Oct 2019 11:49:55 +0200 (CEST)
Message-ID: <nycvar.QRO.7.76.6.1910061054470.46@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20191005210127.uinrgazj5ezyqftj@yadavpratyush.com>

Hi Pratyush,

On Sun, 6 Oct 2019, Pratyush Yadav wrote:

> On 06/10/19 01:46AM, Harish Karumuthil wrote:
> >
> > From https://www.kernel.org/doc/html/v4.10/process/email-clients.html, I
> > understood that, my current email client ( that is gmail web ) is not good
> > for submitting patches. So I was tying to setup a mail client which is
> > compatible with `git send-mail`. But I was not able to get a satisfactory
> > result in that.
>
> You don't need to "set up" an email client with git-send-email.
> git-send-email is an email client itself. Well, one which can only send
> emails.

It also cannot reply to mails on the mailing list.

It cannot even notify you when anybody replied to your patch.

Two rather problematic aspects when it comes to patch contributions: how
are you supposed to work with the reviewers when you lack all the tools
to _interact_ with them? All `git send-email` provides is a "fire and
forget" way to send patches, i.e. it encourages a monologue, when you
want to start a dialogue instead.

> So what you should do is run `git format-patch -o feature master..HEAD`,
> assuming your feature branch is checked out. This will give you a set of
> '.patch' files depending on how many commits you made in your branch in
> the folder feature/. Then, you can run
>
>   git send-email --to='Pratyush Yadav <me@yadavpratyush.com>' --cc='<git@vger.kernel.org>' feature/*.patch
>
> This will send all your patch files via email to me with the git list in
> Cc. You can add multiple '--to' and '--cc' options to send it to
> multiple people.
>
> Try sending the patches to yourself to experiment around with it.
>
> A pretty good tutorial to configuring and using git-send-email can be
> found at [0]. And of course, read the man page.
>
> These instructions are for Linux, but you can probably do something
> similar in Windows too (if you're using Windows that is).

Last I checked, `git send-email` worked in Git for Windows.

But of course, it does not only not address the problem it tries to
solve fully (to provide a way to interact with a mailing list when
submitting patches for review), not even close, to add insult to injury,
it now adds an additional burden to contributors (who might already have
struggled to learn themselves enough Tcl/Tk to fix the problem) to
configure `git send-email` correctly.

> > For now, I followed the instruction of Johannes Schindelin and submitted a
> > pull request . Please see https://github.com/gitgitgadget/git/pull/376
>
> You haven't sent '/submit' over there, so those emails aren't in the
> list (and my inbox) yet. You need to comment with '/submit' (without the
> quotes) to tell GitGitGadget to send your PR as email.

They probably did not hit `/submit` because the initial hurdle is to be
`/allow`ed (a very, very simplistic attempt at trying to prevent
spamming the mailing list by jokesters, of which there are unfortunately
quite a number).

This `/allow` command, BTW, can be issued by anybody who has been
`/allow`ed before, it does not always have to be me.

FWIW you should probably be in that list of `/allow`ed people so that
you can `/allow` new contributors to use GitGitGadget, too.

> [...]
>
> > Since #1 is a serious issue, I tried to find out the function which does the
> > keycode validation, but I haven't succeded till now. ( I found the C function
> > name  which is "TkStringToKeysym" from TK source, but I couldn't find its TCL
> > binding ). It will be helpful if any one can help me on this.
>
> I really think you shouldn't dive around in the C parts of Tcl. I
> haven't looked too deeply into this, but you can probably wrap your bind
> calls in `catch` [2] and handle errors from there. Again, I haven't
> tried actually doing this, so you do need to check first.
>
> You can find examples of how to use `catch` in our codebase. Just search
> for it.

FWIW in addition to the `catch` method, I would also recommend looking
into a minimal (not even necessarily complete) way to translate the Qt
way to specify the keyboard shortcuts (as used by `git-cola`) to Tk
ones.

As indicated in
https://github.com/git/git/pull/220#issuecomment-536045075, the Qt style
`CTRL+,` should be translated to `Control-comma`, for example. In
particular, keystrokes specified in the format indicated at
https://doc.qt.io/archives/qt-4.8/qkeysequence.html#QKeySequence-2 to
the format indicated at https://www.tcl.tk/man/tcl8.4/TkCmd/keysyms.htm.

However, it might not even need to put in _such_ a lot of work: in my
tests, `Control-,` worked just as well as `Control-comma`. To test this
for yourself, use this snippet (that is slightly modified from the
example at the bottom of https://www.tcl.tk/man/tcl/TkCmd/bind.htm so
that it reacts _only_ to Control+comma instead of all keys):

-- snip --
set keysym "Press any key"
pack [label .l -textvariable keysym -padx 2m -pady 1m]
#bind . <Key> {
bind . <Control-,> {
    set keysym "You pressed %K"
}
-- snap --

So I could imagine that something like this could serve as an initial
draft for a function that you can turn into a "good enough" version:

-- snip --
proc QKeySequence2keysym {keystroke} {
	regsub -all {(?i)Ctrl\+} $keystroke "Control-" keystroke
	regsub -all {(?i)Alt\+} $keystroke "Alt-" keystroke
	regsub -all {(?i)Shift\+} $keystroke "Shift-" keystroke
	return $keystroke
}
-- snap --

That way, you don't have to introduce settings separate from
`git-cola`'s, and you can reuse the short-and-sweet variable name.

Ciao,
Johannes

  reply	other threads:[~2019-10-06  9:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29 11:38 Harish K
2016-03-31 16:41 ` David Aguilar
2016-04-01  6:32   ` harish k
2019-10-03 14:48     ` harish k
2019-10-03 21:44       ` Pratyush Yadav
2019-10-04  8:49         ` Johannes Schindelin
2019-10-04 12:01           ` Pratyush Yadav
2019-10-05 20:16             ` Harish Karumuthil
2019-10-05 21:01               ` Pratyush Yadav
2019-10-06  9:49                 ` Johannes Schindelin [this message]
2019-10-06 18:39                   ` Pratyush Yadav
2019-10-06 19:37                     ` Philip Oakley
2019-10-06 20:27                     ` Johannes Schindelin
2019-10-06 21:06                       ` Pratyush Yadav
2019-10-07  9:20                         ` GitGUIGadget, was " Johannes Schindelin
2019-10-07 10:43                           ` Birger Skogeng Pedersen
2019-10-07 19:16                             ` Alban Gruin
2019-11-19 22:09                         ` Making GitGitGadget's list -> PR comment mirroring bidirectional, " Johannes Schindelin
2019-11-20 14:22                           ` Pratyush Yadav
2019-10-06 22:40                       ` Philip Oakley
2019-10-07  6:22                   ` Harish Karumuthil
2019-10-07 10:01                     ` Johannes Schindelin
2019-10-08 19:31                       ` Harish Karumuthil
2019-10-09 20:42                         ` Johannes Schindelin
2019-10-13 20:09                         ` Pratyush Yadav
2019-10-07  6:13                 ` Harish Karumuthil
2019-10-13 19:17                   ` Pratyush Yadav
  -- strict thread matches above, loose matches on Subject: below --
2016-03-29 11:29 Harish K
2016-03-31 16:49 ` David Aguilar

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=nycvar.QRO.7.76.6.1910061054470.46@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=harish2704@gmail.com \
    --cc=me@yadavpratyush.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

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git