An adapted portuguese layout and an issue "ErgoEmacs.exe" has with it.

19 views
Skip to first unread message

Xavier Gomes Pinho

unread,
Sep 13, 2010, 8:30:16 AM9/13/10
to ergo...@googlegroups.com

  Inspired by Xah's essays on keyboard layouts and ergonomics, i searched the web for studies on keyboard layouts for the portuguese language. The only reference i found useful was <http://tecladobrasileiro.com.br>, but they seem to have done their homework well, for the end result so far (3 weeks) feels good on the hands. It also taught me touch-typing and i can type already almost as fast as i could when using the previous qwerty-based layout i've used for years. And to finish this introductory bit, let me say that Klavaro is a very nice piece of software to help touch-type apprentices measure their progress.

  I edited the us-layout so to reflect my current keyboard layout and named it "pt-nativo" accordingly. Adapted ErgoEmacs-mode where needed and am already using it, but only if i have the ERGOEMACS_KEYBOARD_LAYOUT variable defined a priori its execution. I believe i have the data "ErgoEmacs.exe" needs to recognize this layout and set the environment variable for me by means of the output of the following C code:

     #include <windows.h>
     #include <winuser.h>
     #include <stdio.h>
    
     int main(void){
         char buf[KL_NAMELENGTH];

         printf("GetKeyboardLayoutName(%p) = %d\n", buf, (char) GetKeyboardLayoutName(buf));
         printf("%p = %s\n", buf, buf);
         printf("kbdcode = %d\n", strtol(buf, NULL, 16) & 0xfffff);

         return 0;
     }

which consistently prints:

     GetKeyboardLayoutName(000000000012fef7) = 1
     000000000012fef7 = A0000816
     kbdcode = 1048575


  I took a look at ErgoEmacs.c and am guessing that this new keyboard layout code overflows the current range supported. But i leave such matters to the competent ones. As a side note, i'm running ErgoEmacs 1.8.1 on Windows 7 64bit.

  Beside this, i only dislike the relatively slow startup time for one particular reason: i usually move its window while loading but when it finishes, it resizes and moves again. It's no biggie, just a bit annoying. Curiously, i wanted to see what would the bare mininum be to run ErgoEmacs-mode, so i downloaded the "barebones" version of Emacs 23.2, copied ErgoEmacs-mode, made it load through "site-start.el" and, dependency by dependency, went on copying files to the "lisp" directory until it run. If you care to know, they are: redo.el, delsel.el, easy-mmode.el, help-fns.el, edmacro.el, kmacro.el, cl.el, cl-loaddefs.el, cl-macs.el, bytecomp.el and cl-seq.el.

  In the end, i would like you to know that i appreciate your efforts and that ErgoEmacs already means a great deal to me. Attached in a zip file comes my current keyboard layout. In my private setup, i described it as "An adapted portuguese keyboard layout" in "ergoemacs-mode.el".

  Another thing i would like to address before leaving this post: this is my first time using such a platform as "Google Code". If this post is misplaced or by any means i did not comply with what was expected, would you care to educate me so i don't make the same mistake again?

Cordial regards, Xavier Pinho.

ergoemacs-layout-pt-nativo.zip

Xah Lee

unread,
Sep 13, 2010, 8:59:54 AM9/13/10
to ErgoEmacs
wow, that's in depth study and with many helpful info and code as
well!

Thank you very much.

I'll take the time in the next few weeks to incorporate your addition
and suggestions, also will add the Portuguese layout to my essay. (the
C code part i'm unable to help but am sure David will have a look at
it)

thanks a lot, and welcome to ErgoEmacs. :D

Xah

On Sep 13, 5:30 am, "Xavier Gomes Pinho" <a52...@alunos.uminho.pt>
wrote:
>  ergoemacs-layout-pt-nativo.zip
> 1KViewDownload

Xah Lee

unread,
Sep 13, 2010, 10:18:49 AM9/13/10
to ErgoEmacs
hi Xavier,

On Sep 13, 5:30 am, "Xavier Gomes Pinho" <a52...@alunos.uminho.pt>
wrote:
« Inspired by Xah's essays on keyboard layouts and ergonomics, i
searched the web for studies on keyboard layouts for the portuguese
language. The only reference i found useful was <http://
tecladobrasileiro.com.br>, but they seem to have done their homework
well, for the end result so far (3 weeks) feels good on the hands. It
also taught me touch-typing and i can type already almost as fast as i
could when using the previous qwerty-based layout i've used for years.
And to finish this introductory bit, let me say that Klavaro is a very
nice piece of software to help touch-type apprentices measure their
progress.»

i've added br-nativo layout to my essay, with thanks to you.
( http://xahlee.org/kbd/dvorak_and_all_keyboard_layouts.html )

btw, if you have a website, please let me know so i can link your name
to it. Thanks again for the info. The site seems put a lot thought
into it as you suggested.

will answer other parts of your message later.

seems we missing a spanish one, one of the top 3 most spoken lang.
Haven't came across any well established one.

Xah

Xavier Pinho

unread,
Sep 14, 2010, 9:03:57 AM9/14/10
to ErgoEmacs
Hi Xah,
I'm glad my post interested you. About a website, i have none. But,
if i ever setup one, i'll let you know. :D

Let me qualify that list of dependencies on which ErgoEmacs-mode
depends just to be more explicit. In order just for Emacs to run, i
needed to create the "lisp" and "etc/charsets" directories, and copy
these files to the "lisp" directory: "term/w32-win.el", "simple.el"
and "warnings.el". Then, in order to run ErgoEmacs-mode, i needed
those files i enumerated in my previous post. If somebody really cares
for this, i could translate and upload the notes i took whilst doing
it.

Starting tomorrow, i'll be busy with non-it affairs for a few months
and perhaps unable to answer any e-mails. Just wanted to make sure you
don't misunderstand my absence. I'll try to keep pace with ErgoEmacs
releases, though.

Best wishes, Xavier Pinho.

David Capello

unread,
Sep 14, 2010, 6:20:28 PM9/14/10
to ergo...@googlegroups.com
Hi Xavier,

On Mon, Sep 13, 2010 at 9:30 AM, Xavier Gomes Pinho <a52...@alunos.uminho.pt> wrote:

  Inspired by Xah's essays on keyboard layouts and ergonomics, i searched the web for studies on keyboard layouts for the portuguese language. The only reference i found useful was <http://tecladobrasileiro.com.br>, but they seem to have done their homework well, for the end result so far (3 weeks) feels good on the hands. It also taught me touch-typing and i can type already almost as fast as i could when using the previous qwerty-based layout i've used for years. And to finish this introductory bit, let me say that Klavaro is a very nice piece of software to help touch-type apprentices measure their progress.

  I edited the us-layout so to reflect my current keyboard layout and named it "pt-nativo" accordingly. Adapted ErgoEmacs-mode where needed and am already using it, but only if i have the ERGOEMACS_KEYBOARD_LAYOUT variable defined a priori its execution. I believe i have the data "ErgoEmacs.exe" needs to recognize this layout and set the environment variable for me by means of the output of the following C code:


I think ERGOEMACS_KEYBOARD_LAYOUT should be equal to "po" (0x00816).
In this case your layout should be called ergoemacs-layout-po.el. See the list of
layouts in ErgoEmacs.c, already there exist the following entry:

   { 0x00816, "po", "Portuguese" },

In this way your layout will be automatically recognized (rename "pt-nativo" to "po").
Just in case, check if your keyboard layout is equal to this one:
 
If this is the case, definitely your layout should be called "po".


     #include <windows.h>
     #include <winuser.h>
     #include <stdio.h>
    
     int main(void){
         char buf[KL_NAMELENGTH];

         printf("GetKeyboardLayoutName(%p) = %d\n", buf, (char) GetKeyboardLayoutName(buf));
         printf("%p = %s\n", buf, buf);
         printf("kbdcode = %d\n", strtol(buf, NULL, 16) & 0xfffff);

         return 0;
     }

which consistently prints:

     GetKeyboardLayoutName(000000000012fef7) = 1
     000000000012fef7 = A0000816
     kbdcode = 1048575


  I took a look at ErgoEmacs.c and am guessing that this new keyboard layout code overflows the current range supported. But i leave such matters to the competent ones. As a side note, i'm running ErgoEmacs 1.8.1 on Windows 7 64bit.

  Beside this, i only dislike the relatively slow startup time for one particular reason: i usually move its window while loading but when it finishes, it resizes and moves again. It's no biggie, just a bit annoying. Curiously, i wanted to see what would the bare mininum be to run ErgoEmacs-mode, so i downloaded the "barebones" version of Emacs 23.2, copied ErgoEmacs-mode, made it load through "site-start.el" and, dependency by dependency, went on copying files to the "lisp" directory until it run. If you care to know, they are: redo.el, delsel.el, easy-mmode.el, help-fns.el, edmacro.el, kmacro.el, cl.el, cl-loaddefs.el, cl-macs.el, bytecomp.el and cl-seq.el.

  In the end, i would like you to know that i appreciate your efforts and that ErgoEmacs already means a great deal to me. Attached in a zip file comes my current keyboard layout. In my private setup, i described it as "An adapted portuguese keyboard layout" in "ergoemacs-mode.el".

  Another thing i would like to address before leaving this post: this is my first time using such a platform as "Google Code". If this post is misplaced or by any means i did not comply with what was expected, would you care to educate me so i don't make the same mistake again?

Cordial regards, Xavier Pinho.

-- 

Xavier Pinho

unread,
Sep 14, 2010, 7:59:08 PM9/14/10
to ErgoEmacs
Hi David,
The keyboard layout you presented is, in fact, the most common and
used in Portugal. However, it's not the one i'm using for i recently
switched to this one: <http://tecladobrasileiro.com.br/images/stories/
pt-nativo/pt-nativo-completo.svg>. The layout i uploaded in my
previous post is designed for the latter.

Cordial regards, Xavier Pinho.

David Capello

unread,
Sep 14, 2010, 10:21:11 PM9/14/10
to ergo...@googlegroups.com
Oh ok, sorry (I miss understood). Anyway, I think ErgoEmacs.exe will
not be able to identify that keyboard layout automatically (the keyboard
code is 0x00816, same as the Portuguese one). Maybe doing some
special trick...
 

Cordial regards, Xavier Pinho.

--
You received this message because you are subscribed to the Google Groups "ErgoEmacs" group.
To post to this group, send email to ergo...@googlegroups.com.
To unsubscribe from this group, send email to ergoemacs+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ergoemacs?hl=en.


Xah Lee

unread,
Nov 11, 2010, 5:13:53 PM11/11/10
to ErgoEmacs
hi Xavier,

i'm incorporating the nativo layout into coming release.

One question, should the name be br-nativo or pt-nativo or pt-teclado?
I couldn't read Portuguese and translation isn't helpful here. Your
file name is ergoemacs-layout-pt-nativo.el , and i think that's good?
Am wondering because the site doesn't seem to use the phrase pt-
nativo...

Xah

On Sep 13, 4:30 am, "Xavier Gomes Pinho" <a52...@alunos.uminho.pt>
wrote:
>  ergoemacs-layout-pt-nativo.zip
> 1KViewDownload

Xavier Pinho

unread,
Nov 17, 2010, 6:32:07 PM11/17/10
to ErgoEmacs
Hi Xah,

I'm just coming from reading your blog and, just there, i noticed this
update of yours. Please accept my apologies for this delayed response.

About the name, you did the right thing! The file i e-mailed before
was for the "pt-nativo" variant. "br-nativo" is another variant that,
i suppose, takes into account differences between the brazilian and
european dialects of Portuguese. I've only used the one i e-mailed so
i can't tell much more about the others.

Cordial Regards, Xavier Pinho.
Reply all
Reply to author
Forward
0 new messages