Add a layer variable osx-swap-option-and-command

set to non-nil to swap command and option key on macOS
This commit is contained in:
Binbin Ye 2019-06-17 00:49:33 +09:00 committed by duianto
parent da3c7ee1f7
commit f644c59ab8
4 changed files with 11 additions and 1 deletions

View File

@ -2068,6 +2068,8 @@ Other:
- Fixed key binding issue when Emacs is launched in daemon mode.
- Added the default value =H-= (hyper) to =kbd-mac-command= if it's neither:
=hyper=, =super= or =alt= (thanks to Binbin Ye)
- Added a layer variable =osx-swap-option-and-command= defaults to =nil=
(thanks to Binbin Ye)
**** Pandoc
- Fixed =spacemacs/run-pandoc= not to reset =pandoc--local-settings=
(thanks to martian-f)

View File

@ -47,13 +47,15 @@ The different modifier keys can be set as follows:
osx-function-as nil
osx-right-command-as 'left
osx-right-option-as 'left
osx-right-control-as 'left))
osx-right-control-as 'left
osx-swap-option-and-command nil))
#+END_SRC
These are also the default values. Setting the right modifier to =left=
will equal the left modifier. Allowed values are: =super=, =meta=, =control=,
=alt= and =nil=.
Setting =nil= for modifiers will leave the left modifiers as emacs default.
Setting =osx-swap-option-and-command= to =t= will swap =command= and =option= key.
*** Use with non-US keyboard layouts
If you need the ~⌥~ key to type common characters such as ={[]}~= which is usual

View File

@ -60,6 +60,9 @@
(defvar osx-use-dictionary-app t
"If non nil use osx dictionary app instead of wordnet")
(defvar osx-swap-option-and-command nil
"If non nil swap option key and command key")
;; Use the OS X Emoji font for Emoticons
(when (fboundp 'set-fontset-font)
(set-fontset-font "fontset-default"

View File

@ -45,6 +45,9 @@
(when (member key-value allowed-values)
(setf (symbol-value internal-var) key-value))))
(when osx-swap-option-and-command
(cl-rotatef mac-command-modifier mac-option-modifier))
(defun kbd-mac-command (keys)
"Wraps `kbd' function with Mac OSX compatible Command-key (⌘).
KEYS should be a string such as \"f\" which will be turned into values