GNU bug report logs - #51449
28.0.50; iso-transl overwrites alt key bindings

Previous Next

Package: emacs;

Reported by: "Mark Bestley" <gnu <at> bestley.co.uk>

Date: Wed, 27 Oct 2021 21:02:03 UTC

Severity: normal

Tags: notabug

Found in version 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51449 in the body.
You can then email your comments to 51449 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Wed, 27 Oct 2021 21:02:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Mark Bestley" <gnu <at> bestley.co.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 27 Oct 2021 21:02:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Mark Bestley" <gnu <at> bestley.co.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; iso-transl overwrites alt key bindings
Date: Wed, 27 Oct 2021 21:42:19 +0100
[Message part 1 (text/plain, inline)]
In emacs -Q just need something to get the Alt key bound
e.g.
(setq  mac-command-modifier 'alt)

The when you Type A-c you get ¢ and you cannot bind it yourself.

On a mac I want the key by space to be Alt as that is what is printed on
my PC keyboard. I suspect this is true with PCs

The issue is that (require 'iso-transl) is called before the user can alter its behaviour and that iso-transl.el then binds to various A-c and other keys.

This makes it impossible to use Alt as a modifier key

load-history shows

("/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/subdirs.el <http://emacs.app/Contents/Resources/lisp/subdirs.el>")
("/Applications/MacPorts/Emacs.app/Contents/Resources/site-lisp/subdirs.el <http://emacs.app/Contents/Resources/site-lisp/subdirs.el>")
("/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/leim/leim-list.el <http://emacs.app/Contents/Resources/lisp/leim/leim-list.el>")
("/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/international/iso-transl.elc <http://emacs.app/Contents/Resources/lisp/international/iso-transl.elc>" iso-transl-dead-key-alist iso-transl-char-map iso-transl-language-alist iso-transl-ctl-x-8-map
  (defun . iso-transl-define-keys)
  (defun . iso-transl-set-language)
  (provide . iso-transl))
("/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/tooltip.elc <http://emacs.app/Contents/Resources/lisp/tooltip.elc>"
  (require . syntax)
 
In emacs 27 iso-transl was not called that early and only seem to be
called by describe-bindings and so could be overridden as shown in Aquamacs

Ideally iso-transl should only bind the A- keys if explicitly asked to
do so. At least the user shoulkd be able to configure the behaviour - as
exising emacs uses this wrong behaviour the default can be this setting
of A- keys but the user should be able to set something to stop this.

See
https://emacs.stackexchange.com/questions/17508/how-can-i-prevent-override-key-translation-behavior-such-as-%C2%B5-translated-from
for other users finding this (and they are not Mac based)

In GNU Emacs 28.0.50 (build 1, aarch64-apple-darwin20.6.0, NS appkit-2022.60 Version 11.6 (Build 20G165))
of 2021-10-17 built on mini20.local
Repository revision: ccb35fb8fb9de5f069fd0103f24e3048d716febc
Repository branch: HEAD
Windowing system distributor 'Apple', version 10.3.2022
System Description:  macOS 11.6

Configured using:
'configure --prefix=/opt/local --disable-silent-rules --without-dbus
--without-gconf --without-libotf --without-m17n-flt --with-libgmp
--with-gnutls --with-json --with-xml2 --with-modules --infodir
/opt/local/share/info/emacs --with-ns --with-lcms2 --without-harfbuzz
--without-imagemagick --without-xaw3d --with-native-compilation
--with-rsvg 'CFLAGS=-pipe -Os
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch
arm64' 'CPPFLAGS=-I/opt/local/include
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk'
'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-no_pie
-Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
-arch arm64''

Configured features:
ACL GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG THREADS TIFF TOOLKIT_SCROLL_BARS XIM
ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils cl-extra time-date
subr-x shortdoc text-property-search seq byte-opt gv bytecomp
byte-compile cconv help-fns radix-tree help-mode cl-loaddefs cl-lib
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue cocoa ns lcms2
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 80691 8984)
(symbols 48 6822 0)
(strings 32 21275 2068)
(string-bytes 1 715988)
(vectors 16 15733)
(vector-slots 8 322442 18788)
(floats 8 72 30)
(intervals 56 355 0)
(buffers 992 12))

-- 
Mark Bestley
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Wed, 27 Oct 2021 21:49:01 GMT) Full text and rfc822 format available.

Message #8 received at 51449 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Mark Bestley <gnu <at> bestley.co.uk>
Cc: 51449 <at> debbugs.gnu.org
Subject: Re: bug#51449: 28.0.50; iso-transl overwrites alt key bindings
Date: Wed, 27 Oct 2021 21:48:47 +0000
[Message part 1 (text/plain, inline)]
Your bug report is difficult to understand.

>
> In emacs -Q just need something to get the Alt key bound
> e.g.
> (setq  mac-command-modifier 'alt)
>
> The when you Type A-c you get ¢ and you cannot bind it yourself.
>

If you do this, A-c should display "A-c is undefined", which is indeed the 
case, it's not bound to any command (in emacs -Q).

>
> On a mac I want the key by space to be Alt as that is what is printed on 
> my PC keyboard. I suspect this is true with PCs
>

If you want the key on the left of the space bar to be the Meta key in 
Emacs (which is what the Alt key usually does), you should do: (setq 
mac-command-modifier 'meta).

>
> The issue is that (require 'iso-transl) is called before the user can 
> alter its behaviour and that iso-transl.el then binds to various A-c and 
> other keys.
>

The use of the Alt modifier is indeed hardcoded in iso-transl.  If you 
want to use it, you can chose another modifier key on your keyboard, for 
example: (setq mac-right-command-modifier 'alt).  In that case the key on 
the left of your space bar will be Meta, and the key on the right of your 
space bar will be Alt.

Added tag(s) notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 28 Oct 2021 03:07:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Thu, 28 Oct 2021 07:13:02 GMT) Full text and rfc822 format available.

Message #13 received at 51449 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Mark Bestley" <gnu <at> bestley.co.uk>
Cc: 51449 <at> debbugs.gnu.org
Subject: Re: bug#51449: 28.0.50; iso-transl overwrites alt key bindings
Date: Thu, 28 Oct 2021 10:12:32 +0300
> Date: Wed, 27 Oct 2021 21:42:19 +0100
> From: "Mark Bestley" <gnu <at> bestley.co.uk>
> 
> In emacs -Q just need something to get the Alt key bound
> e.g.
> (setq  mac-command-modifier 'alt)
> 
> The when you Type A-c you get ¢ and you cannot bind it yourself.
> 
> On a mac I want the key by space to be Alt as that is what is printed on
> my PC keyboard. I suspect this is true with PCs
> 
> The issue is that (require 'iso-transl) is called before the user can alter its behaviour and that iso-transl.el
> then binds to various A-c and other keys.
> 
> This makes it impossible to use Alt as a modifier key
> 
> load-history shows
> 
> ("/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/subdirs.el")
> ("/Applications/MacPorts/Emacs.app/Contents/Resources/site-lisp/subdirs.el")
> ("/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/leim/leim-list.el")
> ("/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/international/iso-transl.elc"
> iso-transl-dead-key-alist iso-transl-char-map iso-transl-language-alist iso-transl-ctl-x-8-map
>   (defun . iso-transl-define-keys)
>   (defun . iso-transl-set-language)
>   (provide . iso-transl))
> ("/Applications/MacPorts/Emacs.app/Contents/Resources/lisp/tooltip.elc"
>   (require . syntax)
>  
> In emacs 27 iso-transl was not called that early and only seem to be
> called by describe-bindings and so could be overridden as shown in Aquamacs

iso-transl is preloaded now.  But I don't think I understand why it
gets in your way: can't you unbind the bindings that iso-transl does,
if you have no use for them, or rebind them after changing Alt to be a
modifier key if you do have use for iso-transl?

(Caveat: I don't use a Mac, so I may be missing some Mac-specific
issue here.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Thu, 28 Oct 2021 08:14:02 GMT) Full text and rfc822 format available.

Message #16 received at 51449 <at> debbugs.gnu.org (full text, mbox):

From: "Mark Bestley" <gnu <at> bestley.co.uk>
To: "Eli Zaretskii" <eliz <at> gnu.org>
Cc: 51449 <at> debbugs.gnu.org
Subject: Re: bug#51449: 28.0.50; iso-transl overwrites alt key bindings
Date: Thu, 28 Oct 2021 09:12:54 +0100
On Thu, 28 Oct 2021, at 08:12, Eli Zaretskii wrote:

>
> iso-transl is preloaded now.  But I don't think I understand why it
> gets in your way: can't you unbind the bindings that iso-transl does,
> if you have no use for them, or rebind them after changing Alt to be a
> modifier key if you do have use for iso-transl?
>
> (Caveat: I don't use a Mac, so I may be missing some Mac-specific
> issue here.)

In scratch buffer on emacs - Q


(setq  mac-command-modifier 'alt)

(global-set-key (kbd "A-c")  'info)
(global-set-key (kbd "A-z")  'info)

Then A-z runs info but A-c just inserts ¢

-- 
Mark




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Thu, 28 Oct 2021 08:41:02 GMT) Full text and rfc822 format available.

Message #19 received at 51449 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Mark Bestley <gnu <at> bestley.co.uk>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 51449 <at> debbugs.gnu.org
Subject: Re: bug#51449: 28.0.50; iso-transl overwrites alt key bindings
Date: Thu, 28 Oct 2021 08:40:18 +0000
[Message part 1 (text/plain, inline)]
>
> (setq mac-command-modifier 'alt)
>
> (global-set-key (kbd "A-c")  'info)
> (global-set-key (kbd "A-z")  'info)
>
> Then A-z runs info but A-c just inserts ¢
>

That's because iso-transl uses key-translation-map, which happens before 
the key is searched in the global-map.

But what do you want to do exactly?  As I said earlier,

(setq mac-command-modifier 'meta)
(setq mac-right-command-modifier 'alt)

should I think give you what you want: a meta key on the left of the space 
bar, an alt key on the right of the space bar.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Thu, 28 Oct 2021 08:52:02 GMT) Full text and rfc822 format available.

Message #22 received at 51449 <at> debbugs.gnu.org (full text, mbox):

From: "Mark Bestley" <gnu <at> bestley.co.uk>
To: "Gregory Heytings" <gregory <at> heytings.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 51449 <at> debbugs.gnu.org
Subject: Re: bug#51449: 28.0.50; iso-transl overwrites alt key bindings
Date: Thu, 28 Oct 2021 09:51:29 +0100

On Thu, 28 Oct 2021, at 09:40, Gregory Heytings wrote:
>>
>> (setq mac-command-modifier 'alt)
>>
>> (global-set-key (kbd "A-c")  'info)
>> (global-set-key (kbd "A-z")  'info)
>>
>> Then A-z runs info but A-c just inserts ¢
>>
>
> That's because iso-transl uses key-translation-map, which happens before 
> the key is searched in the global-map.
>

Yes I now remember debugging this a few years ago.

> But what do you want to do exactly?  As I said earlier,
>
> (setq mac-command-modifier 'meta)
> (setq mac-right-command-modifier 'alt)
>
> should I think give you what you want: a meta key on the left of the space 
> bar, an alt key on the right of the space bar.

What I want is to make A-c run the command I want - ie be able to bind it.

The issue is that the code I use Mac-key-mode <https://www.emacswiki.org/emacs/MacKeyMode> (and also Aquamacs) uses A-c as copy to match other MacOS programs.

I would say the bigger issue is that as Eli Zaretskii  said I should be able to rebind A-c 
Another way but I think not as good would be to make the A- bindings by iso-trans only occur if I ask for them.

From Eli's email saying I can unbind the keys - how do I do that?

In earlier emacs iso-transl was not loaded early (I think was only used in describe-bindings) so that we could work around this.

-- 
Mark




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Thu, 28 Oct 2021 08:58:01 GMT) Full text and rfc822 format available.

Message #25 received at 51449 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Mark Bestley <gnu <at> bestley.co.uk>
Cc: 51449 <at> debbugs.gnu.org
Subject: Re: bug#51449: 28.0.50; iso-transl overwrites alt key bindings
Date: Thu, 28 Oct 2021 08:57:47 +0000
>
> What I want is to make A-c run the command I want - ie be able to bind 
> it.
>

Then what you need is to unbind it in key-translation-map:

(define-key key-translation-map (kbd "A-c") nil)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Thu, 28 Oct 2021 09:42:02 GMT) Full text and rfc822 format available.

Message #28 received at 51449 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Mark Bestley" <gnu <at> bestley.co.uk>
Cc: 51449 <at> debbugs.gnu.org
Subject: Re: bug#51449: 28.0.50; iso-transl overwrites alt key bindings
Date: Thu, 28 Oct 2021 12:41:04 +0300
> Date: Thu, 28 Oct 2021 09:12:54 +0100
> From: "Mark Bestley" <gnu <at> bestley.co.uk>
> Cc: 51449 <at> debbugs.gnu.org
> 
> On Thu, 28 Oct 2021, at 08:12, Eli Zaretskii wrote:
> 
> >
> > iso-transl is preloaded now.  But I don't think I understand why it
> > gets in your way: can't you unbind the bindings that iso-transl does,
> > if you have no use for them, or rebind them after changing Alt to be a
> > modifier key if you do have use for iso-transl?
> >
> > (Caveat: I don't use a Mac, so I may be missing some Mac-specific
> > issue here.)
> 
> In scratch buffer on emacs - Q
> 
> 
> (setq  mac-command-modifier 'alt)
> 
> (global-set-key (kbd "A-c")  'info)
> (global-set-key (kbd "A-z")  'info)
> 
> Then A-z runs info but A-c just inserts ¢

I'm not arguing against facts, I asked why you cannot undo what
iso-transl does.  For example, disable key-translation-map, or
redefine its entries as you see fit.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Thu, 28 Oct 2021 10:54:02 GMT) Full text and rfc822 format available.

Message #31 received at 51449 <at> debbugs.gnu.org (full text, mbox):

From: "Mark Bestley" <gnu <at> bestley.co.uk>
To: "Eli Zaretskii" <eliz <at> gnu.org>
Cc: 51449 <at> debbugs.gnu.org
Subject: Re: bug#51449: 28.0.50; iso-transl overwrites alt key bindings
Date: Thu, 28 Oct 2021 11:53:25 +0100

On Thu, 28 Oct 2021, at 10:41, Eli Zaretskii wrote:
>> Date: Thu, 28 Oct 2021 09:12:54 +0100
>> From: "Mark Bestley" <gnu <at> bestley.co.uk>
>> Cc: 51449 <at> debbugs.gnu.org
>> 
>> On Thu, 28 Oct 2021, at 08:12, Eli Zaretskii wrote:
>> 
>> >
>> > iso-transl is preloaded now.  But I don't think I understand why it
>> > gets in your way: can't you unbind the bindings that iso-transl does,
>> > if you have no use for them, or rebind them after changing Alt to be a
>> > modifier key if you do have use for iso-transl?
>> >
>> > (Caveat: I don't use a Mac, so I may be missing some Mac-specific
>> > issue here.)
>> 
>> In scratch buffer on emacs - Q
>> 
>> 
>> (setq  mac-command-modifier 'alt)
>> 
>> (global-set-key (kbd "A-c")  'info)
>> (global-set-key (kbd "A-z")  'info)
>> 
>> Then A-z runs info but A-c just inserts ¢
>
> I'm not arguing against facts, I asked why you cannot undo what
> iso-transl does.  For example, disable key-translation-map, or
> redefine its entries as you see fit.


Mainly because I did not know the depths of emacs and what to do with key-translation-map and getting annoyed with something happening without me asking for it and being totally surprised by the change in bindings especially as I thought users had complete control of A- bindings, only C-x were reserved for emacs use. (Ie I had not require iso-trans myself)

I have now undone the iso-trans changes as Gregory suggested 

(dolist (transl-char iso-transl-char-map)
      (let ((vec (vconcat (car transl-char))))
        (aset vec 0 (logior (aref vec 0) ?\A-\^@))
        (define-key key-translation-map vec nil)))))



-- 
Mark




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51449; Package emacs. (Mon, 19 Sep 2022 20:17:02 GMT) Full text and rfc822 format available.

Message #34 received at 51449 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Mark Bestley" <gnu <at> bestley.co.uk>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 51449 <at> debbugs.gnu.org
Subject: Re: bug#51449: 28.0.50; iso-transl overwrites alt key bindings
Date: Mon, 19 Sep 2022 22:15:51 +0200
"Mark Bestley" <gnu <at> bestley.co.uk> writes:

> I have now undone the iso-trans changes as Gregory suggested 
>
> (dolist (transl-char iso-transl-char-map)
>       (let ((vec (vconcat (car transl-char))))
>         (aset vec 0 (logior (aref vec 0) ?\A-\^@))
>         (define-key key-translation-map vec nil)))))

Skimming this bug report, it looks like the conclusion here was that we
didn't want to do anything here on the Emacs side, so I'm closing this
bug report.




bug closed, send any further explanations to 51449 <at> debbugs.gnu.org and "Mark Bestley" <gnu <at> bestley.co.uk> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 19 Sep 2022 20:17:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 18 Oct 2022 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 184 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.