简体   繁体   English

如何将迷你缓冲区中的iswitch缓冲区名称限制为1行(在osx上升级emacs 24.1后行为已更改)?

[英]How do you restrict iswitch buffer names to 1 line in the minibuffer (behavior changed after emacs 24.1 upgrade on osx)?

When I upgraded to (vanilla) emacs 24.1 on OSX, using iswitch for switching buffers seems to behave differently. 当我在OSX上升级到(vanilla)emacs 24.1时,使用iswitch进行切换缓冲区的行为似乎有所不同。

When I press ctrl-x b to switch buffers, instead of restricting the list of buffers to 1 line, it shows every single buffer by expanding the mini-buffer to be several lines long, then progressively removes buffers as I type in the buffer name I'm switching to. 当我按ctrl-x b来切换缓冲区时,不是将缓冲区列表限制为1行,而是通过将迷你缓冲区扩展为几行来显示每个缓冲区,然后在我输入缓冲区名称时逐步删除缓冲区我正在转向。

I find having the status bar and mini buffer bumping up and down whenever I switch buffers to be visually distracting, so I want to recover the previous behavior, which cuts off buffer names which after 1 line. 我发现每当我切换缓冲区时,状态栏和迷你缓冲区都会上下颠簸,以便在视觉上分散注意力,所以我想恢复之前的行为,这会切断1行后的缓冲区名称。 How do I do this? 我该怎么做呢?

If you want to globally restrict the number of lines the minibuffer uses to a single line, this should work: 如果要全局限制迷你缓冲区使用的行数到一行,这应该有效:

(setq max-mini-window-height 1)

Additional info from documentation: 文档中的其他信息

The variable max-mini-window-height controls the maximum height for resizing the minibuffer window. 变量max-mini-window-height控制调整迷你缓冲窗口大小的最大高度。 A floating-point number specifies a fraction of the frame's height; 浮点数指定帧高度的一小部分; an integer specifies the maximum number of lines; 整数指定最大行数; nil means do not resize the minibuffer window automatically. nil表示不自动调整迷你缓冲区窗口的大小。 The default value is 0.25. 默认值为0.25。

However, if you just want to limit the number of minibuffer lines used by iswitchb, the documentation for iswitchb-minibuffer-setup-hook suggests: 但是,如果您只想限制iswitchb使用的迷你缓冲行数,则iswitchb-minibuffer-setup-hook的文档建议:

Iswitchb-specific customization of minibuffer setup. Iswitchb特定的迷你缓冲区设置定制。

This hook is run during minibuffer setup if `iswitchb' is active. 如果`iswitchb'处于活动状态,则在迷你缓冲区设置期间运行此挂钩。 For instance: 例如:

(add-hook 'iswitchb-minibuffer-setup-hook
    (lambda ()
        (set (make-local-variable 'max-mini-window-height) 3)))

will constrain the minibuffer to a maximum height of 3 lines when iswitchb is running. 当iswitchb运行时,将迷你缓冲区限制在3行的最大高度。

I do not think this behavior has changed between Emacs 23 and Emacs 24, so I'm not sure why you only see this now. 我不认为这种行为在Emacs 23和Emacs 24之间有所改变,所以我不确定你为什么现在才看到这个。 Maybe you had some customization to get this behavior, and it now fails to work in Emacs 24? 也许你有一些自定义来获得这种行为,它现在无法在Emacs 24中工作? If so, please report it so we can fix it. 如果是,请报告,以便我们解决。

Also note that with Emacs 24, the behavior of the default (non- iswitchb ) buffer switching is very close to the behavior of iswitchb . 另请注意,对于Emacs 24,默认(非iswitchb )缓冲区切换的行为非常接近iswitchb的行为。 The most visible difference is the display of potential completions which you can also get with Mx icomplete-mode , which does not affect the actual behavior, only the display, but also affects other completions. 最明显的区别是可以通过Mx icomplete-mode显示潜在的完成,这不会影响实际行为,只会影响显示,但也会影响其他完成。 Also icomplete-mode does try to limit the completion list it displays to about one line (additionally to the actual minibuffer's content, so you will still get some line-wrapping, but less so). icomplete-mode尝试将显示的完成列表限制为大约一行(除了实际的迷你缓冲区的内容,所以你仍然会得到一些换行,但不是这样)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM