Emacs的:键绑定到TAB小缓冲区中的自动完成突破 [英] Emacs: Keybinding to TAB breaks autocompletion in minibuffer

查看:189
本文介绍了Emacs的:键绑定到TAB小缓冲区中的自动完成突破的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单地说,我只是设置上的Tab键一键绑定,但现在当我在小缓冲区来自动完成命令推TAB时,出现以下消息:标记没有设置现在,所以没有区域

在换句话说,我只需要我的TAB键绑定,当我的光标在缓冲区(而不是迷你缓冲区)。

在我下面的例子中,我该怎么设置我的标签,当我在文本/基本模式在缓冲区中没有小缓冲区失去自动完成,而缩进?我有以下功能和键绑定:

  ;;按住Shift键选定区域的权利,如果距离为阳性,如果留下
;;负 (defun函数移区域(距离)
   (让((标志(标记)))
     (节省冲程
       (缩进刚性地(区域开头)(区域末端)的距离)
       (推标记标记T(T))
       ;;告诉命令循环,不要停用该商标
       ;;瞬态标记模式
       (setq取消标记无))))(defun函数右移()
  (互动)
  (移区域2))(defun函数左移位()
  (互动)
  (按住Shift键区-2));;绑定(右移)和(左移位)功能,您最喜爱的钥匙。我用
;;这样按Ctrl-Shift键右箭头键移动选定的文本之一以下
;;栏的右侧,按Ctrl-Shift键,左箭头移动选定的文字中的一个
;;柱向左:;; (全球设置键[C-S-右]'右移)
;; (全球设置键[C-S-左]'移位左)
(全球设置键[标签]'右移)
(全球设置键[退格]'左移位)


解决方案

这个问题很简单,你必将你的命令 [标签] ,而不是\\ t的设置页表示图形用户界面下的TAB键,而是一个tty下的Emacs,而不是收到一个TAB字符(即?\\ t ) ,所以当你点击设置页的Emacs首先查找设置页约束力,如果没有任何一个功能键地图重新映射把它变成一个?\\ t 并再次尝试。迷你缓冲区只绑定\\ t的,所以任何全局绑定到 [标签] 将采取precedence。

在短,使用(全球设置键\\ t的'右移)键,这个问题就会消失。

Simply put, I just set a keybinding on the TAB key, but now when I push TAB in the minibuffer to auto-complete a command, it fails with the following message: The mark is not set now, so there is no region.

In other words, I only need my TAB keybinding when my cursor is in the buffer (not the minibuffer).

In my example below, how can I set my tab to indent when I am in text/fundamental mode in the buffer without losing autocompletion while in the mini-buffer? I have the following functions and key-bindings:

;; Shift the selected region right if distance is postive, left if
;; negative

 (defun shift-region (distance)
   (let ((mark (mark)))
     (save-excursion
       (indent-rigidly (region-beginning) (region-end) distance)
       (push-mark mark t t)
       ;; Tell the command loop not to deactivate the mark
       ;; for transient mark mode
       (setq deactivate-mark nil))))

(defun shift-right ()
  (interactive)
  (shift-region 2))

(defun shift-left ()
  (interactive)
  (shift-region -2))

;; Bind (shift-right) and (shift-left) function to your favorite keys. I use
;; the following so that Ctrl-Shift-Right Arrow moves selected text one 
;; column to the right, Ctrl-Shift-Left Arrow moves selected text one
;; column to the left:

;; (global-set-key [C-S-right] 'shift-right)
;; (global-set-key [C-S-left] 'shift-left)
(global-set-key [tab] 'shift-right)
(global-set-key [backtab] 'shift-left)

解决方案

The problem is simply that you bound your command to [tab] rather than to "\t". tab denotes the TAB key under GUIs, but under a tty Emacs instead receives a TAB character (i.e. ?\t), so when you hit tab Emacs first looks for a tab binding and if there isn't any, a function-key-map remapping turns it into a ?\t and tries again. The minibuffer only binds "\t", so any global binding to [tab] will take precedence.

In short, use (global-set-key "\t" 'shift-right) and this problem will disappear.

这篇关于Emacs的:键绑定到TAB小缓冲区中的自动完成突破的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆