Emacs Python 解释器调整

发布于 2024-11-26 00:45:21 字数 632 浏览 0 评论 0原文

配置 emacs 时遇到小问题。我正在尝试重新分配 M-Tab 键绑定以完成任何代码,因为它已经绑定到 ubuntu unity“选项卡/页面查看器”。

(require 'anything)
(require 'anything-ipython)
(when (require 'anything-show-completion nil t)
  (use-anything-show-completion 'anything-ipython-complete
                            '(length initial-pattern)))

这些是我必须重新绑定它的尝试。不是特别想要,但我知道它没有被其他任何东西占据。

;;; (define-key anything-mode-map (kbd "<F9>") 'anything)
;;; (define-key anything-show-completion-mode-map (kbd "<F9>") 'anything)
;;; (define-key anything-show-completion-map (kbd "<F9>") 'anything)

只是不太能完全正确。

Having minor issue configuring emacs. I am trying to re-assign the M-Tab key binding for anything code completion as its already bound to ubuntu unity "tab/page viewer".

(require 'anything)
(require 'anything-ipython)
(when (require 'anything-show-completion nil t)
  (use-anything-show-completion 'anything-ipython-complete
                            '(length initial-pattern)))

These are the attempts I have had to rebind it. don't particularly want but I know its not taken by anything else.

;;; (define-key anything-mode-map (kbd "<F9>") 'anything)
;;; (define-key anything-show-completion-mode-map (kbd "<F9>") 'anything)
;;; (define-key anything-show-completion-map (kbd "<F9>") 'anything)

Just can't quite get it right.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷爱 2024-12-03 00:45:21

我想您会发现您想要使用小写的“f9”: (kbd "") 而不是 (kbd "").

您可以使用 ChkF9 检查 Emacs 报告该键的内容,并逐字使用相同的字符串作为参数 (kbd)

另请注意,您使用 ESC 代替 Meta —— Emacs 会翻译它。因此 ESCTAB 将执行与 M-TAB 相同的操作。对于 TAB,您还可以使用 Ci 生成该字符代码,因此 MCi 是另一个现有绑定。

我查找了您提到的文件,anything-ipython.el 似乎是唯一绑定 M-TAB 的文件,并且根据其安装说明,您应该已经拥有以下代码:

;;  Install: 
;;  =======
;;
;; Setup anything python:
;; Put this file in your load path.
;; Add to .emacs:
;;
;; (require 'anything-ipython)
;; (add-hook 'python-mode-hook #'(lambda ()
;;                                 (define-key py-mode-map (kbd "M-<tab>") 'anything-ipython-complete)))
;; (add-hook 'ipython-shell-hook #'(lambda ()
;;                                   (define-key py-mode-map (kbd "M-<tab>") 'anything-ipython-complete)))
;;

所以我'我猜这就是你想要改变的。

I think you'll find that you want to use lower-case "f9": (kbd "<f9>") instead of (kbd "<F9>").

You can check with C-hkF9 to see what Emacs reports that key as being, and use that same string verbatim as the argument to(kbd).

Also note that you use ESC as a substitute for Meta -- Emacs will translate it. So ESCTAB will do the same as M-TAB. And in the case of TAB, you can also generate that character code with C-i, so M-C-i is another existing binding.

I looked up the files you mentioned, and anything-ipython.el seems to be the only one which binds M-TAB, and based on its installation instructions you should already have the following code:

;;  Install: 
;;  =======
;;
;; Setup anything python:
;; Put this file in your load path.
;; Add to .emacs:
;;
;; (require 'anything-ipython)
;; (add-hook 'python-mode-hook #'(lambda ()
;;                                 (define-key py-mode-map (kbd "M-<tab>") 'anything-ipython-complete)))
;; (add-hook 'ipython-shell-hook #'(lambda ()
;;                                   (define-key py-mode-map (kbd "M-<tab>") 'anything-ipython-complete)))
;;

So I'm guessing that's what you want to be changing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文