From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#38296: Allow Option key to be modifier for non-char key and mouse events Date: Fri, 22 Nov 2019 21:01:17 +0100 Message-ID: References: <20191121211207.GA96045@breton.holly.idiocy.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_A6DB67D8-4999-43DF-A409-69710546B755" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="14667"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38296@debbugs.gnu.org To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 22 21:02:22 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iYF8G-0003gM-Pw for geb-bug-gnu-emacs@m.gmane.org; Fri, 22 Nov 2019 21:02:21 +0100 Original-Received: from localhost ([::1]:54710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYF8F-00070Q-Lg for geb-bug-gnu-emacs@m.gmane.org; Fri, 22 Nov 2019 15:02:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51869) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYF87-0006yK-2x for bug-gnu-emacs@gnu.org; Fri, 22 Nov 2019 15:02:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iYF85-0004os-Pv for bug-gnu-emacs@gnu.org; Fri, 22 Nov 2019 15:02:11 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46726) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iYF85-0004oY-Bd for bug-gnu-emacs@gnu.org; Fri, 22 Nov 2019 15:02:09 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iYF83-0002N9-Pg for bug-gnu-emacs@gnu.org; Fri, 22 Nov 2019 15:02:08 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Nov 2019 20:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38296 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 38296-submit@debbugs.gnu.org id=B38296.15744528909074 (code B ref 38296); Fri, 22 Nov 2019 20:02:02 +0000 Original-Received: (at 38296) by debbugs.gnu.org; 22 Nov 2019 20:01:30 +0000 Original-Received: from localhost ([127.0.0.1]:55547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYF7R-0002MI-PJ for submit@debbugs.gnu.org; Fri, 22 Nov 2019 15:01:30 -0500 Original-Received: from mail155c50.megamailservers.eu ([91.136.10.165]:49632 helo=mail51c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYF7K-0002M1-Rc for 38296@debbugs.gnu.org; Fri, 22 Nov 2019 15:01:26 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1574452880; bh=6YIzLJZ9UGzYf0P6J75nAcdcCdnsmWtGt4JajAch9/0=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=VE6nywFI9SawUvRKrwa9u6J3HVLlClUGBlkzVALrfEpByuEcmCQW0xLUCq0p2TgaX 0KwVq/xHUKI2wOHIXUSLoYDDaaB+QozWlF4qihslGnPdxIX4am+6To+9m/VTm4H4O8 X/3TlLuHhvecU+61A7fc39qO8AuamQYWi4pG94hM= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail51c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id xAMK1IeJ005550; Fri, 22 Nov 2019 20:01:19 +0000 In-Reply-To: <20191121211207.GA96045@breton.holly.idiocy.org> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0205.5DD83E90.0020, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=LO0Yv6e9 c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=xuUGQPaXmpwfWq95fEQA:9 a=QEXdDO2ut3YA:10 a=VsNuRgc8kSGwKk-gQ9oA:9 a=B2y7HmGcmWMA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172260 Archived-At: --Apple-Mail=_A6DB67D8-4999-43DF-A409-69710546B755 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 21 nov. 2019 kl. 22.12 skrev Alan Third : > I was thinking about this and although the patch looks good to me, I > don=E2=80=99t find the variable name very descriptive. Perhaps it = would be > better to go with something like ns-alternate-modifier-function-only? Right. I wasn't satisfied with the name either, and ended up with = ns-{left,right}-alternate-for-char-entry, which seemed more to the = point. > Also probably best to add an ns-option-... alias too. Done. At first I thought it was just for compatibility and thus = superfluous, but you are right --- the keys have always been Option on = Macs; Alternate (or Alt) are from NeXT. > Do you think this functionality will only be required for the > alt/option key or will there be a demand to add it for command too? In > my experience the characters available via command are rather more > obscure, but I=E2=80=99ve little experience with non=E2=80=90UK = keyboards. I've never seen Command be used to select characters at all. Some = elaborate input methods? > Anyway, as to your question, I think I prefer the two variable > approach. It mirrors the existing modifier variables. Agreed. As noted above, I used symmetric variables for the left and = right option keys, both booleans, instead of a special 'left' value. Thanks for the review; new patch attached. --Apple-Mail=_A6DB67D8-4999-43DF-A409-69710546B755 Content-Disposition: attachment; filename=0001-Add-ns-left-right-alternate-for-char-entry.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Add-ns-left-right-alternate-for-char-entry.patch" Content-Transfer-Encoding: quoted-printable =46rom=2004a084cebc7ad77a6d11839b524f0441f66f7562=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Tue,=2019=20Nov=202019=2020:54:49=20+0100=0A= Subject:=20[PATCH]=20Add=20ns-{left,right}-alternate-for-char-entry=0A=0A= Allow=20the=20left=20and=20right=20Option=20keys=20to=20be=20used=20for=20= normal=20character=0Aentry=20while=20having=20them=20generate=20Emacs=20= modifiers=20for=20other=20events=20by=0Asetting=20= 'ns-left-alternate-for-char-entry'=20and=0A= 'ns-eight-alternate-for-char-entry',=20respectively,=20to=20non-nil.=0A=0A= The=20variables=20have=20the=20aliases=0A= 'ns-{left,right}-option-for-char-entry',=20following=20other=20= variables.=0A=0A*=20doc/emacs/macos.texi=20(Mac=20/=20GNUstep=20Basics):=20= Document=20the=20variables.=0A*=20lisp/cus-start.el=20(standard):=20= Allow=20customisation.=0A*=20src/nsterm.m=20(ev_modifiers_helper):=20= Simplify.=0A(right_modifier):=20New=20helper=20function.=0A= (EV_MODIFIERS2):=20Add=20arguments,=20use=20helper.=0A(EV_MODIFIERS):=20= Adapt=20EV_MODIFIERS2=20invocation.=0A(ns_get_shifted_character,=20= [EmacsView=20keyDown:]):=20Use=20the=20new=20variables.=0A= (syms_of_nsterm):=20Define=20the=20new=20variables.=0A*=20etc/NEWS:=20= Mention=20the=20new=20variables.=0A*=20lisp/term/ns-win.el:=20Add=20= variables=20aliases.=0A---=0A=20doc/emacs/macos.texi=20|=20=209=20= +++++++=0A=20etc/NEWS=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=206=20= +++++=0A=20lisp/cus-start.el=20=20=20=20|=20=202=20++=0A=20= lisp/term/ns-win.el=20=20|=20=208=20++++++-=0A=20src/nsterm.m=20=20=20=20= =20=20=20=20=20|=2057=20+++++++++++++++++++++++++++++++++++---------=0A=20= 5=20files=20changed,=2070=20insertions(+),=2012=20deletions(-)=0A=0Adiff=20= --git=20a/doc/emacs/macos.texi=20b/doc/emacs/macos.texi=0Aindex=20= d9920957ad..ae2b6c0774=20100644=0A---=20a/doc/emacs/macos.texi=0A+++=20= b/doc/emacs/macos.texi=0A@@=20-61,6=20+61,15=20@@=20Mac=20/=20GNUstep=20= Basics=0A=20ignore=20them,=20in=20which=20case=20you=20get=20the=20= default=20behavior=20of=20macOS=0A=20accentuation=20system=20from=20the=20= right=20@key{Option}=20key.=0A=20=0A+@vindex=20= ns-left-alternate-for-char-entry=0A+@vindex=20= ns-right-alternate-for-char-entry=0A+=20=20To=20make=20the=20left=20and=20= right=20@key{Option}=20keys=20retain=20their=20macOS=0A+behaviour=20for=20= entering=20characters=20but=20work=20as=20Emacs=20modifiers=20with=0A= +function=20keys=20and=20mouse=20actions,=20set=20the=0A= +@code{ns-left-alternate-for-char-entry}=20and=0A= +@code{ns-right-alternate-for-char-entry}=20variables,=20respectively,=20= to=20a=0A+non-nil=20value.=0A+=0A=20=20=20@kbd{S-mouse-1}=20adjusts=20= the=20region=20to=20the=20click=20position,=0A=20just=20like=20= @kbd{mouse-3}=20(@code{mouse-save-then-kill});=20it=20does=20not=20pop=0A= =20up=20a=20menu=20for=20changing=20the=20default=20face,=20as=20= @kbd{S-mouse-1}=20normally=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0A= index=209dd573bd97..4998e7047e=20100644=0A---=20a/etc/NEWS=0A+++=20= b/etc/NEWS=0A@@=20-3229,6=20+3229,12=20@@=20Previously=20it=20was=20= supported=20only=20in=20the=20Cygwin-w32=20build.=0A=20**=20Emacs=20now=20= handles=20key=20combinations=20involving=20the=20macOS=20"command"=0A=20= and=20"option"=20modifier=20keys=20more=20correctly.=0A=20=0A++++=0A+**=20= New=20user=20options=20'ns-{left,right}-option-for-char-entry'.=0A+Set=20= to=20non-nil=20to=20allow=20the=20respective=20macOS=20"option"=20keys=20= to=20be=20used=0A+for=20normal=20character=20entry=20while=20treating=20= them=20as=20Emacs=20modifiers=20for=0A+function=20keys=20and=20mouse=20= events.=0A+=0A=20**=20The=20special=20handling=20of=20= 'frame-title-format'=20on=20NS=20where=20setting=20it=0A=20to=20't'=20= would=20enable=20the=20macOS=20proxy=20icon=20has=20been=20replaced=20= with=20a=0A=20separate=20variable,=20'ns-use-proxy-icon'.=20=20= 'frame-title-format'=20will=20now=0Adiff=20--git=20a/lisp/cus-start.el=20= b/lisp/cus-start.el=0Aindex=20e4b6d8f2d6..81883bf1bd=20100644=0A---=20= a/lisp/cus-start.el=0A+++=20b/lisp/cus-start.el=0A@@=20-470,6=20+470,8=20= @@=20minibuffer-prompt-properties--setter=0A=20=09=09=20=20=20=20=20=20= (const=20control)=20(const=20meta)=0A=20=09=09=20=20=20=20=20=20(const=20= alt)=20(const=20hyper)=0A=20=09=09=20=20=20=20=20=20(const=20super))=20= "23.3")=0A+=09=20=20=20=20=20(ns-left-alternate-for-char-entry=20ns=20= boolean=20"27.1")=0A+=09=20=20=20=20=20= (ns-right-alternate-for-char-entry=20ns=20boolean=20"27.1")=0A=20=09=20=20= =20=20=20(ns-function-modifier=0A=20=09=20=20=20=20=20=20ns=0A=20=09=20=20= =20=20=20=20(choice=20(const=20:tag=20"No=20modifier=20(work=20as=20= function)"=20none)=0Adiff=20--git=20a/lisp/term/ns-win.el=20= b/lisp/term/ns-win.el=0Aindex=201841e679ac..432fa6040d=20100644=0A---=20= a/lisp/term/ns-win.el=0A+++=20b/lisp/term/ns-win.el=0A@@=20-541,11=20= +541,17=20@@=20ns-alternate-modifier=0A=20(defvar=20= ns-right-alternate-modifier)=0A=20(defvar=20ns-right-command-modifier)=0A= =20(defvar=20ns-right-control-modifier)=0A+(defvar=20= ns-left-alternate-for-char-entry)=0A+(defvar=20= ns-right-alternate-for-char-entry)=0A=20=0A=20;;=20You=20say=20tomAYto,=20= I=20say=20tomAHto..=0A=20(with-no-warnings=0A=20=20=20(defvaralias=20= 'ns-option-modifier=20'ns-alternate-modifier)=0A-=20=20(defvaralias=20= 'ns-right-option-modifier=20'ns-right-alternate-modifier))=0A+=20=20= (defvaralias=20'ns-right-option-modifier=20'ns-right-alternate-modifier)=0A= +=20=20(defvaralias=20'ns-left-option-for-char-entry=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20'ns-left-alternate-for-char-entry)=0A+=20=20= (defvaralias=20'ns-right-option-for-char-entry=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20'ns-right-alternate-for-char-entry))=0A=20=0A=20= (defun=20ns-do-hide-emacs=20()=0A=20=20=20(interactive)=0Adiff=20--git=20= a/src/nsterm.m=20b/src/nsterm.m=0Aindex=20e1d745e332..15cd79d97c=20= 100644=0A---=20a/src/nsterm.m=0A+++=20b/src/nsterm.m=0A@@=20-364,8=20= +364,7=20@@=20-=20(NSColor=20*)colorUsingDefaultColorSpace=0A=20=20=20if=20= (flags=20&=20either_mask)=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20BOOL=20= left_key=20=3D=20(flags=20&=20left_mask)=20=3D=3D=20left_mask;=0A-=20=20=20= =20=20=20BOOL=20right_key=20=3D=20(flags=20&=20right_mask)=20=3D=3D=20= right_mask=0A-=20=20=20=20=20=20=20=20&&=20!=20EQ=20(right_modifier,=20= Qleft);=0A+=20=20=20=20=20=20BOOL=20right_key=20=3D=20(flags=20&=20= right_mask)=20=3D=3D=20right_mask;=0A=20=0A=20=20=20=20=20=20=20if=20= (right_key)=0A=20=20=20=20=20=20=20=20=20modifiers=20|=3D=20= parse_solitary_modifier=20(right_modifier);=0A@@=20-380,7=20+379,14=20@@=20= -=20(NSColor=20*)colorUsingDefaultColorSpace=0A=20=20=20return=20= modifiers;=0A=20}=0A=20=0A-#define=20EV_MODIFIERS2(flags)=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20\=0A+/*=20Effective=20right=20= modifier,=20since=20RIGHT_MOD=20can=20be=20`left'.=20=20*/=0A+static=20= Lisp_Object=0A+right_modifier=20(Lisp_Object=20left_mod,=20Lisp_Object=20= right_mod)=0A+{=0A+=20=20return=20EQ=20(right_mod,=20Qleft)=20?=20= left_mod=20:=20right_mod;=0A+}=0A+=0A+#define=20EV_MODIFIERS2(flags,=20= left_alt,=20right_alt)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20\=0A=20=20=20(((flags=20&=20NSEventModifierFlagHelp)=20= ?=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20\=0A=20=20=20=20=20hyper_modifier=20:=200)=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20\=0A=20= =20=20=20|=20((flags=20&=20NSEventModifierFlagShift)=20?=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= \=0A@@=20-391,19=20+397,24=20@@=20-=20(NSColor=20= *)colorUsingDefaultColorSpace=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20NSRightControlKeyMask,=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20\=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= NSEventModifierFlagControl,=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20\=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20ns_control_modifier,=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20\=0A-=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ns_right_control_modifier)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20\=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20right_modifier=20(ns_control_modifier,=20=20=20=20=20= =20=20=20=20=20\=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ns_right_control_modifier))=20=20=20\=0A=20=20=20=20|=20= ev_modifiers_helper=20(flags,=20NSLeftCommandKeyMask,=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20\=0A=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20NSRightCommandKeyMask,=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20\=0A=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20NSEventModifierFlagCommand,=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20\=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20ns_command_modifier,=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20\=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ns_right_command_modifier)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20\=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20right_modifier=20(ns_command_modifier,=20=20=20=20=20= =20=20=20=20=20\=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ns_right_command_modifier))=20=20=20\=0A=20=20=20=20|=20= ev_modifiers_helper=20(flags,=20NSLeftAlternateKeyMask,=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20\=0A=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20NSRightAlternateKeyMask,=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20\=0A=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= NSEventModifierFlagOption,=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20\=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20ns_alternate_modifier,=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20\=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ns_right_alternate_modifier))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20left_alt=20?=20ns_alternate_modifier=20= :=20Qnil,=20=20=20=20=20=20\=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(right_alt=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20\=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20?=20right_modifier=20(ns_alternate_modifier,=20=20=20=20= =20\=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ns_right_alternate_modifier)=20\=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20:=20Qnil)))=0A=20=0A-#define=20= EV_MODIFIERS(e)=20EV_MODIFIERS2=20([e=20modifierFlags])=0A+#define=20= EV_MODIFIERS(e)=20EV_MODIFIERS2=20([e=20modifierFlags],=20true,=20true)=0A= =20=0A=20#define=20EV_UDMODIFIERS(e)=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= \=0A=20=20=20=20=20((([e=20type]=20=3D=3D=20NSEventTypeLeftMouseDown)=20= ?=20down_modifier=20:=200)=20=20=20=20=20=20=20\=0A@@=20-2630,13=20= +2641,15=20@@=20so=20some=20key=20presses=20(TAB)=20are=20swallowed=20by=20= the=20system.=20=20*/=0A=20=20=20NSTRACE=20("ns_get_shifted_character");=0A= =20=0A=20=20=20if=20((flags=20&=20NSRightAlternateKeyMask)=20=3D=3D=20= NSRightAlternateKeyMask=0A-=20=20=20=20=20=20&&=20(EQ=20= (ns_right_alternate_modifier,=20Qnone)=0A+=20=20=20=20=20=20&&=20= (ns_right_alternate_for_char_entry=0A+=20=20=20=20=20=20=20=20=20=20||=20= EQ=20(ns_right_alternate_modifier,=20Qnone)=0A=20=20=20=20=20=20=20=20=20= =20=20||=20(EQ=20(ns_right_alternate_modifier,=20Qleft)=0A=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20&&=20EQ=20(ns_alternate_modifier,=20= Qnone))))=0A=20=20=20=20=20modifiers=20|=3D=20rightOptionKey;=0A=20=0A=20= =20=20if=20((flags=20&=20NSLeftAlternateKeyMask)=20=3D=3D=20= NSLeftAlternateKeyMask=0A-=20=20=20=20=20=20&&=20EQ=20= (ns_alternate_modifier,=20Qnone))=0A+=20=20=20=20=20=20&&=20= (ns_left_alternate_for_char_entry=0A+=20=20=20=20=20=20=20=20=20=20||=20= EQ=20(ns_alternate_modifier,=20Qnone)))=0A=20=20=20=20=20modifiers=20|=3D=20= optionKey;=0A=20=0A=20=20=20if=20((flags=20&=20NSRightCommandKeyMask)=20= =3D=3D=20NSRightCommandKeyMask=0A@@=20-6287,7=20+6300,9=20@@=20In=20that=20= case=20we=20use=20UCKeyTranslate=20(ns_get_shifted_character)=0A=20=20=20= =20=20=20=20=20=20=20modifier=20keys,=20which=20returns=200=20for=20= shift-like=20modifiers.=0A=20=20=20=20=20=20=20=20=20=20Therefore=20its=20= return=20value=20is=20the=20set=20of=20control-like=0A=20=20=20=20=20=20=20= =20=20=20modifiers.=20=20*/=0A-=20=20=20=20=20=20emacs_event->modifiers=20= =3D=20EV_MODIFIERS2=20(flags);=0A+=20=20=20=20=20=20bool=20left_alt=20=3D=20= fnKeysym=20||=20!ns_left_alternate_for_char_entry;=0A+=20=20=20=20=20=20= bool=20right_alt=20=3D=20fnKeysym=20||=20= !ns_right_alternate_for_char_entry;=0A+=20=20=20=20=20=20= emacs_event->modifiers=20=3D=20EV_MODIFIERS2=20(flags,=20left_alt,=20= right_alt);=0A=20=0A=20=20=20=20=20=20=20/*=20Function=20keys=20(such=20= as=20the=20F-keys,=20arrow=20keys,=20etc.)=20set=0A=20=20=20=20=20=20=20=20= =20=20modifiers=20as=20though=20the=20fn=20key=20has=20been=20pressed=20= when=20it=0A@@=20-9414,6=20+9429,26=20@@=20Convert=20an=20X=20font=20= name=20(XLFD)=20to=20an=20NS=20font=20name.=0A=20at=20all,=20allowing=20= it=20to=20be=20used=20at=20a=20lower=20level=20for=20accented=20= character=20entry.");=0A=20=20=20ns_right_alternate_modifier=20=3D=20= Qleft;=0A=20=0A+=20=20DEFVAR_BOOL=20("ns-left-alternate-for-char-entry",=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ns_left_alternate_for_char_entry,=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"Whether=20the=20left=20option=20or=20alternate=20key=20is=20= used=20for=20character=20entry.\n\=0A+When=20non-nil,=20the=20left=20= alternate=20/=20option=20key=20works=20as=20an=20Emacs=20modifier=20= for\n\=0A+function=20keys=20and=20mouse=20actions=20but=20not=20with=20= character-generating=20keys.\n\=0A+When=20nil,=20the=20key=20is=20= interpreted=20by=20Emacs=20for=20all=20events.\n\=0A+In=20either=20case,=20= `ns-alternate-modifier'=20describes=20what=20Emacs=20modifier\n\=0A+is=20= being=20generated.");=0A+=20=20ns_left_alternate_for_char_entry=20=3D=20= false;=0A+=0A+=20=20DEFVAR_BOOL=20("ns-right-alternate-for-char-entry",=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ns_right_alternate_for_char_entry,=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"Whether=20the=20right=20option=20or=20alternate=20key=20is=20= used=20for=20character=20entry.\n\=0A+When=20non-nil,=20the=20right=20= alternate=20/=20option=20key=20works=20as=20an=20Emacs=20modifier=20= for\n\=0A+function=20keys=20and=20mouse=20actions=20but=20not=20with=20= character-generating=20keys.\n\=0A+When=20nil,=20the=20key=20is=20= interpreted=20by=20Emacs=20for=20all=20events.\n\=0A+In=20either=20case,=20= `ns-right-alternate-modifier'=20describes=20what=20Emacs=20modifier\n\=0A= +is=20being=20generated.");=0A+=20=20ns_right_alternate_for_char_entry=20= =3D=20false;=0A+=0A=20=20=20DEFVAR_LISP=20("ns-command-modifier",=20= ns_command_modifier,=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "This=20variable=20describes=20the=20behavior=20of=20the=20command=20= key.\n\=0A=20Set=20to=20the=20symbol=20control,=20meta,=20alt,=20super,=20= or=20hyper=20means=20it=20is=20taken=20to=20be\n\=0A--=20=0A2.21.0=20= (Apple=20Git-122)=0A=0A= --Apple-Mail=_A6DB67D8-4999-43DF-A409-69710546B755--