emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Key bindings proposal


From: Jan Djärv
Subject: Re: Key bindings proposal
Date: Sat, 28 Aug 2010 12:58:02 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2



Jason Rumney skrev 2010-08-28 12.13:
On 28/8/2010 5:41 PM, Jan Djärv wrote:

Sure, but putting in stuff like :key-accel makes translation harder and you
have to add lisp and C code to handle it. Text properties exist now.

It is trivial to make a function that takes for example "_File" and turns
this into a string with "File" and a text property on F.

It's not significantly more difficult than a function that replaces both the
menu text and the :key-accel (or :mnemonic to use the GTK and Motif name
rather than the MS Windows one) property given the menu item that is being
translated and the translation string as above.

The interface should be what is easy for the users of the function, not what
is slightly easier for the person who implements the feature.


Agreed. But it is a fundamentally bad design to keep information in two places. Take this:

(define-key menu-bar-file-menu [exit-emacs]
  `(menu-item ,(purecopy "Quit") save-buffers-kill-terminal
              :key-accel "Q"
              :help ,(purecopy "Save unsaved buffers, then exit")))

Information in two places. You may think it is not a big deal, but Motif uses a similar scheme (a property that is the number of the acceleration character). People has to update in two places. When changing menu text mistakes will be made and :key-accel will be wrong. I seen this happen in Motif apps, it will happen here also.

Keeping the accelerator indication in the string itself:
(define-key menu-bar-file-menu [exit-emacs]
  `(menu-item ,(purecopy "_Quit") save-buffers-kill-terminal
              :help ,(purecopy "Save unsaved buffers, then exit")))

almost guarantees that bad things won't happen.

This is without any translation. That is a separate matter. For example, how are you going to present the first case to a translator that uses gettext? He only sees "Quit" and does not know where the accelerator is or that there should be one. Gettext collects it strings automatically from sources such as .el files and does not know about :key-accel.

        Jan D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]