emacs-mac-port的command key能不能改回系统默认的command功能?

可以说是很气人了。emacs-mac-port自己把command改成了option。我又没办法把command键改回来。(setq mac-command-modifier 'command)或者(setq mac-command-modifier 'cmd)都没有用。我还想cmd复制粘贴呢。。。

系统默认的 Command 有什么功能?复制粘贴是应用(比如 Emacs )本身的功能。

mac默认的cmd+v粘贴,是应用本身的,只是mac绝大部分应用默认都把cmd+v绑定成粘贴吗?看来我孤陋寡闻了。

奇怪,我用的也是 emacs-mac-port 没有遇到这个问题……

我要是什么设置都不改,command就变成meta了。我要是把option弄成meta再把command取消,command功能就没了。

写的代码是

(setq mac-option-key 'meta)

(setq mac-command-key nil)如果不写这一行,那么command和option都是meta

如果用 Spacemacs 的话,加入 osx layer:

(osx :variables osx-command-as 'super)

不用 Spacemacs 的话:

(setq mac-command-modifier 'super)

我试着写过(setq mac-command-modifier 'super) 结果我试图cmd+v粘贴得时候居然报告我s-v not defined

这些 S- 的键绑定要自己定义的

以 Doom Emacs 定义的为例:

我自己是这样用的:meta key switch · GitHub

我定义的快捷键不多,一方面是常用的就这么几个,另一方面也是防止误操作。

1 个赞

嗯嗯,我看楼下给出的解法类似。看样子这是最优解了。

谢谢。看样子这是最优解了。

Reddit 上讨论过后发现 GNU Emacs 的 ns-win.el里有给 Mac 定义好的快捷键,不知为何 Emacs Mac Port 没在 loadup.el 里加载。

复制粘贴就可以用,不过快捷键对应的 ns- 开头的功能在 Emacs Mac Port 里缺失无法使用。

;; Here are some Nextstep-like bindings for command key sequences.
(define-key global-map [?\s-,] 'customize)
(define-key global-map [?\s-'] 'next-window-any-frame)
(define-key global-map [?\s-`] 'other-frame)
(define-key global-map [?\s-~] 'ns-prev-frame)
(define-key global-map [?\s--] 'center-line)
(define-key global-map [?\s-:] 'ispell)
(define-key global-map [?\s-?] 'info)
(define-key global-map [?\s-^] 'kill-some-buffers)
(define-key global-map [?\s-&] 'kill-current-buffer)
(define-key global-map [?\s-C] 'ns-popup-color-panel)
(define-key global-map [?\s-D] 'dired)
(define-key global-map [?\s-E] 'edit-abbrevs)
(define-key global-map [?\s-L] 'shell-command)
(define-key global-map [?\s-M] 'manual-entry)
(define-key global-map [?\s-S] 'ns-write-file-using-panel)
(define-key global-map [?\s-a] 'mark-whole-buffer)
(define-key global-map [?\s-c] 'ns-copy-including-secondary)
(define-key global-map [?\s-d] 'isearch-repeat-backward)
(define-key global-map [?\s-e] 'isearch-yank-kill)
(define-key global-map [?\s-f] 'isearch-forward)
(define-key global-map [?\s-g] 'isearch-repeat-forward)
(define-key global-map [?\s-h] 'ns-do-hide-emacs)
(define-key global-map [?\s-H] 'ns-do-hide-others)
(define-key global-map [?\M-\s-h] 'ns-do-hide-others)
(define-key global-map [?\s-j] 'exchange-point-and-mark)
(define-key global-map [?\s-k] 'kill-current-buffer)
(define-key global-map [?\s-l] 'goto-line)
(define-key global-map [?\s-m] 'iconify-frame)
(define-key global-map [?\s-n] 'make-frame)
(define-key global-map [?\s-o] 'ns-open-file-using-panel)
(define-key global-map [?\s-p] 'ns-print-buffer)
(define-key global-map [?\s-q] 'save-buffers-kill-emacs)
(define-key global-map [?\s-s] 'save-buffer)
(define-key global-map [?\s-t] 'ns-popup-font-panel)
(define-key global-map [?\s-u] 'revert-buffer)
(define-key global-map [?\s-v] 'yank)
(define-key global-map [?\s-w] 'delete-frame)
(define-key global-map [?\s-x] 'kill-region)
(define-key global-map [?\s-y] 'ns-paste-secondary)
(define-key global-map [?\s-z] 'undo)
(define-key global-map [?\s-+] 'text-scale-adjust)
(define-key global-map [?\s-=] 'text-scale-adjust)
(define-key global-map [?\s--] 'text-scale-adjust)
(define-key global-map [?\s-0] 'text-scale-adjust)
(define-key global-map [?\s-|] 'shell-command-on-region)
(define-key global-map [s-kp-bar] 'shell-command-on-region)
(define-key global-map [?\C-\s- ] 'ns-do-show-character-palette)