Increasing the diversity of people who write Python

Mikhail V mikhailwas at gmail.com
Mon Nov 27 21:33:39 EST 2017


On Mon, Nov 27, 2017 at 8:09 PM, Alexandre Brault <abrault at mapgears.com> wrote:
> A quick Google search turned up WinCompose. It defaults to Right-Alt for
> its compose key, but that's configurable
>
> On 2017-11-27 02:05 PM, Paul Moore wrote:
>> On 27 November 2017 at 18:13, Skip Montanaro <skip.montanaro at gmail.com> wrote:
>>>> If you have a Windows key, you can assign it to be
>>>> the Compose key.
>>> Would this be true on a machine running Windows? My work environment
>>> has me developing on Linux, with a Windows desktop. It's not clear to
>>> me that any sort of xmodmap shennanigans would work. Won't Windows
>>> itself always gobble up that key?
>> Programs can access the Windows key. IIRC, there is a utility that
>> provides compose-key functionality on Windows. I can't recall the name
>> right now and it's on my other PC, not this one, but I'll try to
>> remember to post the name tomorrow...
>>
>> Paul


On Windows people usually use AHK (Autohotkey).
It is a programming language, so you can do anything you
want. For example, here is a script that converts two
characters to the left of current cursor position:
if it is "e" followed by apostrophe then it replaces it with é,

;---------------------------
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

parse_clip(str) {
    firstchar := substr(str, 1,1)
    lastchar := substr(str, 2,2)
    if  (lastchar = "'") {
        if (firstchar = "e") {
            Send, {raw}é
        }
        if (firstchar = "a") {
            Send, {raw}á
        }
    }
    else {
        Send, {right}
    }
}


Esc:: ExitApp

!c::
    clipboard := ""
    Send, {Shift down}{left}{left}{Shift up}
    Send, ^c
    Clipwait, 1
    gettext := clipboard
    parse_clip(gettext)
return

;---------------------------

So here the command is bound to Alt-C,
it selects two previus chars (shift+arrow commands), copies to clipboard
and parses the contents. It works system-wide, but
can be programmed to specific app as well.
Best thing is, you can program it youself as you like.
However if you want to program with AHK,
be prepared to invest time, it is not the easiest
programming language out there, only built-ins
probably more than hundred, so better not try to code without
syntax highlighting :)
.



More information about the Python-list mailing list